Time windows produce idle waiting time

Hello,

we have the following request:

  • 3 Shipments
  • each with a unique pickup but with the same delivery location
  • no time window for pickup
  • each with a delivery time window, but all have a latest delivery time of 07:30

These are the time windows of the 3 shipments:

  • Shipment 1
    • earliest: 07:10,
    • latest: 07:30
  • Shipment 2
    • earliest: 07:20,
    • latest: 07:30
  • Shipment 3
    • earliest: 07:30,
    • latest: 07:30

What we expect:

  • since all shipments have the same delivery location
  • and all shipments share that they can be delivered at 07:30
  • we expect that all are dropped off at 07:30 together

What we get instead

  • Shipment 1 is delivered at 07:10 at the location, then the car waits
  • Shipment 2 is delivered at 07:20, then the car waits again at the same location
  • Shiptment 3 is delivered at 07:30

Problem:

  • we waste 20 minutes waiting time at the location

Question:

  • How can we modify the request, so that we still have the time windows, but the delivery will be at the latest possible time (not the earliest)?

Here’s a graphic which pictures this:

Here’s the request:

Expand to see the request
{
  "vehicles": [
    {
      "vehicle_id": "vehicle_1",
      "type_id": "vehicle_type_1",
      "start_address": {
        "location_id": "address_7",
        "lon": 13.7521951,
        "lat": 51.0587109
      },
      "end_address": {
        "location_id": "address_4",
        "lon": 13.769245,
        "lat": 51.103568
      }
    }
  ],
  "vehicle_types": [
    {
      "type_id": "vehicle_type_1",
      "capacity": [
        8,
        2
      ],
      "speed_factor": 1
    }
  ],
  "shipments": [
    {
      "id": "person_1",
      "pickup": {
        "address": {
          "location_id": "address_9",
          "lon": 13.770369,
          "lat": 51.0723
        },
        "duration": 120,
        "time_windows": [
          {
            "earliest": 0,
            "latest": 86400
          }
        ]
      },
      "delivery": {
        "address": {
          "location_id": "address_10",
          "lon": 13.681809,
          "lat": 51.014689
        },
        "duration": 120,
        "time_windows": [
          {
            "earliest": 26400,
            "latest": 27000
          }
        ]
      },
      "size": [
        0,
        1
      ]
    },
    {
      "id": "person_2",
      "pickup": {
        "address": {
          "location_id": "address_8",
          "lon": 13.7514388,
          "lat": 51.0654076
        },
        "duration": 120,
        "time_windows": [
          {
            "earliest": 0,
            "latest": 86400
          }
        ]
      },
      "delivery": {
        "address": {
          "location_id": "address_10",
          "lon": 13.681809,
          "lat": 51.014689
        },
        "duration": 120,
        "time_windows": [
          {
            "earliest": 26400,
            "latest": 27000
          }
        ]
      },
      "size": [
        2,
        0
      ]
    },
    {
      "id": "person_5",
      "pickup": {
        "address": {
          "location_id": "address_14",
          "lon": 13.750831857323863,
          "lat": 51.08119035143939
        },
        "duration": 120,
        "time_windows": [
          {
            "earliest": 0,
            "latest": 86400
          }
        ]
      },
      "delivery": {
        "address": {
          "location_id": "address_10",
          "lon": 13.681809,
          "lat": 51.014689
        },
        "duration": 120,
        "time_windows": [
          {
            "earliest": 27000,
            "latest": 27000
          }
        ]
      },
      "size": [
        2,
        0
      ]
    }
  ],
  "objectives": [
    {
      "type": "min",
      "value": "completion_time"
    }
  ],
  "configuration": {
    "routing": {
      "calc_points": false
    }
  }
}

Did you try out to remove duration and replace with preparation_time? (note that this can be only specified once per location_id and should not be specified on all)

Cool, this works somehow.

Two questions:

  1. Why is that so, that the duration parameter produces this behaviour?
  2. the preparation_time parameter is only applied on the pickup activity, not on deliveries, right? How can we have a duration at deliveries also?

preparation_time is available for both, pickup and deliveries. But you must not specify different preparation times for the same location_id.

the duration parameter produces this behaviour?

The preparation_time is a time for exactly this purpose: the time it takes to prepare the location like searching a parking lot or similar. But the duration is bound to the service and of course delivering e.g. 3 “car cleaning” jobs should take 3 times longer than a single “car cleaning” job. See the docs.