Answered step by step
Verified Expert Solution
Question
1 Approved Answer
BIRZEIT UNIVERSITY Computer Science Department COMP 3 3 8 Artificial Intelligence Spring 2 0 2 3 / 2 0 2 4 Assignment II Seating Arrangement
BIRZEIT UNIVERSITY
Computer Science Department
COMP Artificial Intelligence
Spring
Assignment II
Seating Arrangement Optimization
Objective
Design and implement a program that optimizes the seating arrangement of a group of
people based on their mutual dislikes. The goal is to minimize the total cost of seating
people together by using three optimization techniques: Genetic Algorithm, Simulated
Annealing, and Hill Climbing.
Problem Description
You are given a group of people and a x matrix representing the dislike costs
between each pair of people. The cost of seating two people together is given by the matrix,
where the value at the intersection of row i and column j represents the cost of seating
person i next to person j The seating arrangement is circular, meaning the first and the last
person are also considered to be seated next to each other.
Dislike Matrix
As given in the previous assignment I
Constraints
The seating arrangement is circular.
The total cost calculation should consider both directions between adjacent pairs to
avoid asymmetry.
Implement three optimization algorithms: Genetic Algorithm, Simulated
Annealing, and Hill Climbing.
BIRZEIT UNIVERSITY
Computer Science Department
COMP Artificial Intelligence
Spring
Requirements
FunctionMethod to Calculate Cost
Implement a methodfunction calculatecostarrangement that calculates the total
cost of a given seating arrangement.
Genetic Algorithm
Implement a genetic algorithm methodfunction
geneticalgorithmpopulationsize numgenerations
mutationrate to find an optimal seating arrangement.
Population initialization: Randomly generate the initial population.
Selection: Use elitism to select the top of the population based on their cost.
Crossover: Combine pairs of parents to create offspring.
Mutation: Randomly swap positions of two people in an arrangement with a given
mutation rate.
Simulated Annealing
Implement a simulated annealing methodfunction
simulatedannealinginitialtemperaturecoolingrate
numiterations to find an optimal seating arrangement.
Initial solution: Start with a random arrangement.
Temperature: Decrease the temperature gradually according to the cooling rate.
Acceptance probability: Accept worse solutions with a probability depending on
the current temperature to escape local minima.
Hill Climbing
BIRZEIT UNIVERSITY
Computer Science Department
COMP Artificial Intelligence
Spring
Implement a hill climbing methodfunction hillclimbingnumrestarts to
find an optimal seating arrangement.
Initial solution: Start with a random arrangement.
Neighbors: Generate neighbors by swapping pairs of people.
Restarts: Perform multiple random restarts to explore different parts of the solution
space.
Main Program
Implement the main part of the program to test the three algorithms.
Display the best seating arrangement and the corresponding total cost for each
algorithm.
Expected Output
Genetic Algorithm:
Best seating arrangement: List of names in optimal order
Total cost: X
Simulated Annealing:
Best seating arrangement: List of names in optimal order
Total cost: Y
Hill Climbing:
Best seating arrangement: List of names in optimal order
Total cost: Z
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started