Chris Bartlett CSC416 Genetic Algorithm
Outline
Through reproduction, organisms are able to pass on their unique traits to their children. Due to this, when an organism develops a mutation that increases its rate of survival, that mutation may be passed on, thereby increasing the population’s rate of survival. An example of this is when insects having a natural immunity to a pesticide pass on that trait. Through selection, the population gradually develops an immunity to the pesticide. This genetic algorithm displays how that immunity can develop and spread to future generations over time.
Individuals
The individuals in this program are insects (as pesticides and immunity to a pesticide occurs across species, a specific insect type is not given).
● ● ●
Living insects are represented by the symbol: O Immune insects are represented by the symbol: @ Deceased insects are represented by the symbol: X (X O O O O O O O O O O O O X O @ @ O X O O O O O @)
Each row is thought of as being an area. During a sweep with pesticide, it’s possible that some areas will not be sprayed. It’s also possible that some areas may be sprayed multiple times. This is randomized to represent an area’s proactiveness in controlling the insect population.
Default: 25
Mutation
In real-world terms, this is when an insect acquires an immunity to the pesticide. When the initial population is created, some insects will have already had this trait developed. Through later generations, this trait is passed on. In terms of the program, a list is created with the positions of O’s in each area, and each O has a random chance of turning into an @.
(O O O O O O O O @ O O O O O O O O O O O O @ O O O) (O O O O O O O O @ O O O @ O O O O O O O O @ O O O)
Default: 5%
Pesticide
In real-world terms, this is when an area is sprayed with pesticide potentially killing off insects that are not immune. In terms of the program, a list of the positions where there’s a living insect (O’s) is created. For each living insect that’s not immune, there’s a chance that it’ll be killed off by the pesticide (changed to an X).
(O O O O O O O O @ O O O O O O O O O O O O O @ O O) (X O X X X O O O @ O O X O X O O O X O O O X @ O O)
Default: 75
Crossover
In real-world terms, this is when insects mate and create children. Not all insects will mate, nor will all matings create children. In terms of the program, only recovery from the pesticide is considered. As such, a list is created with the positions of deceased insects (X’s), and for each set of potential parents (for every 2 living insects), there is a chance that they’ll mate and produce one child.
(X X X O X X X X X X O O X X X O X X X X @ X X O X) 3 sets of parents (X X X O O X X X X X O O X X X O X X O X @ X X O X) Produced 2 children
Default: 60
Fitness
In real-world terms, fitness is considered to be a metric for how successful an organism is at reproducing. When a pesticide is introduced to an insect’s environment, large numbers of them may be wiped out. Therefore, possessing an immunity to the pesticide enables the continued survival of the species. Due to this, the fitness of the population is determined by the average of how many immune insects live within each area. In terms of the program, the total number of immune insects per area is calculated and then averaged. Additionally, the percentage of living members in the entire population is calculated.
Demo