Fleet

How to use the Fleet Object

The fleet object is a hash of each vehicle and their properties, where the key is the vehicle ID Each vehicle is defined by their start_location and (optionally) an end_location.

JSON
"fleet": {
    "vehicle_1": {
      "start_location": {
        "id": "driver_start",
        "name": "Killarney, East Vancouver",
        "lat": 49.2287301,
        "lng": -123.0421047
      },
      "end_location": {
        "id": "driver_end",
        "name": "VanDusen Botanical Gardens",
        "lat": 49.2385564,
        "lng": -123.1309102
      },
      "shift_start": "17:00",
      "shift_end": "23:00",
      "capacity": 10,
      "strict_start": false
    }
  }

Fleet Object

start_location and end_location are objects that let you specify the (required) start location and (optional) end location of your drivers. These two parameters influence which deliveries are assigned to a driver because ideally, they'd be given jobs that are "on the way". For most delivery companies that operate from a fixed location with salaried employee drivers, the start and end locations will be the address of your warehouse. For companies that use drivers who operate as independent contractors, the start and end locations are usually the driver's home address. The only two required fields here are the GPS coordinates lat and lng which are needed to correctly position the driver's start and end locations. id and name are both optional, but it is helpful to provide values for them so that they can be easily identified when reading the json output.

Start Location / End Location Object

shift_start and shift_end let you set when the driver starts and ends his route. For example, setting shift_start to "08:00" and shift_end to "17:00" means that the driver will leave his start_location at exactly 08:00 and arrive at his end_location by 17:00. If no end_location is specified, it means that his last delivery will be completed before 17:00.

If your driver shifts go into the next day, you can use military time to indicate shift_start and shift_end time windows that extend past 24 hours e.g. use "30:00" (which is 24:00 + 06:00 hours) for 6 am the next day.

capacity on the fleet object is used together with load on the visits object to determine how many deliveries each driver can do without exceeding the capacity of his vehicle. For example, if his vehicle can safely carry 100 kg of packages and each package weighs 10 kg on average, the routing engine will use this information to ensure that the driver will never be assigned more than 10 deliveries. The capacity, like load, is unitless but is typically used to represent a volume (cubic meters) or weight (kg) constraint.

Loads and capacities can also be a vector i.e. you can ask the routing engine to consider multiple loads and capacities when coming up with a route solution. For example, suppose you run a rideshare service and want to be able to pick up both people and packages. You could set:

"load": { "people": 1 }

on the visits object and:

"capacity": { "people": 1, "packages": 10 }

on the fleet object. This ensures that the each vehicle will never carry more than 1 person or 10 packages at a time.

strict_start is a boolean (default value: false) that lets you specify (when set to true) if the vehicle should leave his start location exactly at shift_start or (when set to false) if the routing engine should calculate when he should leave to make it to his first stop on time. For example, if the time window for his first stop is [18:00 - 19:00], the stop is 15 minutes away and the driver's shift_start is 17:00, setting strict_start to true would force the driver to leave at 17:00, arrive at 17:15 and spend 45 minutes waiting at the first stop. Setting it to false minimizes the amount of idle time by allowing the driver to leave at 17:45.

Last updated