This project implements a constraint-based staff scheduling system using a SAT solver.
It generates and transforms work schedules for 20 people across multiple weeks, under strict rules of work distribution and rest.
- SAT formulation of the scheduling problem:
- 20 people assigned to stations over 14 days per week.
- Different numbers of daytime and nighttime stations.
- Constraints on workload, rest, and distribution.
- Exportable schedule:
planning_table.csv: station-based assignments.planning_par_personne.csv: person-based assignments with statistics.
- Transformations & Statistics:
- Number of days, nights, and Sundays worked per person.
- Easy-to-read pivot table (per person × per day).
The schedule must satisfy:
- Each station is occupied by exactly one person.
- A person cannot be assigned to more than one station per day/night.
- Maximum 4 worked days among days 1–6.
- Minimum 2 worked days among days 1–6.
- Maximum 3 assignments between Sunday (day 7) and nights (days 8–14).
- Minimum 1 assignment between Sunday (day 7) and nights (days 8–14).
- Mandatory rest: if a person works a night, they cannot work the following day.
.
├── planning\_sat.py # SAT encoding and solving
├── planning\_transformer.py # Transform station-based to person-based planning
├── planning\_table.csv # Example output (station-based)
├── planning\_par\_personne.csv # Example output (person-based with stats)
└── README.md # Project documentation
- PySAT – SAT encoding and solving
pandas– data manipulationitertools– combinatorial generation (standard library)re,string,csv– standard Python libraries
python planning_sat.pyThis creates the file:
planning_table.csv→ schedule organized by station.
python planning_transformer.pyThis creates:
planning_par_personne.csv→ schedule organized by person, with workload stats.
| station | S1_day1 | S1_night1 | ... |
|---|---|---|---|
| CD1 | A | ... | |
| CD2 | B | ... | |
| ... | ... | ... | ... |
| person | S1 - Monday - day | S1 - Monday - night | ... | nb_jours | nb_dimanche_jour | nb_nuits |
|---|---|---|---|---|---|---|
| A | CD1 | ... | 3 | 1 | 2 | |
| B | CD2 | ... | 4 | 0 | 1 |
- Add option for a free week
- Separate Sunday and night constraints
- Refactor into OOP (object-oriented design)
- GUI interface for easier usage
- Better error handling and file management