{"id":20669480,"url":"https://github.com/iitis/railways_dispatching_silesia","last_synced_at":"2025-10-11T20:34:35.035Z","repository":{"id":194739450,"uuid":"338270833","full_name":"iitis/railways_dispatching_silesia","owner":"iitis","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-08T12:58:48.000Z","size":77713,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-17T13:32:20.349Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iitis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-12T09:14:01.000Z","updated_at":"2025-01-08T12:58:51.000Z","dependencies_parsed_at":"2023-10-10T15:27:28.077Z","dependency_job_id":"2435bed4-7578-4a31-bfc4-2d08c75e6127","html_url":"https://github.com/iitis/railways_dispatching_silesia","commit_stats":null,"previous_names":["iitis/railways_dispatching_silesia"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iitis%2Frailways_dispatching_silesia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iitis%2Frailways_dispatching_silesia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iitis%2Frailways_dispatching_silesia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iitis%2Frailways_dispatching_silesia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iitis","download_url":"https://codeload.github.com/iitis/railways_dispatching_silesia/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242884480,"owners_count":20201125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T20:14:29.764Z","updated_at":"2025-10-11T20:34:30.018Z","avatar_url":"https://github.com/iitis.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10657323.svg)](https://doi.org/10.5281/zenodo.10657323)\n\n\n\u003cdiv id=\"table-of-contents\"\u003e\n\u003ch2\u003eTable of Contents\u003c/h2\u003e\n\u003cdiv id=\"text-table-of-contents\"\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"#sec-1\"\u003e1. Files\u003c/a\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"#sec-1-1\"\u003e1.1. \u003ccode\u003edata\u003c/code\u003e subdirectory\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#sec-1-2\"\u003e1.2. \u003ccode\u003edata_formatting\u003c/code\u003e subdirectory\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#sec-1-3\"\u003e1.3. \u003ccode\u003erailway_solvers\u003c/code\u003e subdirectory\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#sec-1-4\"\u003e1.4. \u003ccode\u003equbos\u003c/code\u003e subdirectory\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#sec-1-4\"\u003e1.5. \u003ccode\u003esolutions\u003c/code\u003e subdirectory\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\u003ca href=\"#sec-2\"\u003e2. Main directory\u003c/a\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n\nPlease edit the org which is in [Emacs org markup](https://orgmode.org/guide/Markup.html). The md5 will be\ngenerated from that.\n\n# Files\u003ca id=\"sec-1\" name=\"sec-1\"\u003e\u003c/a\u003e\n\n## `data` subdirectory\u003ca id=\"sec-1-1\" name=\"sec-1-1\"\u003e\u003c/a\u003e\n\nThese are the raw input data.\n\n## `data_formatting` subdirectory\u003ca id=\"sec-1-2\" name=\"sec-1-2\"\u003e\u003c/a\u003e\n\nScripts to parse the input data and generate inputs in the required\nformat.\n\n\nA test can be run like that:\n\n    python3 -m pytest\n\nin this directory. The `data_formatting` subdirectory (same name as\nits parent) is the parser module.\n\n## `railway_solvers` subdirectory\u003ca id=\"sec-1-3\" name=\"sec-1-3\"\u003e\u003c/a\u003e\n\nThese are the actual solvers. A test can be run like that:\n\n    python3 -m pytest\n\nin this directory. The `railway_solvers` subdirectory (same name as\nits parent) is the solver module.\n\n\n## `qubos` subdirectory\u003ca id=\"sec-1-4\" name=\"sec-1-4\"\u003e\u003c/a\u003e\n\nThere are pickles files containing QUBOs for particuler use cases. \n\n## `solutions` subdirectory\u003ca id=\"sec-1-5\" name=\"sec-1-5\"\u003e\u003c/a\u003e\n\nThere are pickles files containing results of D-Wave solutions via:\n- simulations, \n- real annelaing,\n- hybrid solvers\n\n## Main directory\u003ca id=\"sec-2\" name=\"sec-2\"\u003e\u003c/a\u003e\n\nThere are following railway dispatching problems.\n\n#### real railway problem\n\nThe module ```solve_real_problem.py``` is used to solve real problem of railway dispatching on the core of Silesian railway network.\nThe script solves the problem via classical linear programming, D-Wave quantum approach, D-Wave hybrid or simulation approach.\n\nInput:\n\n```\n--case  particular case of railway dispatching problem (0 to 9 is supported, default 1)\n--category the category of time variables \"Integer\" yields ILP problem \"Continious\" yields MLP problem (default \"Integer\")\n--solve_lp  chose PuLp solver, e.g. 'PULP_CBC_CMD'  'GUROBI_CMD' 'CPLEX_CMD' \n--solve_quantum   chose quantum or quantum inspired solver, \"sim\" - D-Wave simulation, \"real\" - D-Wave QPU, \"bqm\" - D-Wave hybrid bqm solver, \"cqm\" - D-Wave hybrid cqm solver\n--min_t minimal time parameter for D-Wave hybrid solver in (rescalled) seconds (5 default)\n--runs number of experiments (runs in the quantum case)\n```\n\n\nOutput:\n\nSolutions of quantum D-Wave approach (i.e. quantum, hybrid or simulation via ```--solve_quantum```) are saved in ```solutions_quantum``` subdirectory as pickle files. Solutions of linear programming approach are printed.\n\n\nExample use:\n\n- classical programming\n\n```python solve_real_problem.py --case 0 --category Integer --solve_lp PULP_CBC_CMD ```\n\n- D-Wave quantum or hybrid approach\n\n```python solve_real_problem.py --case 0 --category Integer --solve_quantum cqm --min_t 5 --runs 5```\n\nDifficulty of dispatching problem grows with the case number. Case ```0```, no disturbances. In Cases ```1``` to ```3``` some trains are delayed, but they follow their original routes. Cases ```4``` to ```9``` concerns also a priory changes trains' routes e.g. due to some track failure.\n\nIn  ```solutions_quantum``` the script ```tmin_plot.py``` plots the sweep over ```t_min``` parameter.\n\nTo save / display result timetable use optional parameter ```--show_timetable 1``` , e.g.:\n\n```python solve_real_problem.py --case 0 --category Integer --solve_lp PULP_CBC_CMD  --show_timetable 1```.\n\nIn the case of quantum computiong it will read data from file, i.e.:\n\n```python solve_real_problem.py --case 0 --category Integer --solve_quantum cqm --min_t 5 --runs 5 --show_timetable 1 ```\n\n#### Generic problem\n\nThe generic example concerns dense passenger traffic (generic) on the KO-GLC part of the Silesian railway network. For each case there are ```12``` instances of various delays of trains at start.\n\nInput:\n\n```\n--case  particular case of railway dispatching problem (1 to 3 is supported)\n--category the category of time variables \"Integer\" yields ILP problem \"Continious\" yields MLP problem (default \"Integer\")\n--solve_lp  chose PuLp solver, e.g. 'PULP_CBC_CMD'  'GUROBI_CMD' 'CPLEX_CMD'\n--solve_quantum  chose quantum or quantum inspired solver, \"sim\" - D-Wave simulation, \"real\" - D-Wave QPU, \"bqm\" - D-Wave hybrid bqm solver, \"cqm\" - D-Wave hybrid cqm solver\n--min_t minimal time parameter for D-Wave hybrid solvers (hyb, cqm) in seconds (5 default)\n-- penalty - the penalty value for QUBO creation, applicable only for bqm (hyb, sim, real), by default 2.5\n```\n\nParticular description of cases:\n\n- case ```1```, there are no disruptions inside the analysed (double track) line, and we use cyclic timetable of ```3``` hours i.e. with ```59``` trains, particular instances concern delays of various trains at start;\n- case ```2```, we assume that one track between ```RCB``` and ```ZZ``` is closed, hence the line becomes partially single track and additional  we use cyclic timetable of ```2``` hours i.e. with ```40``` trains, particular instances concern delays of various trains at start;\n- case  ```3```, line is analysed as hypothetical single track line of ```3``` hours and ```21``` trains, particular instances concern delays of various trains at start.\n\nOutput:\n\nSolutions of quantum and classical approaches are saved in ```results_KO_GLC``` subdirectory as pickle files. \n\nIn ```results_KO_GLC``` there is the plotting script ```fast_plot.py```\n\nExample use:\n\n- clasical programming\n\n```python3 solve_KO_GLC_problems.py --solve_lp PULP_CBC_CMD   --case 1 --category Integer```\n\n- classical with computaitonal time limit (```time_limit``` in seconds):\n\n```python3 solve_KO_GLC_problems.py --case 2 --solve_lp \"CPLEX_CMD\" --time_limit 5```\n\n- D-Wave quantum or hybrid approach\n\n```python3 solve_KO_GLC_problems.py --solve_quantum cqm   --case 1 --category Integer --min_t 5```\n\nIn the case if not CQM solver is used, the paenalty for QUBO can be assigned:\n\n```python3 solve_KO_GLC_problems.py --solve_quantum cqm   --case 1 --category Integer --min_t 5, --penalty 2.5```\n\n\n\n#### Problem from \"Quantum Annealing in the NISQ Era: Railway Conflict Management\"\nK. Domino, M. Koniorczyk,K. Krawiec, K. Jałowiecki, S. Deffner, B. Gardas [Entropy 2023, 25, 191.](https://doi.org/10.3390/e25020191)\n\nThe module:\n```\nwisla_problems.py \n```\nis the test module for for case ```1``` problem from mentioned work.\n\nInput:\n```\n--solve_lp  chose PuLp solver, e.g. 'PULP_CBC_CMD'  'GUROBI_CMD' 'CPLEX_CMD'\n--solve_quantum   chose quantum or quantum inspired solver, \"sim\" - D-Wave simulation, \"real\" - D-Wave, \"bqm\" - D-Wave hybrid from QUBO, \"cqm\" - D-Wave hybrid cqm\n--min_t minimal time parameter for D-Wave hybrid solver in seconds (5 default)\n```\n\n\nOutput\n\nSolutions of quantum approach (i.e. by -solve_quantum) are saved in ```solutions_quantum/wisla``` subdirectory as pikle files. Solutions of linear programming apprach are  printed.\n\nExample use:\n\n- linear programming\n\n```python wisla_problems.py --solve_lp PULP_CBC_CMD```\n\n- D-Wave quantum approach\n\n```python wisla_problems.py --solve_quantum real```\n\n- D-Wave hybrid (cqm) approach\n\n```python wisla_problems.py --solve_quantum cqm --min_t 5```\n\n\nTo save / display result timetable use optional parameter ```--show_timetable 1``` , e.g.:\n\n```python wisla_problems.py --solve_lp PULP_CBC_CMD --show_timetable 1```.\n\nIn the case of quantum computiong it will read data from file, i.e.:\n\n```python wisla_problems.py --solve_quantum sim --show_timetable 1 ```\n\n\n### Citing this work\n\nThe code was partially supported by:\n- National Research, Development, and Innovation Office of Hungary under project numbers K133882\nand K124351, the Ministry of Innovation and Technology and the National\nResearch, Development and Innovation Office within the Quantum Information National Laboratory of Hungary;\n- Polish National Science Center under grant agreements number 2019/33/B/ST6/0201 and 2023/07/X/ST6/00396. \n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiitis%2Frailways_dispatching_silesia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiitis%2Frailways_dispatching_silesia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiitis%2Frailways_dispatching_silesia/lists"}