0% found this document useful (0 votes)
30 views11 pages

21i2995 Report AI F

The document discusses solving the timetable scheduling problem at a university by developing an algorithmic solution. It involves assigning courses, professors, sections and rooms while minimizing conflicts and optimizing resource allocation based on various constraints. The methodology includes understanding the problem, representing data, designing an algorithm and fitness function to evaluate solutions.

Uploaded by

mahnoor.younas75
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views11 pages

21i2995 Report AI F

The document discusses solving the timetable scheduling problem at a university by developing an algorithmic solution. It involves assigning courses, professors, sections and rooms while minimizing conflicts and optimizing resource allocation based on various constraints. The methodology includes understanding the problem, representing data, designing an algorithm and fitness function to evaluate solutions.

Uploaded by

mahnoor.younas75
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

ARTIFICIAL

INTELLIGENCE SPRING
2024

PREPARED BY:
MAY, 2024 Mahnoor Younas (21i2995)
INTRODUCTION
In the dynamic landscape of university education, crafting a timetable tailored to each
semester poses a significant challenge. The Timetable Scheduling Problem is a classic
conundrum within academia, demanding the meticulous allocation of time slots to
sections, professors, and rooms while minimizing conflicts. Essentially, it's about
creating schedules that ensure smooth operations without clashes or overlaps.

PROBLEM
The problem to solve is the Timetable Scheduling Problem within a university
environment. This involves creating timetables for each semester that allocate time
slots to different sections, professors, and rooms while minimizing conflicts. The aim is
to ensure that classes are scheduled without overlaps, rooms are utilized efficiently,
and professors are not double-booked. This problem becomes more complex due to
various constraints, such as room capacities, professor availability, and the need to
accommodate different types of courses (theory and lab sessions). Ultimately, the goal
is to develop an algorithmic solution that optimizes scheduling outcomes while meeting
the diverse requirements of university scheduling.

PROJECT SCOPE
Our project encompasses the comprehensive management of timetable scheduling for
university semesters. This includes assigning time slots to sections within specific
rooms, ensuring compatibility with professor availability, and accommodating various
course formats such as theory and lab sessions. We'll be tackling both hard constraints,
which are non-negotiable, and soft constraints, which allow some flexibility to optimize
scheduling outcomes.
INTRODUCTION
In the dynamic landscape of university education, crafting a timetable tailored to each
semester poses a significant challenge. The Timetable Scheduling Problem is a classic
conundrum within academia, demanding the meticulous allocation of time slots to
sections, professors, and rooms while minimizing conflicts. Essentially, it's about
creating schedules that ensure smooth operations without clashes or overlaps.

CHALLENGES
Several challenges lie ahead in addressing the Timetable Scheduling Problem. These
include the intricate coordination of course schedules, room availability, and professor
assignments while adhering to stringent constraints. Additionally, balancing the
optimization of resources with the diverse preferences and needs of stakeholders
presents a complex puzzle to solve. However, overcoming these challenges is crucial to
delivering an effective solution that meets the diverse requirements of university
scheduling.

METHODOLOGY
The methodology for addressing the Timetable Scheduling Problem involves a
systematic approach to designing and implementing an algorithmic solution. Here's a
breakdown of the key steps involved:

Problem Understanding: Begin by thoroughly understanding the requirements and


constraints of the timetabling problem. This involves analyzing factors such as course
offerings, room capacities, professor availability, and scheduling preferences.
Data Representation: Encode all relevant information into a suitable data structure.
This may include details about courses, sections, professors, rooms, time slots, and
constraints.
Algorithm Design: Develop an algorithmic approach to generate feasible timetables.
This may involve techniques such as constraint satisfaction, heuristic search, or genetic
algorithms.
Fitness Function Design: Define a fitness function that evaluates the quality of
generated timetables. The fitness function should quantify conflicts and clashes, with
the objective of minimizing their cumulative impact. As specified, the fitness function
should be an inverse or negative of the sum of all conflicts/clashes.
UNDERSTANDING
To effectively tackle the Timetable Scheduling Additionally, grasping the concept of
Problem, it's crucial to thoroughly understand chromosomes and populations is fundamental
the various elements at play. Firstly, to developing a genetic algorithm-based
comprehending the intricacies of hard and soft solution. In this context, chromosomes
constraints is essential. Hard constraints are represent potential solutions encoded in binary
non-negotiable rules that must be strictly format, containing information about courses,
adhered to, such as ensuring classes don't sections, professors, and room assignments.
overlap or professors aren't double-booked. Meanwhile, populations consist of a collection
Soft constraints, on the other hand, allow for of these chromosomes, representing a diverse
some flexibility and optimization, like minimizing set of potential timetables. By understanding
floor traversal or accommodating preferences how chromosomes encode relevant data and
for longer teaching blocks. Understanding how populations evolve over iterations through
these constraints provides the framework for genetic operators like crossover and mutation,
designing an algorithm that can generate we can design an algorithm that efficiently
feasible and efficient timetables while searches the solution space to find optimal or
balancing competing priorities. near-optimal timetables that satisfy the
constraints.

MAIN
Constants
Data Structures

KEY Fitness Function

POINTS
Objective Function
Genetic Algorithm Operations
Genetic Algorithm Implementation
Chromosome Formatting
Print Timetable
Running the Algorithm
ALGORITHMS
INVOLVED
GENETIC ALGORITHM (GA)
Genetic algorithms are heuristic search algorithms inspired by the
process of natural selection and evolution.
They operate on a population of potential solutions, represented as
chromosomes, and iteratively evolve these solutions to find an optimal
or near-optimal solution.

SELECTION OPERATION
In the selection operation, chromosomes are chosen from the current
population based on their fitness values.
Tournament selection is often used, where a random subset of
chromosomes is selected, and the fittest chromosome among them is
chosen to participate in crossover.

CROSSOVER OPERATION
Crossover is a genetic operator that combines genetic material from two
parent chromosomes to produce offspring chromosomes.

MUTATION OPERATION
Mutation is a genetic operator that introduces random changes in
chromosomes to maintain diversity in the population and prevent
premature convergence.
In the code, mutation is applied to each bit of the chromosome with a
probability determined by the mutation rate.
CODE
EXPLANATION
WHAT MULTIPLE FUNCTIONS PLAY ROLE IN THE PROBLEM

DEFINING CONSTANTS

n_bits: This constant represents the number of bits used to encode each
chromosome.

n_iter: This constant specifies the number of iterations or generations that


the genetic algorithm will perform.

n_pop: This constant sets the size of the population.

r_cross: This constant determines the crossover rate, which is the probability
that crossover (recombination) will occur between two parent
chromosomes during reproduction.

r_mut: This constant sets the mutation rate, which is the probability that a bit
in a chromosome will be mutated (flipped) during reproduction.
KEEPING TRACK

To efficiently manage the allocation of courses to professors, sections, and


rooms, the code establishes data structures for tracking assignments. Two
dictionaries, professor_courses and section_courses, are initialized to keep
tabs on courses assigned to each professor and section, respectively. This
organization ensures that courses are distributed appropriately among
faculty and student groups. Additionally, a list named occupied_rooms is
maintained to track which rooms are currently in use

TRACKING COURSE ASSIGNMENTS

These two functions, count_courses_assigned_to_professor and count_courses_assigned_to_section,


serve to tally the number of courses assigned to a given professor or section, respectively. The first
function takes a professor_id as input and checks if it exists within the professor_courses dictionary,
which keeps track of courses assigned to each professor. If the professor has not been assigned any
courses (i.e., their ID is not in the dictionary), the function returns 0. Otherwise, it returns the count of
courses assigned to that professor by fetching the length of the list associated with their ID in the
professor_courses dictionary. Similarly, the second function operates on section IDs, checking if the
ID exists within the section_courses dictionary. If the section has not been assigned any courses, it
returns 0; otherwise, it returns the count of courses assigned to that section by retrieving the length
of the list associated with its ID in the section_courses dictionary. These functions provide a
convenient way to determine the workload of professors and the course distribution among different
sections, aiding in the management and optimization of the timetable scheduling process.
EXTRACT VALUES FROM A CHROMOSOME

These lines of code extract specific values from a chromosome, which represents a potential
timetable solution to the Timetable Scheduling Problem. Each element of the chromosome
corresponds to a specific attribute of the timetable. Here's a breakdown of what values are stored:
1. course1: This variable stores the Course ID, which identifies the course being scheduled.
2. course2: Represents the Course Type, where 0 indicates a Theory course and 1 indicates a
Lab course.
3. section: Stores the Section ID, identifying the specific group or section of students enrolled in
the course.
4. section_strength: Represents the Section Strength, indicating the number of students in the
section.
5. professor: Stores the Professor ID, identifying the professor assigned to teach the course.
6. first_lecture_day: Represents the day of the week for the first lecture of the course.
7. first_lecture_timeslot: Stores the timeslot for the first lecture of the course.
8. first_lecture_room: Represents the Room ID where the first lecture of the course is scheduled.
9. first_lecture_room_size: Stores the size or capacity of the room assigned for the first lecture.
10. second_lecture_day: Represents the day of the week for the second lecture of the course.
11. second_lecture_timeslot: Stores the timeslot for the second lecture of the course.
12. second_lecture_room: Represents the Room ID where the second lecture of the course is
scheduled.
13. second_lecture_room_size: Stores the size or capacity of the room assigned for the second
lecture.
These values collectively define a timetable schedule by specifying the courses, sections,
professors, lecture timings, and room assignments for each course. The algorithm manipulates
these values to generate feasible timetable solutions while satisfying the specified constraints of
the problem.
OBJECTIVE AND TOURNAMENT

These functions are integral components of the genetic algorithm used to tackle the Timetable
Scheduling Problem. The "objective" function assesses the fitness of each potential timetable
solution encoded within a chromosome. By quantifying how well the timetable adheres to
specified constraints, such as avoiding scheduling conflicts, it assigns a fitness score to the
chromosome. Remarkably, this score is negative to signify that lower values indicate superior
solutions, aligning with the algorithm's objective to minimize conflicts. On the other hand, the
"selection" function implements a tournament selection process, a crucial aspect of evolutionary
algorithms. It conducts a competition among a subset of chromosomes, evaluating their fitness
scores and favoring those with lower scores, which signify fewer conflicts. This selection
mechanism plays a pivotal role in shaping subsequent generations, facilitating the propagation of
genetic material from fitter individuals and enhancing the algorithm's efficacy in finding optimal or
near-optimal solutions to the scheduling problem.
PRODUCING CHROMOSOMES

Initially, a population ("pop") of potential timetable solutions is generated. Each solution is


represented as a chromosome, encoded as a binary string with a length of "n_bits".
The chromosomes are created randomly using the NumPy randint function, where each bit
can take on values from 0 to 3, inclusive.

The fitness of each chromosome in the population is evaluated using the provided objective
function. This function quantifies how well each timetable solution satisfies the problem
constraints, such as minimizing scheduling conflicts.
The fitness scores are stored in the "scores" list.

After generating offspring chromosomes, the population is updated by replacing the current
generation with the newly created offspring.
This process continues for a specified number of iterations ("n_iter"), allowing the population
to evolve over time.
THANK YOU!

THIS REPORT IS THE PURE WORK OF MAHNOOR YOUNAS

You might also like