New feature: Preferred vehicles

We have a new feature. You can now solve vehicle routing problems and define preferred drivers for your stops or orders. This extends the “allowed_vehicles” feature. Whereas the latter is a hard constraint, “preferred_vehicles” is a soft constraint and allows you to specify preferences. However, if these collide with other constraints, it may still be possible to find a solution in which the corresponding orders can be assigned to vehicles.

Preferred vehicles are specified on the respective orders as follows (see our documentation):

{
      "id": "1db15a6b-66cd-49dd-b4ab-eeec65a66d5a",
      "type": "delivery",
      "address": {
        "location_id": "s1",
        "lat": 48.08641845016677,
        "lon": 11.516493414687789
      },
      "duration": 120,
      "preferred_vehicles": [
        {
          "vehicle_id": "v1",
          "priority": 1
        },
        {
          "vehicle_id": "v2",
          "priority": 2
        }
      ]
    }

This allows you to model a delivery order in Munich with a weighted driver preference. It would be best if vehicle v1 comes (hence the highest priority). If this conflicts with any other constraint, vehicle v2 would be the second best choice. If this is not possible, the algorithm decides which vehicle is assigned here.

For now, we have decided to allow priorities from 1 to 10, with 1 being the highest priority and 10 the lowest.

As mentioned above, this extends the concept of “allowed_vehicles” and relaxes the hard constraint. However, you can also use both to restrict the number of allowed vehicles and still define a weighted preference among the allowed vehicles. This would then typically look like this:

{
      "id": "1db15a6b-66cd-49dd-b4ab-eeec65a66d5a",
      "type": "delivery",
      "address": {
        "location_id": "s1",
        "lat": 48.08641845016677,
        "lon": 11.516493414687789
      },
      "duration": 120,
      "allowed_vehicles":["v1","v2","v3"],
      "preferred_vehicles": [
        {
          "vehicle_id": "v1",
          "priority": 1
        },
        {
          "vehicle_id": "v2",
          "priority": 2
        }
      ]
    }

Here, the job in Munich defined above may only be carried out by the vehicles “v1”, “v2” and “v3”, whereby “v1” is the first-best choice and “v2” the second-best choice. And if that is absolutely not possible, then just “v3”.

This feature now allows a variety of additional vehicle routing problems to be solved. For example, drivers can be assigned to certain districts in advance in order to leverage the experience of the drivers in this district or simply to get back more compact and beautiful routes.

3 Likes