Advanced Attributes - danielwilczak101/EasyGA GitHub Wiki

Size

There are 2 variables that control the size of the GA.

ga.chromosome_length   = 10     # Number of genes per chromosome
ga.population_size     = 10     # Number of chromosomes in the population
ga.generation_goal     = 100    # Number of generations the GA will run to before terminating

Selection Variables

There are 3 variables that affect the selection process.

# Ratio of chromosomes selected (1.0 = 1 parent for every chromosome in the population)
ga.parent_ratio          = 0.1  
# Probability that the best selected chromosome will be selected as a parent 
ga.selection_probability = 0.75  
# Ratio of chromosomes that will be selected for tournament_selection
ga.tournament_size_ratio = 0.1   

Termination Variables

There are 5 variables that affect the termination process.

ga.current_generation  = 0      # Number that represents the current generation
ga.current_fitness     = 0      # Number that represents the current fitness
ga.generation_goal     = 15     # Number of generations the GA will run to before terminating
ga.fitness_goal        = 9      # Target fitness the GA will run to before terminating
ga.tolerance_goal      = 1e-3   # Target tolerance the GA will run to before terminating
ga.target_fitness_type = 'max'  # Whether the ga should maximize or minimize the fitness

Mutation Variables

There are 2 variables that affect the mutation process.

ga.chromosome_mutation_rate    = 0.15  # Rate at which chromosomes get mutated
ga.gene_mutation_rate          = 0.05  # Rate at which genes in mutated chromosomes are mutated

Database Attributes

# If you don't want to store all data coming from the GA set to 
# false. This will also relieve some memory density issues.
ga.save_data = True
# Default file name
ga.database_name = 'database.db'

Misc Variables

These attributes don't fall under any category but allow for some functionality inside of EasyGA

ga.update_fitness      = True         # boolean for whether the ga should update the fitness
ga.population          = None         # Starting population variable