Genetic Operations 66C472
1. **Problem Statement:**
Perform the following genetic algorithm operations on the given chromosomes:
(a) Uniform Crossover
(b) Rank Selection
(c) Flipping Mutation
Given:
Chromosome 1: 100101011110
Chromosome 2: 010101101011
2. **Uniform Crossover:**
Uniform crossover exchanges genes between two chromosomes based on a crossover mask, usually generated randomly.
Assuming a random mask (1 means take gene from Chromosome 1, 0 means from Chromosome 2):
Example mask: 101010101010
Apply mask:
Child 1 gene i = Chromosome 1 gene i if mask i = 1 else Chromosome 2 gene i
Child 2 gene i = Chromosome 2 gene i if mask i = 1 else Chromosome 1 gene i
Child 1:
Positions with mask 1: take from Chromosome 1
Positions with mask 0: take from Chromosome 2
Child 1 = 1 1 0 1 0 1 1 0 1 0 1 0
Child 2 = 0 0 0 0 1 0 0 1 1 1 1 1
3. **Rank Selection:**
Rank selection assigns selection probabilities based on the rank of fitness rather than raw fitness.
Assuming fitness values (for example):
Chromosome 1 fitness = 8
Chromosome 2 fitness = 7
Rank 1: Chromosome 1
Rank 2: Chromosome 2
Selection probability for rank $r$ in population size $N$ is:
$$ P(r) = \frac{2 (N + 1 - r)}{N (N + 1)} $$
For $N=2$:
$$ P(1) = \frac{2 (2 + 1 - 1)}{2 \times 3} = \frac{4}{6} = \frac{2}{3} $$
$$ P(2) = \frac{2 (2 + 1 - 2)}{2 \times 3} = \frac{2}{6} = \frac{1}{3} $$
So Chromosome 1 has a 2/3 chance to be selected, Chromosome 2 has 1/3.
4. **Flipping Mutation:**
Flipping mutation inverts bits at certain positions.
Assuming mutation at position 3 (0-based index):
Chromosome 1 before mutation: 1 0 0 1 0 1 0 1 1 1 1 0
Flip bit at position 3 (4th bit): 1 -> 0
Chromosome 1 after mutation: 1 0 0 0 0 1 0 1 1 1 1 0
**Final answers:**
- Uniform Crossover children:
Child 1: 110101101010
Child 2: 000010011111
- Rank Selection probabilities:
Chromosome 1: 2/3
Chromosome 2: 1/3
- Flipping Mutation on Chromosome 1 at position 3:
Result: 100001011110