Learn from nature! Algorithms inspired by evolution, swarms, and natural processes.
1. Fitness Function
Measures solution quality. Higher fitness = better solution.
2. Selection Probability (Roulette Wheel)
Probability of selecting individual is proportional to its fitness.
Example:
If fitness values are [10, 20, 30], probabilities are [16.7%, 33.3%, 50%]
3. Crossover (Single-Point)
Combine genetic material at crossover point
Example:
Parent 1: 11001010
Parent 2: 00110101
Child: 11000101 (crossover at position 4)
4. Mutation
Flip bits with mutation probability = 10%
Example:
Before: 11001010
After: 11011010 (bit 3 mutated)
5. Average Fitness Evolution
Average fitness at generation with population size
Selection: Better solutions (higher ) have higher , more likely to reproduce
Crossover: Combines good traits from parents (rate = 80%)
Mutation: Introduces diversity, prevents premature convergence (rate = 10%)
Result: Average fitness increases over generations
Like breeding the perfect recipe! Start with random recipes, keep the best ones, mix them together (crossover), add small changes (mutation), and repeat!
Number of solutions in each generation
Probability of combining parent genes
Probability of random gene changes
Best Fitness: 5.00
Average Fitness : 5.00
Population Size N: 20
Improvement: 0%
Create random population of solutions
N = 20 individuals
Choose parents based on fitness
Combine parent genes
Rate = 80%
Random gene changes
= 10%