Assignment - Dry Run of Genetic Algorithm For Classroom Seating Arrangement
Assignment - Dry Run of Genetic Algorithm For Classroom Seating Arrangement
Problem Statement
You are tasked with organizing a classroom of 20 students. The objective is to arrange
the students in a 5x4 grid in a way that maximizes collaboration and minimizes
distractions. Some students prefer to sit near certain classmates, while others prefer
not to be seated next to specific students.
Example:
Individual 1: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20]
Individual 2: [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5,
4, 3, 2, 1]
2. Fitness Calculation:
Example:
3. Selection:
4. Crossover:
Example:
5. Mutation:
6. Repeat:
Assignment Task
1. Step 1: Initial Population:
Generate 4 random seating arrangements and write them down. You can make
up random student IDs (e.g., 1 to 20).
3. Step 3: Selection:
4. Step 4: Crossover:
5. Step 5: Mutation:
Apply mutation by swapping the positions of two randomly chosen
students.
Fitness Calculation:
Fitness of Individual 1: Collaboration pairs satisfied = 2, Distraction pairs
avoided = 1, Row preferences met = 3 → Fitness = 6
Fitness of Individual 2: Collaboration pairs satisfied = 0, Distraction pairs
avoided = 0, Row preferences met = 2 → Fitness = 2
Fitness of Individual 3: Collaboration pairs satisfied = 3, Distraction pairs
avoided = 2, Row preferences met = 1 → Fitness = 6
Fitness of Individual 4: Collaboration pairs satisfied = 1, Distraction pairs
avoided = 2, Row preferences met = 2 → Fitness = 5
Selection:
Select Individual 1 and Individual 3 as the parents for crossover.
Crossover:
Split both parents' seating arrangements and combine them to form a new child.
Mutation:
Swap the positions of two randomly chosen students.
Mutated Child: [1, 2, 3, 7, 5, 15, 4, 2, 4, 13]