The Problem
Complicated Problem!
Major�Features
Main details
OVERVIEW
Students
Rooms
Courses
Time Slots
Teachers
We have to match these resources to each other optimally.
Time table Scheduling Problem
Resource Matching Problem
Optimization Problem
Mathematical Optimization Problems
Demo and Screenshots
Inputs
First we import the TimeSched Class and declare the days and number of hours in each day,
Then we declare the different groups of students.
For example here,
Class of CSE is divided into 4 groups (G1 & G2 and Bio & Econ). ��Strength of each group is mentioned, which will help in room allocation.��Tags are declared for each of these.
Inputs
Then we declare the various teachers.
The tags are just for our own reference, they will help us later on while declaring the requirements.
Inputs
Similarly, Rooms are declared.
Here we declare three rooms, Lecture Hall F1, F2 and a Computer Lab Room.
Notice, LH-F2 has a working Projector!
So we add a tag ‘Proj’ to it.
Comp Lab is a Lab room so it has tag ‘Lab’.
We could also similarly declare Extra Resources which have an id and tags but for now I left it blank for the demo.
Courses
Now we come to the crucial part, the COURSES.
This part is different from the static inputs, because this is not JSON data, it is JavaScript!
Let us go through this.
First each course has a `name` which should be unique. (It could be `CSD-411` etc.)
We declare which resources we want through an arrow function which returns true if it wants that resource.
Requirements
Note: there is a difference between “studentsRequired” and the rest of the functions.��First we ask for ALL the students which contain the tag CSE. They have to attend this C++ lecture 4 times weekly.
For the other resources, ANY ONE resource matching the function will be assigned. So, any professor from CSE dept, any room in LH, and any time slot with duration 1.
This will allocate the resources and add the lecture to some appropriate place in the time table. Similarly we create a lecture for Math.
Selecting Students
CSE Lecture��studentsRequired: � (s) => s.tags.includes(‘CSE’)
CSE: G1
G2
ECE: G1
G2
Bio
Econ
Selecting Students
ECE Lecture��studentsRequired: � (s) => s.tags.includes(‘ECE’)
CSE: G1
G2
ECE: G1
G2
Bio
Econ
Selecting Students
Bio Nano Tech - Open Elective��studentsRequired: � (s) => s.tags.includes(‘Bio’)
CSE: G1
G2
ECE: G1
G2
Bio
Econ
Selecting Students
Economics - Open Elective��studentsRequired: � (s) => s.tags.includes(‘Econ’)
CSE: G1
G2
ECE: G1
G2
Bio
Econ
Selecting Students
CSE G1 Tutorial��studentsRequired: � (s) => s.tags.includes(‘CSE’)� && s.tags.includes(‘G1’)
CSE: G1
G2
ECE: G1
G2
Bio
Econ
Selecting Students
Some sort of Combined class??��studentsRequired: � (s) => s.tags.includes(‘CSE’)� || s.tags.includes(‘ECE’)
CSE: G1
G2
ECE: G1
G2
Bio
Econ
Selecting Students
One particular subgroup??��studentsRequired: � (s) => (s.id == “CSE_G1_Bio”)
CSE: G1
G2
ECE: G1
G2
Bio
Econ
Requirements
Wait, Why are we using JavaScript Arrow functions here??
Suppose we wanted that the C++ lecture can take place on any time slot but not after lunch. We could write the condition like this:
�So we are not limited in our language and we can write very powerful queries here. This, combined with the tagging system provides a lot of flexibility in specifying real world conditions which would be very hard to do with static data!
Requirements
Similarly we declare our requirements for Labs, Tutorials and Open Elective classes. We can combine arbitrary groups of students thanks to the tagging system! We can also require that the Tutorial should be in some room which has a projector.
Requirements
We can then also declare the Lunch Hours. Lunch hours [2,3] means that every student should have at least one empty slot in the 3rd or 4th hour. (This is 0-indexed).
We declare the relative penalty for no lunch, overlapping classes and some day ending too late (like a lab exceeding the limit of 6pm).
We also declare the time preference. Like, no one wants to wake up early on monday and everyone wants to leave quickly on friday.
After we declare our requirements we just run it for 10000 steps!
OUTPUT
Running the code is simple: ��$ npm install�$ npm start
The code starts iterating and it shows an evaluation which is a large negative number and it will try to maximise this evaluation (so it should converge to 0 hopefully).
At the end of 10000 iterations it saves the best value found so far to files on the disk.
It stores it in a JSON format with all details, along with three human readable views shown ahead. (Students view, Faculty View and Rooms View)
Student View (G1 Bio)
Student View (G1 Econ)
Student View (G2 Econ)
Student View (G2 Bio)
Rooms View (LH-F2)
Rooms View (Comp Lab)
Faculties View
It Worked!
The code did manage to solve most of the constraints we threw at it.
In particular the following things can be seen:
Extensibility
The code is easily extensible. To add a new feature, we have to simply add a new term to the penalty function.
class TimeSched {
evaluation(t: TimeTable): number {�
let evaluation = 0;
� evaluation -= StudentsOverlap(t);
� evaluation -= FacultyOverlap(t);�� evaluation -= NoLunchBreak(t);
� evaluation -= RepeatedLectures(t);
� evaluation += ConsistencyBonus(t);
� return evaluation;
}�
}
Extensibility
class TimeSched {
evaluation(t: TimeTable): number {�
let evaluation = 0;
� [...]�� evaluation -= RoomDistance(r1, r2);
� return evaluation;
}�
}
Another Example!
�With the consistency condition
And more complexity
Problem
CSE 2nd year
G1 G2
CSE 1st year
Econ and Bio
ECE 1st Year
Econ and Bio
Subjects:
Challenges
Challenges:
CSE 2nd year
G1 G2
CSE 1st year
Econ and Bio
ECE 1st Year
Econ and Bio
Let us see the output… ��After 200000 steps…
Students View
CSE - YEAR 1 - BIO
CSE - YEAR 1 - BIO
CSE - YEAR 1 - ECON
CSE - YEAR 1 - BIO
CSE - YEAR 2 - GROUP 1
CSE - YEAR 1 - BIO
CSE - YEAR 2 - GROUP 2
CSE - YEAR 1 - BIO
ECE - YEAR 1 - BIO
CSE - YEAR 1 - BIO
ECE - YEAR 1 - ECON
CSE - YEAR 1 - BIO
Faculty View
Dr. S. Chand
CSE - YEAR 1 - BIO
Dr. Priyanka
CSE - YEAR 1 - BIO
Dr. Amit
CSE - YEAR 1 - BIO
Dr. Manoj
CSE - YEAR 1 - BIO
Dr. Ghosh
CSE - YEAR 1 - BIO
Rooms View
Lecture Hall - 1
CSE - YEAR 1 - BIO
Lecture Hall - 2
CSE - YEAR 1 - BIO
Computer Lab
CSE - YEAR 1 - BIO
Comparison B/w Various Algorithms Implemented
We have tried to schedule time table by implementing various algorithms and tried to compare them.
Various Approaches
Improvements to Hill Climbing Algorithm
Improvements to Hill Climbing Algorithm
Improvements to Hill Climbing Algorithm
Improvements to Hill Climbing Algorithm
Simulated Annealing Algorithm
Implementation of Simulated Annealing and ACO
Brute Force
Hill Climb
(Standard version�With increasing�Iterations)
Hill Climb
(Two Step version�With increasing�Iterations)
Hill Climb
(Three step version)
Simulated annealing�With various parameters
ACO