Genetic algorithm
Author: Yunchen Huo (yh2244), Ran Yi (ry357), Yanni Xie (yx682), Changlin Huang (ch2269), Jingyao Tong (jt887) (ChemE 6800 Fall 2024)
Stewards: Nathan Preuss, Wei-Han Chen, Tianqi Xiao, Guoqing Hu
Introduction
Algorithm Discussion
The Genetic Algorithm was first introduced by John H. Holland [1] in 1973. It is an optimization technique based on Charles Darwin’s theory of evolution by natural selection.
Before diving into the algorithm, here are definitions of the basic terminologies.
- Gene: The smallest unit that makes up the chromosome (decision variable)
- Chromosome: A group of genes, where each chromosome represents a solution (potential solution)
- Population: A group of chromosomes (a group of potential solutions)
GA involves the following seven steps:
- Initialization
- Randomly generate the initial population for a predetermined population size
- Evaluation
- Evaluate the fitness of every chromosome in the population to see how good it is. Higher fitness implies better solution, making the chromosome more likely to be selected as a parent of next generation
- Selection
- Natural selection serves as the main inspiration of GA, where chromosomes are randomly selected from the entire population for mating, and chromosomes with higher fitness values are more likely to be selected
- Crossover
- The purpose of crossover is to create superior offspring (better solutions) by combining parts from each selected parent chromosome. There are different types of crossover, such as single-point and double-point crossover
[3] . In single-point crossover, the parent chromosomes are swapped before and after a single point. In double-point crossover, the parent chromosomes are swapped between two points [4] .
- Mutation
- Insertion
- Repeat 2-6 until a stopping criteria is met
Numerical Example
1. Simple Example
We aim to maximize , where . Chromosomes are encoded as 5-bit binary strings since the binary format of the maximum value 31 is 11111.
1.1 Initialization (Generation 0)
The initial population is randomly generated:
Chromosome (Binary) | x (Decimal) |
---|---|
10010 | 18 |
00111 | 7 |
11001 | 25 |
01001 | 9 |
1.2 Generation 1
1.2.1 Evaluation
Calculate the fitness values:
Chromosome | ||
---|---|---|
10010 | 18 | 324 |
00111 | 7 | 49 |
11001 | 25 | 625 |
01001 | 9 | 81 |
1.2.2 Selection
Use roulette wheel selection to choose parents for crossover. Selection probabilities are calculated as:
Thus,
Total Fitness
Compute the selection probabilities:
Chromosome | Selection Probability | |
---|---|---|
10010 | ||
00111 | ||
11001 | ||
01001 |
Cumulative probabilities:
Chromosome | Cumulative Probability |
---|---|
10010 | |
00111 | |
11001 | |
01001 |
Random numbers for selection:
Selected parents:
- Pair 1: 00111 and 11001
- Pair 2: 11001 and 10010
3. Crossover
Crossover probability:
Pair 1: Crossover occurs at position 2.
- Parent 1:
- Parent 2:
- Children: ,
Pair 2: No crossover.
- Children: Child 3: , Child 4:
References
- ↑ Holland, J. H. (1973). Genetic algorithms and the optimal allocation of trials. SIAM Journal on Computing, 2(2), 88–105
- ↑ Mirjalili, S. (2018). Genetic Algorithm. Evolutionary Algorithms and Neural Networks, Springer, pp. 43–56
- ↑ Mirjalili, S. (2018). Genetic Algorithm. Evolutionary Algorithms and Neural Networks, Springer, pp. 43–56
- ↑ Mirjalili, S. (2018). Genetic Algorithm. Evolutionary Algorithms and Neural Networks, Springer, pp. 43–56