-
Notifications
You must be signed in to change notification settings - Fork 0
The GA portion of the loop is housed in a different repository (link to Shared-Code repo) as much of the code is able to be reused in other loops, such as PUEO. This means that if you'd like to see the code, you have to go there! We specifically are using the PyGA.
This portion creates the genetic information for each individual. The minimum and maximum values for each gene is set here for immigration (or creating new genetic material). When it's the initial generation, every individual is created through immigration as there is no pre-existing gene-pool to use! The next generations, however, will use different operators (which occur on certain percentages of the population based on run settings).
This will go through what each operator does and then after how individuals are selected to have these operators performed.
When we say reproduction, we mean asexual reproduction. This translates to an individual from a previous generation getting copied into the generation being created. This allows for individuals with good performances to persist through generations in our generational algorithm.
Crossover is similar to how we all were created. Two parents are selected and their genetic information is scrambled 50/50, which allows for new individuals to be created and allows for features of individuals to be combined. This operator is used to introduce large changes into the gene-pool without creating brand new individuals.
Mutation happens on a randomly selected gene in a selected individual. Then using a gaussian distribution with a sigma (defined in settings), a gene is changed (mutated). This is useful to introduce small changes into the gene-pool.
It's always good to introduce new genes into the pool and the way to do that is through injection. This operator creates a new individual without using any genetic information from the gene pool.
How does the loop decide which individuals are created through which operators?
In tournament selection the loop selects a percentage of the population, defined in the settings, and picks the best individual in that subset.
In roulette selection each individual in the gene pool (from the previous generation) is given a weight based on its fitness. After having the probability table of the population, an individual is randomly selected.
In rank selection the previous generation population is sorted from best to worst fitness and then an individual is selected randomly with those weights.