shift-scheduling is a Python package for creating shift schedules using graph coloring.
- Get Python 3.8+
- Create virtual environment:
python -m venv .venv
- Activate virtual environment:
.\.venv\Scripts\activate
- Install dependencies:
pip install jsonschema networkx numpy fuzzy-graph-coloring
Use as CLI-Application: python .\shift_scheduling.py -v demo_cases/introduction.json
Output:
Graph has 18 nodes and 63 edges.
Alpha-cut using alpha=0
Graph coloring has score of 1.0
Shift distribution: [2, 2, 2, 2, 2, 2, 2, 2, 2]
Solution has an unfairness score of 0.0
Wrote staff timetable to 'schedule.csv'.
schedule.csv
:
Day,Date,Shift,Position,Staff
Mo,2022-02-07,1,1,6
Mo,2022-02-07,1,2,7
Mo,2022-02-07,1,3,8
Mo,2022-02-07,2,1,0
Mo,2022-02-07,2,2,1
Mo,2022-02-07,2,3,2
Tu,2022-02-08,1,1,3
Tu,2022-02-08,1,2,4
Tu,2022-02-08,1,3,5
...
Help and parameter information:
usage: shift_scheduling.py [-h] [-o [OUTPUT_FILE]] [-g] [-v] [-c] [input_file]
positional arguments:
input_file Shift scheduling input file. Defaults to "default_input.json"
optional arguments:
-h, --help show this help message and exit
-o [OUTPUT_FILE], --output-file [OUTPUT_FILE]
Shift scheduling output csv file. Defaults to "schedule.csv"
-g, --graph Whether the graph should be shown
-v, --verbose Prints additional graph and solution information
-c, --coloring Prints the complete coloring
This project is licensed under GNU General Public License v3.0 (GNU GPLv3). See LICENSE
in the code repository.
- Get poetry https://python-poetry.org/docs/
- Make sure, Python 3.8 is being used
poetry install
in your system shellpoetry run pre-commit install
poetry run pre-commit run --all-files
.\docs\make html