RubyGems Navigation menu

charlie 0.5.0

DESCRIPTION: Charlie is a library for genetic algorithms. It allows you to easily create and run genetic algorithms. You can choose selection, crossover or mutation strategies from either built-in options or simply write your own. It also includes methods that can be used to compare several of these strategies, generating reports with statistics that can be used to determine which one to use in future problems. == EXAMPLES: This example finds the binary representation of the number 512. require ‘rubygems’ require ‘charlie’ class Find512 < BitStringGenotype(10) # choose a genotype, in this case a list of 10 bits represents a solution # Define a fitness function. This one returns minus the offset to the best solution, so a higher number is better. # Usually, you won’t know the best solution, and will define this as some value that needs to be maximized. def fitness # Use the ‘genes’ function to retrieve the array of bits representing this solution. -(genes.map(&:to_s).join.to_i(2) - 512).abs end end # Finally, create an instance of a population (with the default size of 20) and let it run for the default number of 100 generations. Population.new(Find512).evolve_on_console

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. 0.5.0 December 18, 2007* (78.0 KB)
显示所有版本 (共 6 个)

Runtime 依赖 (1):

hoe >= 1.3.0

所有者:

作者:

  • Sander Land

SHA 256 校验和:

=

下载总量 27,780

这个版本 4,402

版本发布:

许可:

需要的 Ruby 版本: > 0.0.0

链接: