Vehicle Route Optimization in Python with OpenRouteService

In this tutorial, I cover vehicle route optimization using openrouteservice with the openrouteservice-py wrapper for Python. If you simply need to optimize a single route for a single vehicle with no service time restrictions, you can do this by using the directions API as described in my tutorial about getting directions with Python and ensuring you pass the optimize_waypoints=True parameter. The below notebook will guide you through doing some more complex optimization examples.


2 thoughts on “Vehicle Route Optimization in Python with OpenRouteService”

  1. Good morning,

    We are Master’s students at University Ca Foscari (Venice) and we enjoyed your videos! We wanted to ask you some clarifications about the API keys: we are working with a VRP optimization about a picking up service and we would like to insert the capacity of the trucks and how much each job collects in order to give it to the vehicle which will bring it to the warehouse. We tried to do it, but we did not succeed and we don’t know how to recall this variable in the vehicles and in the job variables. Could you help us in solving this problem please?

    Thank you so much.

    Best regards.

    1. Hi, thanks for reaching out! In this case you would probably want to use capacity on the vehicle and amount on the job. Set capacity on the vehicle to the number of parcels the truck can pickup, and the amount on the job to the number of parcels to be picked up at the job site. Of course you may want to create a subunit or something to handle different parcel sizes. In that case, set 1 to the size of the smallest parcel and use 2 for a parcels twice the size etc.

Comments are closed.