Milán Balázs
Nicolai Herrmann
[redacted]
Antoine Sébert
Get the interpreter on the official website.
We will be working with the version 3.7.x.
You can check the interpreter's version with:
$ python --version
We will use pip as package installer.
You can install it by following this guide.
Then, check if the package installer has been installed for Python 3.7 with:
$ pip --version
The packages index can be accessed here.
To manage the deps, we will use poetry.
You can install it by following this guide.
Then, check if the package installer has been installed with:
$ poetry --version
Clone the branch with:
$ git clone --single-branch --branch constraint-programming https://gitlab.com/Zeltex/02229---systems-optimization
Go to the repository that has just been cloned and install the dependencies by running the following:
$ poetry install
You can update the dependencies by running the following:
$ poetry update
Change your working directory to the project's directory and run it with:
$ poetry run python src/main.py
You can show the CLI usage with:
$ poetry run python src/main.py --help
usage: SOLVER [-h] [-f FORMAT] [--verbose] [--version]
(--case FOLDER | --collection FOLDER)
Solve task scheduling problems using graph coloration.
optional arguments:
-h, --help show this help message and exit
-f FORMAT, --format FORMAT
Either one of xml, json, raw, svg
--verbose Toggle program verbosity.
--version show program's version number and exit
--case FOLDER Import problem description from FOLDER (only the first
*.tsk and *.cfg files found are taken, all potential
others are ignored).
--collection FOLDER Recursively import problem descriptions from FOLDER
and/or subfolders (only the first *.tsk and *.cfg
files found of each folder are taken, all potential
others are ignored).
Solve the test case [data/Case 1](data/Case 1) with:
$ poetry run python src/main.py --case "data/Case 1"
Solve all the test cases data/100pct with:
$ poetry run python src/main.py --collection "data/100pct"
Redirects the console output including the solution to a file:
$ poetry run python src/main.py --case "data/Case 1" 2> file.txt
Note: If the file does not exist, it will be created.
Run the tests with:
$ poetry run python -m unittest
Note: this feature is not supported yet. See the roadmap section.
Perform a style check on the whole source with:
$ poetry run flake8
graph LR
Start(Start) -->|XML| Builder
Builder -->|IR| Solver
Solver -->|Solution| Formatter
Formatter -->|Fmt Solution| End(End)
--root/
+--build/ // future support for Cython builds
+--data/ // test cases
| +--100pct/ // complex test case
| +--200pct/ // complex test case
| +--300pct/ // complex test case
| +--400pct/ // complex test case
| +--500pct/ // complex test case
| +--Case 1/ // simple test case
| +--Case 2/ // simple test case
| +--Case 3/ // simple test case
| +--Case 4/ // simple test case
| +--Case 5/ // simple test case
| +--Case 6/ // simple test case
| +--readme.txt // test case data model definition
+--src/ // sources
| +--builder.py // problem builder
| +--datatypes.py // structured data
| +--draw.py // problem & solution painter
| +--format.py // solution formatter
| +--log.py // logging handler
| +--main.py // entry point
| +--rate_monotonic.py // rate monotonic -related utilities
| +--solver.py // problem solver / solution generator
| +--timed.py // timed function wrapper
+--tests/ // tests
| +--main.py // tests for src/main.py
+--.flake8 // project-specific styles
+--.gitattributes // project attributes
+--.gitignore // unstaged files and folders
+--.gitlab-ci.yml // Gitlab pipeline configuration
+--pyproject.toml // poetry configuration
+--README.md // this file
+--setup.py // python package definition
- catch all exceptions : https://docs.python.org/3/library/contextlib.html
- preemption
- benchmark : https://github.com/python/pyperformance
- optimize : https://docs.python.org/3/library/collections.html, https://docs.python.org/3/library/stdtypes.html, https://stackoverflow.com/questions/45123238/python-class-vs-tuple-huge-memory-overhead/45123561
- setup.py : https://setuptools.readthedocs.io/en/latest/pkg_resources.html, https://setuptools.readthedocs.io/en/latest/setuptools.html
- cython : http://docs.cython.org/en/latest/src/quickstart/build.html, http://docs.cython.org/en/latest/
- write tests : https://docs.python.org/3/library/unittest.html
- random problem generator
- add references support to avoid data copy
- workload update (static attrs in core and cpu, invalidated on modification)
- generate visual representation (SVG formatter)
- replace named tuples by mutable equivalent : https://bitbucket.org/intellimath/recordclass/src/default/
- OR-tools : get feasible solution + support Period, Deadline, Offset, MaxJitter
- linux cluster for benchmarks