Algorithmically
Nature-Inspired Programming Recipes
Installation
Add this line to your application's Gemfile:
gem 'Algorithmically'
And then execute:
$ bundle
Or install it yourself as:
$ gem install Algorithmically
Usage
Evolutionary Algorithms
Algorithmically::Evolutionary::Genetic.new(100, 64, 100, 0.98)
Neural Algorithms
Algorithmically::Neural::Perceptron.new([[0,0,0], [0,1,1], [1,0,1], [1,1,1]], 2, 20, 0.1)
Stochastic Algorithms
Algorithmically::Stochastic::RandomSearch.new(2, 50)
Algorithmically::Stochastic::AdaptiveRandomSearch.new(1000, 2, 0.05, 1.3, 3.0, 10, 30)
Algorithmically::Stochastic::HillClimbing.new(2, 1000)
Algorithmically::Stochastic::GuidedLocalSearch.new(150, [[565,575],[25,185],[345,750],[945,685]], 20, 0.3)
b52 = [[595,360],[1340,725],[1740,245]]
max_iterations = 150
max_no_improv = 20
alpha = 0.3
local_search_optima = 12000.0
lambda = alpha * (local_search_optima/b52.size.to_f)
Algorithmically::Stochastic::Iterated_Local_Search.search(max_iterations, b52, max_no_improv, lambda)
Swarm Algorithms
Algorithmically::Swarm::ParticleSwarm.new(2, 100, 1000, 1000, 50, 100.0, 2.0, 2.0)