Last active
December 24, 2015 22:59
-
-
Save charlesreid1/6877038 to your computer and use it in GitHub Desktop.
PyEvolve Simple Program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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