Introduction
During my Smart India Hackathon (SIH) project, my team and I faced a complex scheduling challenge: how do we automatically generate conflict-free timetables for colleges while satisfying hundreds of academic, infrastructural, and NEP-based constraints?
A typical timetable involves multiple departments, subjects, faculty availability, classroom capacities, lab requirements, and optional courses. Creating this manually can take days and still lead to clashes. This inspired me to build an AI-driven Timetable Generator capable of producing optimized schedules in minutes.
Why a Genetic Algorithm?
Timetabling is a mix of constraint satisfaction and optimization. Traditional approaches break down because the search space is massive, hard constraints must always be met, and soft constraints improve the overall quality.
- The search space is huge (millions of combinations)
- Hard constraints must always be satisfied
- Soft constraints improve timetable quality
Genetic Algorithms (GAs) excel because they explore large solution spaces, evolve solutions over generations, and avoid local optima through mutation and crossover.
System Architecture
Backend
- FastAPI for high-performance APIs
- DEAP for Genetic Algorithms
- NumPy & Pandas for constraint evaluation
- PostgreSQL / Supabase for data storage
Frontend
- React-based interface
- Visual timetable preview
- CSV / Excel export
How the Algorithm Works
Chromosome Structure
Each chromosome represents a full timetable encoded as: course → faculty → room → day → time slot
Selection
Tournament selection picks the best-performing schedules.
Crossover
Swapping timetable segments creates new potential solutions.
Mutation
Random adjustments maintain diversity in the population.
Fitness Calculation
Penalties are applied for:
- Faculty clashes
- Room double-booking
- Student group overlaps
- Non-consecutive lab slots
- Overfilled classrooms
Results
- Timetable generation time reduced by 95%
- Zero hard-constraint violations in most runs
- NEP-compliant scheduling with optional courses
- Scales to large institutions
Conclusion
Building this AI Timetable Generator helped me combine Genetic Algorithms, FastAPI, optimization logic, and full-stack engineering to solve a real-world scheduling problem. It remains one of my most impactful and technically challenging projects.