Skip to content

Instantly share code, notes, and snippets.

@charlesreid1
Last active December 24, 2015 22:59
Show Gist options
  • Save charlesreid1/6877038 to your computer and use it in GitHub Desktop.
Save charlesreid1/6877038 to your computer and use it in GitHub Desktop.
PyEvolve Simple Program
from pyevolve import G1DBinaryString
from pyevolve import GSimpleGA
# http://pyevolve.sourceforge.net/ simple genetic algorithm example
genome = G1DBinaryString.G1DBinaryString(30)
genome.evaluator.set(lambda chromosome: sum(chromosome))
ga = GSimpleGA.GSimpleGA(genome)
ga.evolve(freq_stats=10)
print ga.bestIndividual()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment