Vehicles dispatch

The vehicle dispatch feature is useful in the following cases:

  • there is a fixed loading time at the beginning of the tour
  • vehicles does not start at the depot
  • a depot has certain capacity limitation on amount of vehicles loaded simultaneously

When the problem specifies more than one dispatch place, one of those is chosen as next from departure stop. Decision is made based on the following criteria:

  • how close dispatch's location to vehicle's start location
  • how much time vehicle has to wait till dispatch is open
  • how long is dispatch's duration

Example

The problem definition has one dispatch place with three different time slots with maximum capacity of one vehicle. As result, three vehicles are dispatched at different times.

Problem

{
  "plan": {
    "jobs": [
      {
        "id": "job1",
        "deliveries": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.52599,
                  "lng": 13.45413
                },
                "duration": 300.0
              }
            ],
            "demand": [
              1
            ]
          }
        ]
      },
      {
        "id": "job2",
        "deliveries": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.5225,
                  "lng": 13.4095
                },
                "duration": 240.0
              }
            ],
            "demand": [
              1
            ]
          }
        ]
      },
      {
        "id": "job3",
        "deliveries": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.5165,
                  "lng": 13.3808
                },
                "duration": 300.0
              }
            ],
            "demand": [
              1
            ]
          }
        ]
      }
    ]
  },
  "fleet": {
    "vehicles": [
      {
        "typeId": "vehicle",
        "vehicleIds": [
          "vehicle_1",
          "vehicle_2",
          "vehicle_3"
        ],
        "profile": "normal_car",
        "costs": {
          "fixed": 22.0,
          "distance": 0.0002,
          "time": 0.004806
        },
        "shifts": [
          {
            "start": {
              "earliest": "2019-07-04T09:00:00Z",
              "location": {
                "lat": 52.5352,
                "lng": 13.3909
              }
            },
            "dispatch": [
              {
                "location": {
                  "lat": 52.5316,
                  "lng": 13.3884
                },
                "limits": [
                  {
                    "max": 1,
                    "start": "2019-07-04T09:20:00Z",
                    "end": "2019-07-04T09:30:00Z"
                  },
                  {
                    "max": 1,
                    "start": "2019-07-04T09:30:00Z",
                    "end": "2019-07-04T09:40:00Z"
                  },
                  {
                    "max": 1,
                    "start": "2019-07-04T09:40:00Z",
                    "end": "2019-07-04T09:50:00Z"
                  }
                ]
              }
            ]
          }
        ],
        "capacity": [
          1
        ]
      }
    ],
    "profiles": [
      {
        "name": "normal_car",
        "type": "car"
      }
    ]
  }
}

Solution

{
  "statistic": {
    "cost": 85.033838,
    "distance": 9310,
    "duration": 3573,
    "times": {
      "driving": 933,
      "serving": 2640,
      "waiting": 0,
      "break": 0
    }
  },
  "tours": [
    {
      "vehicleId": "vehicle_2",
      "typeId": "vehicle",
      "shiftIndex": 0,
      "stops": [
        {
          "location": {
            "lat": 52.5352,
            "lng": 13.3909
          },
          "time": {
            "arrival": "2019-07-04T09:00:00Z",
            "departure": "2019-07-04T09:29:16Z"
          },
          "distance": 0,
          "load": [
            0
          ],
          "activities": [
            {
              "jobId": "departure",
              "type": "departure"
            }
          ]
        },
        {
          "location": {
            "lat": 52.5316,
            "lng": 13.3884
          },
          "time": {
            "arrival": "2019-07-04T09:30:00Z",
            "departure": "2019-07-04T09:40:00Z"
          },
          "distance": 435,
          "load": [
            1
          ],
          "activities": [
            {
              "jobId": "dispatch",
              "type": "dispatch"
            }
          ]
        },
        {
          "location": {
            "lat": 52.5225,
            "lng": 13.4095
          },
          "time": {
            "arrival": "2019-07-04T09:42:55Z",
            "departure": "2019-07-04T09:46:55Z"
          },
          "distance": 2187,
          "load": [
            0
          ],
          "activities": [
            {
              "jobId": "job2",
              "type": "delivery"
            }
          ]
        }
      ],
      "statistic": {
        "cost": 27.526954,
        "distance": 2187,
        "duration": 1059,
        "times": {
          "driving": 219,
          "serving": 840,
          "waiting": 0,
          "break": 0
        }
      }
    },
    {
      "vehicleId": "vehicle_1",
      "typeId": "vehicle",
      "shiftIndex": 0,
      "stops": [
        {
          "location": {
            "lat": 52.5352,
            "lng": 13.3909
          },
          "time": {
            "arrival": "2019-07-04T09:00:00Z",
            "departure": "2019-07-04T09:19:16Z"
          },
          "distance": 0,
          "load": [
            0
          ],
          "activities": [
            {
              "jobId": "departure",
              "type": "departure"
            }
          ]
        },
        {
          "location": {
            "lat": 52.5316,
            "lng": 13.3884
          },
          "time": {
            "arrival": "2019-07-04T09:20:00Z",
            "departure": "2019-07-04T09:30:00Z"
          },
          "distance": 435,
          "load": [
            1
          ],
          "activities": [
            {
              "jobId": "dispatch",
              "type": "dispatch"
            }
          ]
        },
        {
          "location": {
            "lat": 52.5165,
            "lng": 13.3808
          },
          "time": {
            "arrival": "2019-07-04T09:32:56Z",
            "departure": "2019-07-04T09:37:56Z"
          },
          "distance": 2193,
          "load": [
            0
          ],
          "activities": [
            {
              "jobId": "job3",
              "type": "delivery"
            }
          ]
        }
      ],
      "statistic": {
        "cost": 27.82132,
        "distance": 2193,
        "duration": 1120,
        "times": {
          "driving": 220,
          "serving": 900,
          "waiting": 0,
          "break": 0
        }
      }
    },
    {
      "vehicleId": "vehicle_3",
      "typeId": "vehicle",
      "shiftIndex": 0,
      "stops": [
        {
          "location": {
            "lat": 52.5352,
            "lng": 13.3909
          },
          "time": {
            "arrival": "2019-07-04T09:00:00Z",
            "departure": "2019-07-04T09:39:16Z"
          },
          "distance": 0,
          "load": [
            0
          ],
          "activities": [
            {
              "jobId": "departure",
              "type": "departure"
            }
          ]
        },
        {
          "location": {
            "lat": 52.5316,
            "lng": 13.3884
          },
          "time": {
            "arrival": "2019-07-04T09:40:00Z",
            "departure": "2019-07-04T09:50:00Z"
          },
          "distance": 435,
          "load": [
            1
          ],
          "activities": [
            {
              "jobId": "dispatch",
              "type": "dispatch"
            }
          ]
        },
        {
          "location": {
            "lat": 52.52599,
            "lng": 13.45413
          },
          "time": {
            "arrival": "2019-07-04T09:57:30Z",
            "departure": "2019-07-04T10:02:30Z"
          },
          "distance": 4930,
          "load": [
            0
          ],
          "activities": [
            {
              "jobId": "job1",
              "type": "delivery"
            }
          ]
        }
      ],
      "statistic": {
        "cost": 29.685564,
        "distance": 4930,
        "duration": 1394,
        "times": {
          "driving": 494,
          "serving": 900,
          "waiting": 0,
          "break": 0
        }
      }
    }
  ]
}