This project aims to generate a clash-free timetable for a given set of courses and rooms using a Genetic Algorithm. The algorithm takes a timetable in CSV format as input, preprocesses the data to get the number of rooms, all courses, and all time slots, and then generates a new timetable that satisfies certain constraints, such as avoiding course clashes no section having multiple courses at the same time and no teacher having multiple classes at the same time.
Before running the Genetic Algorithm, the script preprocesses the input timetable to get the following data:
- Number of rooms
- All courses
- All time slots
The Genetic Algorithm used in this project follows these steps:
- Generate an initial population of timetables.
- Evaluate each timetable's fitness based on the number of constraint mismatches.
- Select the fittest timetables for crossover and mutation.
- Apply crossover and mutation to create a new population of timetables.
- Evaluate each timetable's fitness again.
- Repeat steps 3-5 for a specified number of generations or until a satisfactory timetable is found.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
You will need to have Python 3.x installed on your machine. You can download the latest version of Python here.
You will also need to have Anaconda on your machine. You can download the latest version of Anaconda here.
Clone this repository onto your local machine.
git clone https://github.com/MuhammadAhmedSuhail/Clashless-TimeTable-using-AI.git
Install the required packages.
pip install -r requirements.txt
Note
Make Sure to have the timetable csv in the same directory as the python program.
To run the program, simply run the preprocessing Notebook first and then the Genetric Algorithm Notebook.
The Genetic algorithm will begin running to find the clashfree timetable. Once the algorithm has finished, the timetable will be saved in a csv.
- Python3 - Programming Language Used
- Pandas - Library used for importing/exporting and manipulating data.
The script outputs a new CSV file with the generated timetable (Timetable.csv), which is guaranteed to be clash-free. The user can then use this timetable to schedule classes.
- Muhammad Ahmed Suhail
- This project was completed as an assignment for Introduction to Artificial Intelligence at FAST - NUCES Islamabad.