Created
April 22, 2015 07:29
-
-
Save dekoza/aab1a518f048604803b7 to your computer and use it in GitHub Desktop.
Przykładowy algorytm genetyczny z użyciem biblioteki pyevolve
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 G1DList | |
from pyevolve import GSimpleGA | |
def przystos(chromosom): | |
wynik = 0.0 | |
for wart in chromosom: | |
if wart==1: | |
wynik += 1 | |
return wynik | |
genom = G1DList.G1DList(20) | |
genom.evaluator.set(przystos) | |
ga = GSimpleGA.GSimpleGA(genom) | |
ga.evolve(freq_stats=10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment