RubyGems Navigation menu

charlie 0.8.1

DESCRIPTION: Charlie is a library for genetic algorithms (GA) and genetic programming (GP). == FEATURES: - Quickly develop GAs by combining several parts (genotype, selection, crossover, mutation) provided by the library. - Sensible defaults are provided with any genotype, so often you only need to define a fitness function. - Easily replace any of the parts by your own code. - Test different strategies in GA, and generate reports comparing them. Example report: charlie.rubyforge.org/example_report.html == INSTALL: * sudo gem install charlie == EXAMPLES: This example solves a TSP problem (also quiz #142): N=5 CITIES = (0…N).map{|i| (0…N).map{|j| [i,j] } }.inject{|a,b|a+b} class TSP < PermutationGenotype(CITIES.size) def fitness d=0 (genes + [genes]).each_cons(2){|a,b| a,b=CITIES,CITIES d += Math.sqrt( (a-b)**2 + (a-b)**2 ) } -d # lower distance -> higher fitness. end use EdgeRecombinationCrossover, InversionMutator end Population.new(TSP,20).evolve_on_console(50) This example finds a polynomial which approximates cos(x) class Cos < TreeGenotype(, [:-@], [:+,:*,:-]) def fitness -[0,0.33,0.66,1].map{|x| (eval_genes(:x=>x) - Math.cos(x)).abs }.max end use TournamentSelection(4) end Population.new(Cos).evolve_on_console(500)

Gemfile:
=

安装:
=

版本列表:

  1. 0.8.1 February 11, 2009* (218.5 KB)
  2. 0.8.0 February 11, 2008* (203.5 KB)
  3. 0.7.1 January 11, 2008* (198.5 KB)
  4. 0.7.0 January 10, 2008* (199.0 KB)
  5. 0.6.0 December 25, 2007* (85.5 KB)
显示所有版本 (共 6 个)

Development 依赖 (1):

hoe >= 1.8.3

所有者:

作者:

  • Sander Land

SHA 256 校验和:

=

下载总量 27,780

这个版本 5,748

版本发布:

许可:

需要的 Ruby 版本:

链接: