Lab Task 6
Lab Task 6
Input:
● A list of N tasks, each with a specific duration. Example: tasks = [10, 15, 5, 8, 12, 7, 14,
6]
● A set of M workstations. Example: M = 3
● Beam width (number of best states to keep): Example: Beam Width = 3
Output:
● A schedule showing which task is assigned to which workstation.
● The total time for each workstation.
● A Gantt chart visualizing task assignments over time.
Constraints:
1. Each workstation can only process one task at a time.
2. The goal is to minimize the makespan (the maximum load across all workstations).
3. The heuristic function should evaluate states based on makespan.
4. Keep only the k-best states at each step (k = beam width).
Write a Python program that implements the Beam search algorithm to solve the problem.
Input:
● A list of N courses.
● A set of M classrooms.
● T available time slots.
● Course constraints:
○ Some courses cannot be scheduled at the same time.
○ Some courses require specific rooms (e.g., labs).
○ Each professor can only teach one course per slot.
Output:
Constraints:
1. No conflicts:
○ No professor can be assigned to multiple courses at the same time.
○ No student can have overlapping classes.
2. Classroom capacity must not be exceeded.
3. The algorithm should minimize empty time slots (improve schedule efficiency).
4. Simulated Annealing will be used to optimize the schedule.
5. Cooling schedule: Start with a high temperature and gradually reduce it using a factor
(e.g., 0.98).
Heuristic Function (h(n))
Example Input:
time_slots = 6
classrooms = 3
Example Output :
CS101 → Room 2 at Time Slot 1
MATH201 → Room 1 at Time Slot 3
PHYS301 → Room 3 at Time Slot 2
…
Conflicts remaining: 0