Quickstart
Pickup and Delivery Problem (PDP)
Most real-world routing situations can be covered with the /vrp-long
endpoint described earlier. There is one case that requires special attention: Same-day Pickup and Delivery. Each order has a pickup location and a drop-off location that are mutually dependent. An item can only be dropped off after it has been picked up by the same driver.
The /pdp-long
endpoint will find the optimal routes to do all your orders, so it may often occur that you pick up multiple orders before you drop them off. If you specify capacity constraints, it will ensure that your vehicles won't try to carry more than they can hold.
To get started, make a POST request with your data to the /pdp-long
endpoint:
Create PDP Request
POST
https://routing-engine.afi.io/pdp-long
The pdp-long
endpoint finds an optimal assignment of visits to vehicles where each visit has a pickup and dropoff location (with the binding constraint that pickups must be served before dropoffs).
Headers
access_toke
string
YOUR_ACCESS_TOKEN
Content-Type
string
application/json
Here's a sample JSON payload:
The /pdp-long
endpoint will trigger a long-running background task on our servers, while we give you a URL to ping to fetch the results. When you POST to the above URL, it will return immediately with a 202 HTTP code and a job_id
:
With this job_id
you can query the status of the route solution with a GET request to the following endpoint:
Retrieve route solution
GET
https://routing-engine.afi.io/jobs/4e8a0a79-cc8a-4238-9178-ec0fbc1427c1
When the job is finished, the status is set to finished and the solution to the request is now in output. You can view the input, output, running time and error messages (if any) on the dashboard at https://dashboard.afi.io/requests. The dashboard has a link to an interactive map based interface that you can use to explore your route solution in greater detail.
Last updated