A web app that generates Time Tables using a Genetic Algorithm. This web app is at its basic stage such that it only makes timetables for 5 days a week, 7 hours a day.
Assuming you have Python3, Pip and Node and NPM installed. Run the following commands.
npm run install
npm run build
npm start
-
Batch
A batch means a group of students with a common admission year, graduation year and course.
-
Subject
A batch can have multiple subjects. A subject can be of the types - theory and lab.
-
Teacher
A subject can have one or more teachers.
- A teacher cannot have more than one subject at the same time.
-
Hard Constraints
- Lab subjects should be 3 hours long.
- A teacher cannot have more than one subject at the same time.
- The minimum limit for a subject to occur in a week is 4. The maximum is 5.
-
Soft Constraints
- All the faculties must at least take more than 7 periods a week.
- A faculty must not have 2 consecutive periods for 2 different batches
The population will be the required time table. The chromosomes are each hour in the time table. The chromosome will be in the following format.
[Batch, Subject, Teacher]
Refer this page to understand the terminology.
-
Get batch details, subject details, and teachers' details.
- Batch details include the name of the batch.
- Subject details include the name of the subject, minimum and maximum times it should be taken in a week, and how many hours does it take.
- Teachers' details include the names of the teachers.
{ "batches": [ { "name": "batch name", "subjects": [ { "name": "subject name", "teachers": ["teacher name", "teacher name"], "min": 0, "max": 0, "step": 0 } ] } ] }
-
Create the population matrix with dimensions [no of batches * no of days * no of hours per day][3].
-
Repeat the following for a limited number of iterations.
- Populate the matrix randomly with each element containing [Batch, Subject, Teacher] chromosomes within the minimum and maximum limits of the subjects.
- Check for conflicts.
- Repeat the following for a limited number of iterations.
- Try changing the teacher of the subjects with conflicts.
- Try swapping two subjects with conflicts in the same batch.
- Try swapping one subject with conflict with the adjacent subject.
- If there are no conflicts, exit both loops.
-
Print the population matrix as a time table.