GA Example
GA Example
Initialization of Population
2. Selection
3. Crossover/Recombination
4. Mutation
5. Survival/Accept
Each chromosome is an array where the index is the column (1–8) and the value is the row (1–8).
Fitness Probabilities:
Step 2: Selection
Parent 1 = 1 6 2 5 7 4 8 3
Parent 2 = 2 4 7 3 6 8 5 1
Step 3: Crossover
Step 4: Mutation
Mutated Child = 1 6 2 5 6 7 5 1
Step 5: Repeat
This new child is evaluated, added to the next generation, and the process repeats.
Final Goal:
0 Attacking Pairs
Fitness = 28
2
x
2. Maximize f ( x )= −3 x , when x in [0 to 31]
2
Update Population
Updated Population:
String Initial
No Population
1 [1,0,0,1,0]
2 [1,0,0,1,1]
3 [1,0,1,1,1]
4 [0,1,1,1,0]
5 [0,0,1,0,1]
6 [0,1,0,1,1]
7 [1,1,1,1,0]
New Cycle: