CT
CT
Q1) Explain the terms 'chromosome,' 'gene,' and 'allele' in the context of GAs. Describe the process of 'selection' in
genetic algorithms. What is a 'fitness function' in the context of a genetic algorithm?
1. Chromosome:
In Genetic Algorithms (GAs), a chromosome is a representation of a potential solution to the problem being solved.
It is usually encoded as a binary string, array of integers, or floating-point values, depending on the nature of the
problem.
• Each chromosome in the population represents a single solution.
• The structure of the chromosome encodes decision variables or parameters to be optimized.
Example:
For a solution with 8 binary decision variables, a chromosome could be:
[1, 0, 1, 1, 0, 0, 1, 0]
2. Gene:
A gene is the smallest unit of data in a chromosome. Each gene holds a value that corresponds to one variable of the
problem.
• It represents a part of the total solution.
• A chromosome is made up of multiple genes.
Example:
In the chromosome [1, 0, 1, 1, 0, 0, 1, 0], each digit (like 1, 0, etc.) is a gene.
3. Allele:
An allele is the specific value of a gene at a particular position in the chromosome.
• While a gene represents a slot, the allele is the content of that slot.
Example:
In the chromosome [1, 0, 1, 1, 0, 0, 1, 0], the allele at position 1 is 1, and at position 2 is 0.
Given:
Chromosome format: x = a b c d e f g h
Fitness function:
f(x) = (a + b) – (c + d) + (e + f) – (g + h)
Chromosomes:
• x₁ = 6 5 4 1 3 5 3 2
• x₂ = 8 7 1 2 6 6 0 1
• x₃ = 2 3 9 2 1 2 8 5
• x₄ = 4 1 8 5 2 0 9 4
Step-by-step Fitness Calculations:
x₁ = 6 5 4 1 3 5 3 2
x₂ = 8 7 1 2 6 6 0 1
• (a + b) = 6 + 5 = 11
• (a + b) = 8 + 7 = 15
• (c + d) = 4 + 1 = 5
• (c + d) = 1 + 2 = 3
• (e + f) = 3 + 5 = 8
• (e + f) = 6 + 6 = 12
• (g + h) = 3 + 2 = 5
• (g + h) = 0 + 1 = 1
• f(x₁) = 11 - 5 + 8 - 5 = 9
• f(x₂) = 15 - 3 + 12 - 1 = 23
x₃ = 2 3 9 2 1 2 8 5 x₄ = 4 1 8 5 2 0 9 4
• (a + b) = 2 + 3 = 5 • (a + b) = 4 + 1 = 5
• (c + d) = 9 + 2 = 11 • (c + d) = 8 + 5 = 13
• (e + f) = 1 + 2 = 3 • (e + f) = 2 + 0 = 2
• (g + h) = 8 + 5 = 13 • (g + h) = 9 + 4 = 13
• f(x₃) = 5 - 11 + 3 - 13 = -16 • f(x₄) = 5 - 13 + 2 - 13 = -19
Fitness Results:
Chromosome Fitness
x₂ 23
x₁ 9
x₃ -16
x₄ -19
Sorted from Fittest to Least Fit:
1. x₂ = 8 7 1 2 6 6 0 1 → Fitness = 23
2. x₁ = 6 5 4 1 3 5 3 2 → Fitness = 9
3. x₃ = 2 3 9 2 1 2 8 5 → Fitness = -16
4. x₄ = 4 1 8 5 2 0 9 4 → Fitness = -19
Q3) What are the basic operators of genetic algorithms? Explain the operational procedure of GA.
Characteristics:
• Sharp boundaries.
• No room for ambiguity.
• Simple but not human-like decision making.
Summary Table:
Component Function Real-life Analogy
Fuzzification Crisp → Fuzzy 28°C → "Warm" & "Hot"
Rule Base Set of IF-THEN rules IF Warm THEN Medium Fan
Defuzzification Fuzzy → Crisp Weighted Avg → 62% Fan
Q6) Name and explain different fuzzy membership functions with diagram. Explain the basic fuzzy set properties with
suitable example.