This folder contains the Python computation backend for the HFS-SDST scheduling project. It implements optimization algorithms, core scheduling models, and output generation used by the UI module.
This README covers only the Python submodule in Python/.
It does not describe the full repository architecture or JavaFX frontend internals.
- Python 3.8+
- NumPy
- Matplotlib
- Pytest (for tests)
Python/
├── main.py
├── benchmark.py
├── algorithms/
│ ├── greedy.py
│ ├── tabu_search.py
│ └── branch_and_bound.py
├── core/
│ ├── schedule.py
│ ├── job.py
│ └── machine.py
├── utils/
│ └── gantt_chart.py
└── tests/
cd Python
pip install -r requirements.txtRun optimization for an input instance:
python main.py ../data/input.jsonRun with Gantt generation (if supported by current CLI options):
python main.py ../data/input.json --plotRun benchmark mode:
python main.py --testThe module expects a JSON instance with fields such as:
algorithm(greedy,tabu,bnb)num_stages,num_jobsmachines_per_stagelearning_coeff,learning_stagesprocessing_times([job][stage][machine])setup_times([from_job][to_job][stage][machine])
The solver writes output to ../results/result.json including:
- execution time,
- algorithm name,
- objective value (
C_max), - detailed schedule,
- optional path to generated Gantt chart.
- Greedy MSTF: fastest heuristic, good baseline.
- Tabu Search: metaheuristic with better quality/time tradeoff.
- Branch and Bound: exact approach, practical only for small instances.
- Up to about 10 jobs: consider Branch and Bound.
- Medium instances: Tabu Search is usually the best compromise.
- Large instances: Greedy for quick feasible solutions.
main.pyreads and validates JSON input.core/builds scheduling objects.algorithms/runs selected optimization.- Results are serialized to
../results/result.json. utils/gantt_chart.pycan generate chart output.
Run tests:
pytestFor a detailed testing guide (test structure, scripts, coverage, and troubleshooting), see TESTING.md.
Optional helpers available in this module:
run_tests.batrun_tests.shrun_tests_coverage.bat
- Missing dependencies: reinstall with
pip install -r requirements.txt. - Input file not found: verify path and current working directory.
- Empty or missing results: check console errors and write permissions for
../results/. - Very long runtime with
bnb: expected on larger instances; usetabuorgreedy.
- Keep algorithm logic in
algorithms/and shared models incore/. - Preserve JSON schema compatibility with UI and data modules.
- Add tests for any change in objective calculation or schedule serialization.
- Avoid committing temporary runtime files generated during experiments.