{"id":20449583,"url":"https://github.com/skatsuta/vrp-solver","last_synced_at":"2025-07-31T09:08:18.779Z","repository":{"id":49584898,"uuid":"161045738","full_name":"skatsuta/vrp-solver","owner":"skatsuta","description":"Capacitated Vehicle Routing Problem with Time Windows (CVRPTW) solver written in Python.","archived":false,"fork":false,"pushed_at":"2022-12-09T04:50:43.000Z","size":9871,"stargazers_count":81,"open_issues_count":1,"forks_count":26,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-01-21T18:46:07.301Z","etag":null,"topics":["or-tools","python","vehicle-routing-problem"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skatsuta.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}},"created_at":"2018-12-09T14:05:54.000Z","updated_at":"2024-01-07T16:30:02.000Z","dependencies_parsed_at":"2023-01-25T16:16:40.457Z","dependency_job_id":null,"html_url":"https://github.com/skatsuta/vrp-solver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skatsuta%2Fvrp-solver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skatsuta%2Fvrp-solver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skatsuta%2Fvrp-solver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skatsuta%2Fvrp-solver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skatsuta","download_url":"https://codeload.github.com/skatsuta/vrp-solver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224768989,"owners_count":17366857,"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":["or-tools","python","vehicle-routing-problem"],"created_at":"2024-11-15T10:42:41.774Z","updated_at":"2024-11-15T10:42:42.315Z","avatar_url":"https://github.com/skatsuta.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Capacitated Vehicle Routing Problem with Time Windows (CVRPTW) solver\n\nCapacitated Vehicle Routing Problem with Time Windows (CVRPTW) solver written in Python.\n\nImplementation is based on\n[\"Vehicle Routing Problem with Time Windows\" section in Google OR-Tools documentation](https://developers.google.com/optimization/routing/cvrptw).\n\n\n## What's this?\n\nThis program solves Capacitated Vehicle Routing Problem with Time Windows (CVRPTW).\n\nFor example, given the following network and three vehicles at the depot (Node 0),\nconsider the problem of what route each vehicle should take to pick up all the demands\nof all the nodes in the shortest possible time.\n\n![network](docs/network.svg)\n\nIn this case, this program would give the following solution, for example:\n\n![route](docs/route.svg)\n\n\n## Prerequisites\n\nPython 3.9 or later is required.\n\n\n## Usage\n\nFirst, install the dependencies:\n\n```shell\n# Install Graphviz on macOS (On other platforms, use their own package managers)\n$ brew install graphviz\n\n# Create a Python virtual environment\n$ python -m venv .venv\n# Activate the virtualenv\n$ source .venv/bin/activate\n# Install the dependencies\n$ pip install -r requirements.txt\n```\n\nAlternatively, if you have Poetry installed, run the following commands instead of the\nsecond to fourth line above:\n\n```shell\n$ poetry install\n$ poetry shell\n```\n\nThen, let's solve an example!\n\n```shell\n$ python solver.py data.example.yaml\n```\n\nIt should output the following solution:\n\n```\nRoute for vehicle 0:\n     [Node  0: Load( 0) Time( 0,   0)]\n  -\u003e [Node  9: Load( 0) Time( 2,   5)]\n  -\u003e [Node  8: Load( 1) Time(10,  13)]\n  -\u003e [Node  5: Load( 2) Time(17,  20)]\n  -\u003e [Node  4: Load( 4) Time(35,  55)]\n  -\u003e [Node  3: Load( 7) Time(60,  67)]\n  -\u003e [Node  1: Load( 9) Time(68,  75)]\n  -\u003e [Node  0: Load(10) Time(79, 100)]\nLoad of the route: 10\nTime of the route: 79 min\n\nRoute for vehicle 1:\n     [Node  0: Load( 0) Time( 0,   8)]\n  -\u003e [Node  7: Load( 0) Time( 2,  10)]\n  -\u003e [Node 13: Load( 3) Time(15,  18)]\n  -\u003e [Node 12: Load( 6) Time(22,  25)]\n  -\u003e [Node 15: Load( 8) Time(45,  65)]\n  -\u003e [Node 11: Load( 9) Time(85,  89)]\n  -\u003e [Node  0: Load(10) Time(96, 100)]\nLoad of the route: 10\nTime of the route: 96 min\n\nRoute for vehicle 2:\n     [Node  0: Load( 0) Time( 0,  25)]\n  -\u003e [Node 14: Load( 0) Time(10,  30)]\n  -\u003e [Node 16: Load( 3) Time(30,  50)]\n  -\u003e [Node  6: Load( 4) Time(55,  72)]\n  -\u003e [Node  2: Load( 7) Time(75,  80)]\n  -\u003e [Node 10: Load( 8) Time(84,  89)]\n  -\u003e [Node  0: Load(10) Time(95, 100)]\nLoad of the route: 10\nTime of the route: 95 min\n\nTotal time of all routes: 270 min\n```\n\nIn addition, if you want to export images of the network and routes, you can specify\nfilenames for them using `-n/--export-network-graph` and `-r/--export-route-graph`\noptions:\n\n```shell\n$ python solver.py data.example.yaml \\\n    --export-network-graph network.png \\\n    --export-route-graph route.png\n```\n\nThen the program saves the network image to `network.png` and the route image to\n`route.png` for vizualizing the network and vehicle routes.\n\nFile format is automatically determined by the file extension;\nsee https://graphviz.org/docs/outputs/ for the supported file formats.\nFor example, if you pass `--export-network-graph network.svg`,\nthe file will be the SVG format.\n\n`data.example.yaml` is just example data created for a dummy problem,\nso if you have your own problem to solve, copy this file, create your own `data.yaml`\nand pass it to the program! 💪\n\n```shell\n$ python solver.py data.yaml\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskatsuta%2Fvrp-solver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskatsuta%2Fvrp-solver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskatsuta%2Fvrp-solver/lists"}