Skip to content

Instantly share code, notes, and snippets.

@chrismanderson
Created April 22, 2015 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismanderson/dcc202b5a7f282ca6f8c to your computer and use it in GitHub Desktop.
Save chrismanderson/dcc202b5a7f282ca6f8c to your computer and use it in GitHub Desktop.
routific

Input JSON:

{
   "fleet":{
      "MVVSYUagG6":{
         "shift-end":"9:00",
         "shift-start":"0:00",
         "start-location":"depot"
      },
      "LC0Ux5hmUR":{
         "shift-end":"9:00",
         "shift-start":"0:00",
         "start-location":"depot"
      }
   },
   "network":{
      "depot":{
         "name":"918 F St",
         "lat":38.897177,
         "lng":-77.024858
      },
      "MqTETAEP2g":{
         "name":"Chris Anderson (Dev)",
         "lat":38.9054116,
         "lng":-77.02469909999999
      },
      "pCSxzgYG14":{
         "name":"Chris Anderson (Dev)",
         "lat":38.9054116,
         "lng":-77.02469909999999
      }
   },
   "visits":{
      "MqTETAEP2g":{
         "duration":3,
         "start":"6:00",
         "end":"6:30"
      },
      "pCSxzgYG14":{
         "duration":3,
         "start":"8:00",
         "end":"8:30"
      }
   },
   "options":{
      "balance":true
   }
}

Output JSON:

{
  "status": "success",
  "total_travel_time": 3.1666667,
  "total_idle_time": 90,
  "num_unserved": 0,
  "unserved": null,
  "solution": {
    "MVVSYUagG6": [
      {
        "location_id": "depot",
        "location_name": "918 F St",
        "arrival_time": "06:23"
      },
      {
        "location_id": "MqTETAEP2g",
        "location_name": "Chris Anderson (Dev)",
        "arrival_time": "06:27",
        "finish_time": "06:30"
      },
      {
        "location_id": "pCSxzgYG14",
        "location_name": "Chris Anderson (Dev)",
        "arrival_time": "06:30",
        "idle_time": 90,
        "finish_time": "08:03"
      }
    ],
    "LC0Ux5hmUR": [
      {
        "location_id": "depot",
        "location_name": "918 F St",
        "arrival_time": "00:00"
      }
    ]
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment