Skip to main content

Vehicle working hours

Defining the start time and end time for a vehicle is crucial for accurately modeling real-world logistics operations. These parameters define the working shift of a driver or the availability window of a vehicle.

Importance for Planning

Setting precise working hours is essential for several reasons:

  • Resource Scheduling: Ensures efficient utilization of the fleet by planning routes that fit within the drivers' shifts.
  • Regulatory Compliance: Helps adhere to labor laws regarding maximum working hours and mandatory breaks.
  • Operational Reality: Reflects the actual availability of vehicles (e.g., a vehicle might be shared between shifts or require maintenance).

Configuration

Logistics API (Stateful)

In the Integration API, vehicles are typically managed via the Bulk Upload endpoint or individually.

To define working hours, configure the following fields in your vehicle object:

FieldTypeDescription
start_timestring ($date-time)Optional. The timestamp indicating when the vehicle's shift begins. The vehicle cannot perform any tasks before this time.
end_timestring ($date-time)Optional. The timestamp indicating when the vehicle's shift ends. The vehicle must complete all tasks and (if applicable) return to the depot by this time.
tip

These timestamps must be within the bounds of the simulation's start_time and end_time.

Vehicle object example
{
"agent_id": "vehicle-1",
"start_time": "2024-07-10T08:00:00+00:00",
"end_time": "2024-07-10T12:00:00+00:00",
...
}

Optimization API

In the Optimization API, the vehicle model.

The fields are functionally identical but are part of the payload sent to the /optimize endpoint:

FieldTypeDescription
start_timestringOptional. Timestamp of the vehicle operations start time. If not provided, it may default based on the model's behavior, but explicit definition is recommended for time-constrained problems.
end_timestringOptional. Timestamp of the vehicle operations end time. Defines the hard cutoff for the vehicle's route.
Optimization payload
{
"vehicles": [
{
"agent_id": "vehicle-1",
"start_time": "2024-07-10T08:00:00+00:00",
"end_time": "2024-07-10T12:00:00+00:00",
...
}
],
...
}

Relation to Order Time Windows and Travel Durations

The vehicle's working hours act as a hard constraint on the route.

  • Order Time Windows: Even if a customer's order is open for delivery (e.g., 8:00 AM to 6:00 PM), a vehicle can only serve it if the service can be performed within the vehicle's specific working hours (e.g., 8:00 AM to 12:00 PM). Orders with time windows exclusively outside the vehicle's shift cannot be assigned to that vehicle.
  • Travel Durations: The total time required for the route—including travel time from the depot, travel between stops, service times, and the return trip to the depot—must fit strictly between the start_time and end_time. If the travel time required to reach a distant location would push the vehicle past its end_time, that location cannot be visited.

Playground

You can explore the impact of vehicle working hours using the playground below.

In this example:

  • The Vehicle has a shift from 08:00 to 12:00.
  • Order 1 has a time window of 09:00 - 10:00 (Inside working hours).
  • Order 2 has a time window of 13:00 - 14:00 (Outside working hours).

Notice that Order 2 cannot be scheduled because its time window falls completely outside the vehicle's working hours. Try extending the vehicle's end_time to 15:00 (3:00 PM) to see if Order 2 becomes schedulable!

Loading...