{"id":20669492,"url":"https://github.com/iitis/railways_hobo","last_synced_at":"2025-04-19T18:12:30.845Z","repository":{"id":46170507,"uuid":"497859526","full_name":"iitis/railways_HOBO","owner":"iitis","description":"HOBO and quantum annealing approach to railway dispatching problem solved by","archived":false,"fork":false,"pushed_at":"2024-06-03T08:56:29.000Z","size":2686,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-24T17:52:45.982Z","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":"apache-2.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":"LICENSE","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":"2022-05-30T08:44:02.000Z","updated_at":"2024-06-03T08:56:26.000Z","dependencies_parsed_at":"2023-01-20T09:01:46.382Z","dependency_job_id":"5b4990a8-dede-48d6-b6c7-ea754369a680","html_url":"https://github.com/iitis/railways_HOBO","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iitis%2Frailways_HOBO","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iitis%2Frailways_HOBO/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iitis%2Frailways_HOBO/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iitis%2Frailways_HOBO/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iitis","download_url":"https://codeload.github.com/iitis/railways_HOBO/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249760124,"owners_count":21321843,"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:33.473Z","updated_at":"2025-04-19T18:12:30.829Z","avatar_url":"https://github.com/iitis.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![DOI](https://zenodo.org/badge/497859526.svg)](https://zenodo.org/badge/latestdoi/497859526)\n\n\n# QUBO and HOBO of Railway Rescheduling for Quantum Computing\n\nSource code utilized for Quadratic and Higher-Order Unconstrained Binary Optimization of Railway Rescheduling for Quantum Computing.\n\n## Dependency installation\n\nAnaconda distribution can be downloaded from [https://www.anaconda.com/products/individual](https://www.anaconda.com/products/individual). To install\n\n```\nconda env create -f rail-hobo.yml\n```\n\nTo activate this environment, use\n```\nconda activate rail-hobo\n```\nTo deactivate an active environment, use\n```\nconda deactivate\n```\n\n## Results reproduction\n\nTo reproduce the `Figure.[6]` and `Figure.[7]` in the article one need to run\n\n```\npython plot_DWave_results.py\n```\nthe figures are saved in the `plots` folder.\n\n## Generating new data\n\nGenerating data contains the following steps\n\n### Generating Q-matrix:\nTo generate the `Q-matrix` one needs to run\n\n```\npython proceed_DWave_results.py\n```\n\nthe matrix is saved on files for\n\n\n(1) `files/Qfile.npz` for **default setting** and,\n(2) `files/Qfile_r.npz` for **rerouted setting**,\n(3) `files/Qfile_enlarged.npz` for **4 trains, 2 stations** model and,\n(4) `files/Qfile_5_trains.npz` for **5 trains, 5 stations** model.\n\n### Getting a solution:\n\nTo solve the Quadratic Unconstrained Binary Optimization problem on D-Wave's Advantage `QPU` and `hybrid solver` or `simulated annealer` one needs to do the following\n\n```\npython Qfile_solve.npy 'annealer_type' 'num_reads' 'annealing_time' 'method'\n```\n\nFor more details on the solvers see: [https://www.dwavesys.com/media/m2xbmlhs/14-1048a-a_d-wave_hybrid_solver_service_plus_advantage_technology_update.pdf](https://www.dwavesys.com/media/m2xbmlhs/14-1048a-a_d-wave_hybrid_solver_service_plus_advantage_technology_update.pdf).\nThe `'method'` denotes the `model` we want to consider for solving. The available `models` are as follows\n\n```\n'default'  --\u003e For default setting,\n'rerouted' --\u003e For rerouted setting,\n'enlarged' --\u003e For 4 trains, 2 stations setting,\n'5trains'  --\u003e For 5 trains, 5 stations setting.\n```\n\nThe data produced in the paper using the following specifications\n\n\n```\npython Qfile_solve.npy 'simulated' 0 0 'default'\n```\nfor **simulated annealer** with **default** model and\n\n```\npython Qfile_solve.npy 'quantum' 3996 250 'enlarged'\n```\nfor **quantum annealer** with **4 trains, 2 stations** model and finally\n\n```\npython Qfile_solve.npy 'hybrid' 0 0 'rerouted'\n```\nfor **hybrid solver** with **rerouted** model.\n\n**NOTE:** For `'hybrid'` and `'simulated'` annealer the `annealing_time` and `num_reads` can be set arbitrarily.\n\n## Saved Data\n\nThe newly generated data containing solution to the problem using the `hybrid solver` is saved in\n\n```\nfiles/hybrid_data\n```\nwhereas the folder\n\n```\nfiles/dwave_data\n```\ncontains the outcome for `quantum annealer`.\n\n**NOTE:** For a particular `model` and for each annealing `run` two data files are saved in the following form\n\n```\nQfile_complete.. --\u003e Contains the whole D-Wave outcome, in the form of a dictionary,\nQfile_samples..  --\u003e Contains just the solutions and corresponding energies, in the form of a list.\n```\n\n## Plotting\n\nOne can simply run the following code the generate and save the plot (similar to `Figure.[6]` and `Figure.[7]` in the article)\n\n```\npython plot_DWave_results.py\n```\n\nwhich are saved in `files/plots` folder.\n\n\n## Timetable and output analysis\n\nTo get analysis of D-Wave output, and particular trains timetables run:\n\n```\nanalyse_DWave_results.py\n```\n\n## Citing this work\n\nK Domino, A Kundu, Ö Salehi, K Krawiec, Quadratic and Higher-Order Unconstrained Binary Optimization of Railway Rescheduling for Quantum Computing\nQuantum Information Processing, vol. 21, Article number: 337 (2022) https://link.springer.com/article/10.1007/s11128-022-03670-y\n\nThe research was supported by:\n- the Foundation for Polish Science (FNP) under grant number TEAM NET POIR.04.04.00-00-17C1/18-00\n- the National Science Centre (NCN), Poland, under project number 2019/33/B/ST6/02011\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiitis%2Frailways_hobo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiitis%2Frailways_hobo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiitis%2Frailways_hobo/lists"}