https://api.routific.com/v1/vrp

📘

Choosing which endpoint to use

For requests with more than 60 visits, it is necessary to use the asynchronous endpoint /vrp-long for long-running tasks to avoid timeouts. We recommend that you to use this endpoint even for smaller requests.

The /vrp endpoint can solve the Traveling Salesman Problem as well as the Vehicle Routing Problem. It supports the following:

  • Time-windows
  • Capacity constraints
  • Visit durations
  • Multiple depots
  • Open-ended routes
  • Type constraints
  • Driver shifts

There are two objects required in your input: Visits and Fleet. A third Options object is optional.

See the sidebar for a very simple example with the minimum required parameters.

{
  "visits": {
    "order_1": {
      "location": {
        "name": "6800 Cambie",
        "lat": 49.227107,
        "lng": -123.1163085
      }
    },
    "order_2": {
      "location": {
        "name": "3780 Arbutus",
        "lat": 49.2474624,
        "lng": -123.1532338
      }
    },
    "order_3": {
      "location": {
        "name": "800 Robson",
        "lat": 49.2819229,
        "lng": -123.1211844
      }
    }
  },
  "fleet": {
    "vehicle_1": {
      "start_location": {
        "id": "depot",
        "name": "800 Kingsway",
        "lat": 49.2553636,
        "lng": -123.0873365
      }
    }
  }
}
{
  "status": "success",
  "fitness": 1450,
  "total_travel_time": 24.166666,
  "total_idle_time": 0,
  "num_unserved": 0,
  "unserved": null,
  "solution": {
    "vehicle_1": [
      {
        "location_id": "depot",
        "location_name": "800 Kingsway"
      },
      {
        "location_id": "order_3",
        "location_name": "800 Robson"
      },
      {
        "location_id": "order_2",
        "location_name": "3780 Arbutus"
      },
      {
        "location_id": "order_1",
        "location_name": "6800 Cambie"
      }
    ]
  }
}