Skip to content

Vehicle start/end time

Info

This feature is configurable via .json input, without the need for code customization and is available for both the Marketplace app and Platform. You can find a list of all available features.

Info

The format for timestamps should be RFC3339, e.g.: "2023-01-01T00:00:00Z".

Field name Required Data type SI Unit Defined on Example Configurable via defaults
start_time No timestamp NA vehicle {"start_time": "2023-01-01T00:00:00Z"}
end_time No timestamp NA vehicle {"end_time": "2023-01-01T00:00:00Z"}

You can specify the time at which a vehicle starts its route, with the start_time. By default, there are no arrival or departure times given for vehicles at stops in the solution. When you specify the start_time for a vehicle, there is context for when the route starts, and thus, there are timestamps calculated as part of the output, such as the arrival_time for each stop.

In addition to the start time, you can also define the latest time at which a vehicle must end its route, with the end_time. Defining both the start_time and end_time defines a shift for the vehicle. Please note that the end_time includes any time spent traveling, waiting at stops, and servicing them.

Both the start_time and end_time are optional.

Info

When defining start_time and end_time there is a time duration defined by end_time - start_time. The route duration is limited by the most constrained duration between end_time - start_time and max_duration.

Defining the start_time on the vehicle makes it possible to calculate the arrival_time, start_time and end_time for the vehicle's planned stops in the output.

Here is an example input defining the start_time and end_time for some vehicles. Note how defining different attributes for each vehicle leads to distinct route information. A sample output obtained after solving the problem is also shown.

{
  "defaults": {
    "vehicles": {
      "speed": 5
    },
    "stops": {
      "duration": 600
    }
  },
  "stops": [
    {
      "id": "Fushimi Inari Taisha",
      "location": { "lon": 135.772695, "lat": 34.967146 }
    },
    {
      "id": "Kiyomizu-dera",
      "location": { "lon": 135.78506, "lat": 34.994857 }
    },
    {
      "id": "Nijō Castle",
      "location": { "lon": 135.748134, "lat": 35.014239 }
    },
    {
      "id": "Kyoto Imperial Palace",
      "location": { "lon": 135.762057, "lat": 35.025431 }
    },
    {
      "id": "Gionmachi",
      "location": { "lon": 135.775682, "lat": 35.002457 }
    },
    {
      "id": "Kinkaku-ji",
      "location": { "lon": 135.728898, "lat": 35.039705 }
    },
    {
      "id": "Arashiyama Bamboo Forest",
      "location": { "lon": 135.672009, "lat": 35.017209 }
    }
  ],
  "vehicles": [
    {
      "id": "v1"
    },
    {
      "id": "v2",
      "start_location": {
        "lon": 135.772695,
        "lat": 34.967146
      },
      "start_time": "2023-01-01T12:00:00Z"
    },
    {
      "id": "v3",
      "end_location": {
        "lon": 135.762057,
        "lat": 35.025431
      },
      "start_time": "2023-01-01T12:00:00Z",
      "end_time": "2023-01-01T12:20:00Z"
    },
    {
      "id": "v4",
      "start_location": {
        "lon": 135.775683,
        "lat": 35.002458
      },
      "end_location": {
        "lon": 135.775683,
        "lat": 35.002458
      },
      "start_time": "2023-01-01T12:00:00Z",
      "end_time": "2023-01-01T12:30:00Z"
    }
  ]
}
{
  "options": {
    "check": {
      "duration": 30000000000,
      "verbosity": "off"
    },
    "format": {
      "disable": {
        "progression": true
      }
    },
    "model": {
      "constraints": {
        "disable": {
          "attributes": false,
          "capacities": null,
          "capacity": false,
          "distance_limit": false,
          "groups": false,
          "maximum_duration": false,
          "maximum_stops": false,
          "maximum_wait_stop": false,
          "maximum_wait_vehicle": false,
          "mixing_items": false,
          "precedence": false,
          "start_time_windows": false,
          "vehicle_end_time": false,
          "vehicle_start_time": false
        },
        "enable": {
          "cluster": false
        }
      },
      "objectives": {
        "capacities": "",
        "cluster": 0,
        "distance": 0,
        "early_arrival_penalty": 1,
        "late_arrival_penalty": 1,
        "min_stops": 1,
        "stop_balance": 0,
        "travel_duration": 0,
        "unplanned_penalty": 1,
        "vehicle_activation_penalty": 1,
        "vehicles_duration": 1
      },
      "properties": {
        "disable": {
          "duration_groups": false,
          "durations": false,
          "initial_solution": false,
          "stop_duration_multipliers": false
        },
        "maximum_time_horizon": 15552000
      },
      "validate": {
        "disable": {
          "resources": false,
          "start_time": false
        },
        "enable": {
          "matrix": false,
          "matrix_asymmetry_tolerance": 20
        }
      }
    },
    "solve": {
      "duration": 10000000000,
      "iterations": 50,
      "parallel_runs": 1,
      "plateau": {
        "absolute_threshold": -1,
        "delay": 0,
        "duration": 0,
        "iterations": 0,
        "relative_threshold": 0
      },
      "run_deterministically": true,
      "solver": {
        "plan_group_size": {
          "delta": 0,
          "delta_after_iterations": 1000000000,
          "max_value": 2,
          "min_value": 2,
          "snap_back_after_improvement": true,
          "start_value": 2,
          "zigzag": true
        },
        "unplan_units": {
          "delta": 2,
          "delta_after_iterations": 125,
          "max_value": -1,
          "min_value": 2,
          "snap_back_after_improvement": true,
          "start_value": 2,
          "zigzag": true
        },
        "unplan_weights": "Vehicle:3,Island:1,Location:293"
      },
      "start_solutions": 1
    }
  },
  "solutions": [
    {
      "objective": {
        "name": "1 * vehicles_duration + 1 * unplanned_penalty",
        "objectives": [
          {
            "base": 6321.044562101364,
            "factor": 1,
            "name": "vehicles_duration",
            "value": 6321.044562101364
          },
          {
            "factor": 1,
            "name": "unplanned_penalty",
            "value": 0
          }
        ],
        "value": 6321.044562101364
      },
      "unplanned": [],
      "vehicles": [
        {
          "id": "v1",
          "route": [
            {
              "cumulative_travel_duration": 0,
              "duration": 600,
              "stop": {
                "id": "Arashiyama Bamboo Forest",
                "location": {
                  "lat": 35.017209,
                  "lon": 135.672009
                }
              },
              "travel_duration": 0
            }
          ],
          "route_duration": 600,
          "route_stops_duration": 600,
          "route_travel_duration": 0
        },
        {
          "id": "v2",
          "route": [
            {
              "arrival_time": "2023-01-01T12:00:00Z",
              "cumulative_travel_duration": 0,
              "end_time": "2023-01-01T12:00:00Z",
              "start_time": "2023-01-01T12:00:00Z",
              "stop": {
                "id": "v2-start",
                "location": {
                  "lat": 34.967146,
                  "lon": 135.772695
                }
              },
              "travel_duration": 0
            },
            {
              "arrival_time": "2023-01-01T12:00:00Z",
              "cumulative_travel_duration": 0,
              "duration": 600,
              "end_time": "2023-01-01T12:10:00Z",
              "start_time": "2023-01-01T12:00:00Z",
              "stop": {
                "id": "Fushimi Inari Taisha",
                "location": {
                  "lat": 34.967146,
                  "lon": 135.772695
                }
              },
              "travel_duration": 0
            },
            {
              "arrival_time": "2023-01-01T12:20:56Z",
              "cumulative_travel_distance": 3280,
              "cumulative_travel_duration": 656,
              "duration": 600,
              "end_time": "2023-01-01T12:30:56Z",
              "start_time": "2023-01-01T12:20:56Z",
              "stop": {
                "id": "Kiyomizu-dera",
                "location": {
                  "lat": 34.994857,
                  "lon": 135.78506
                }
              },
              "travel_distance": 3280,
              "travel_duration": 656
            },
            {
              "arrival_time": "2023-01-01T12:44:15Z",
              "cumulative_travel_distance": 7274,
              "cumulative_travel_duration": 1455,
              "duration": 600,
              "end_time": "2023-01-01T12:54:15Z",
              "start_time": "2023-01-01T12:44:15Z",
              "stop": {
                "id": "Nijō Castle",
                "location": {
                  "lat": 35.014239,
                  "lon": 135.748134
                }
              },
              "travel_distance": 3994,
              "travel_duration": 798
            },
            {
              "arrival_time": "2023-01-01T13:05:20Z",
              "cumulative_travel_distance": 10603,
              "cumulative_travel_duration": 2120,
              "duration": 600,
              "end_time": "2023-01-01T13:15:20Z",
              "start_time": "2023-01-01T13:05:20Z",
              "stop": {
                "id": "Kinkaku-ji",
                "location": {
                  "lat": 35.039705,
                  "lon": 135.728898
                }
              },
              "travel_distance": 3329,
              "travel_duration": 665
            }
          ],
          "route_duration": 4520,
          "route_stops_duration": 2400,
          "route_travel_distance": 10603,
          "route_travel_duration": 2120
        },
        {
          "id": "v3",
          "route": [
            {
              "arrival_time": "2023-01-01T12:00:00Z",
              "cumulative_travel_duration": 0,
              "duration": 600,
              "end_time": "2023-01-01T12:10:00Z",
              "start_time": "2023-01-01T12:00:00Z",
              "stop": {
                "id": "Kyoto Imperial Palace",
                "location": {
                  "lat": 35.025431,
                  "lon": 135.762057
                }
              },
              "travel_duration": 0
            },
            {
              "arrival_time": "2023-01-01T12:10:00Z",
              "cumulative_travel_duration": 0,
              "end_time": "2023-01-01T12:10:00Z",
              "start_time": "2023-01-01T12:10:00Z",
              "stop": {
                "id": "v3-end",
                "location": {
                  "lat": 35.025431,
                  "lon": 135.762057
                }
              },
              "travel_duration": 0
            }
          ],
          "route_duration": 600,
          "route_stops_duration": 600,
          "route_travel_duration": 0
        },
        {
          "id": "v4",
          "route": [
            {
              "arrival_time": "2023-01-01T12:00:00Z",
              "cumulative_travel_duration": 0,
              "end_time": "2023-01-01T12:00:00Z",
              "start_time": "2023-01-01T12:00:00Z",
              "stop": {
                "id": "v4-start",
                "location": {
                  "lat": 35.002458,
                  "lon": 135.775683
                }
              },
              "travel_duration": 0
            },
            {
              "arrival_time": "2023-01-01T12:00:00Z",
              "cumulative_travel_duration": 0,
              "duration": 600,
              "end_time": "2023-01-01T12:10:00Z",
              "start_time": "2023-01-01T12:00:00Z",
              "stop": {
                "id": "Gionmachi",
                "location": {
                  "lat": 35.002457,
                  "lon": 135.775682
                }
              },
              "travel_duration": 0
            },
            {
              "arrival_time": "2023-01-01T12:10:00Z",
              "cumulative_travel_duration": 0,
              "end_time": "2023-01-01T12:10:00Z",
              "start_time": "2023-01-01T12:10:00Z",
              "stop": {
                "id": "v4-end",
                "location": {
                  "lat": 35.002458,
                  "lon": 135.775683
                }
              },
              "travel_duration": 0
            }
          ],
          "route_duration": 600,
          "route_stops_duration": 600,
          "route_travel_duration": 0
        }
      ]
    }
  ],
  "statistics": {
    "result": {
      "custom": {
        "activated_vehicles": 4,
        "max_duration": 0.123,
        "max_stops_in_vehicle": 4,
        "max_travel_duration": 0.123,
        "min_duration": 0.123,
        "min_stops_in_vehicle": 1,
        "min_travel_duration": 0.123,
        "unplanned_stops": 0
      },
      "duration": 0.123,
      "value": 0.123
    },
    "run": {
      "duration": 0.123,
      "iterations": 50
    },
    "schema": "v1"
  },
  "version": {
    "sdk": "VERSION"
  }
}