Updated tournament selection

On small populations, there is now a lower bound on the tournament size.
This commit is contained in:
RyleyGG
2020-10-08 22:48:45 -04:00
parent 88927f7415
commit dcc3684202
3 changed files with 11 additions and 15 deletions

View File

@ -1,17 +1,14 @@
import EasyGA
import random
# Create the Genetic algorithm
ga = EasyGA.GA()
ga.population_size = 15
ga.chromosome_length = 10
ga.generation_goal = 100
ga.gene_impl = [random.randint,1,10]
ga.gene_impl = [random.randrange,1,100]
# Run Everything
ga.evolve()
# Print the current population
print(f"Current Generation: {ga.current_generation}")
ga.population.print_all()
ga.population.print_all()