Skip to content

AbdalrahmanBashir/genetic-algorithm-scheduler

Repository files navigation

A Genetic Algorithm Academic Scheduling Engine

A Genetic Algorithm Academic Scheduling Engine is a Python-based scheduler that uses evolutionary optimization to generate high-quality academic timetables. It handles real-world constraints such as room capacities, facilitator preferences, instructor load, time-slot conflicts, and special SLA course rules. Using a genetic algorithm, it evolves candidate schedules over multiple generations to find the optimal arrangement.


Features

  • Genetic Algorithm Optimization
    Uses selection, multi-point crossover, and adaptive mutation to iteratively improve schedules.

  • Constraint-Aware Fitness Function
    Evaluates schedules based on room capacity, facilitator preferences, workload balance, and SLA rules.

  • Time-Conflict Management
    Handles overlapping time slots, consecutive scheduling penalties, and SLA-specific timing constraints.

  • Facilitator Load Balancing
    Penalizes overloading facilitators while rewarding optimal assignments.

  • Customizable Inputs
    Easily define activities, facilitators, rooms, and time slots.

  • Exportable Results
    Produces a neatly formatted best_schedule.txt file with the final optimized schedule.


Installation

  1. Clone the repository:
git clone https://github.com/AbdalrahmanBashir/genetic-algorithm-scheduler.git
cd genetic-algorithm-scheduler
  1. Install dependencies (Python 3.8+ required):
pip install numpy

Usage

  1. Edit main.py to define your activities, rooms, facilitators, and time slots.
  2. Run the scheduling engine:
python main.py
  1. The best schedule will be saved as best_schedule.txt. The console will also print fitness improvements per generation.

How It Works

  1. Initial Population: Random schedules are generated.
  2. Fitness Calculation: Each schedule is scored based on constraints and penalties.
  3. Selection: Top schedules are probabilistically chosen using softmax on fitness scores.
  4. Crossover & Mutation: Selected schedules are combined and mutated to create new candidates.
  5. Iteration: Steps 2–4 repeat for a defined number of generations.
  6. Output: The highest-fitness schedule is saved and presented in a human-readable format.

Example Output

Best Schedule is:
Fitness Score: 3.75000

Activity      Facilitator          Room            Time Slot            Enrollment
--------------------------------------------------------------------------
SLA100A       Glen                 Slater 003      10                  50
SLA100B       Banks                Roman 201       11                  50
SLA191A       Tyler                Beach 301       12                  50
...

Why Use This Engine

Scheduling academic courses is a complex, NP-hard problem. This engine demonstrates how genetic algorithms can produce high-quality, near-optimal schedules efficiently, without brute-force search. It’s a practical solution for:

  • Universities and colleges
  • Training programs
  • Academic event scheduling
  • Research into evolutionary optimization

License

This project is licensed under the MIT License.


About

A Genetic Algorithm Academic Scheduling Engine is a constraint-aware scheduler that uses evolutionary optimization to generate high-quality academic timetables.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages