# Vehicle Level Constraints

Constraints that operate at the vehicle level allow one to control properties of the solution that apply to the individual vehicles. In cases where there is only one `shift` per `vehicle,` these are equivalent to constraints at the route level as there is exactly one route per vehicle. However, for multi-day, multi-vehicle problems, one may wish to control the properties of all the routes associated with a particular vehicle.

Very similar to the `route_balance` constraint, this constraint allows us to provide a min and max value for a `metric` summed across all the routes associated with the vehicles specified. If a list is provided for `vehicle_ids`, then the constraint is only applied to the specified vehicles. Otherwise, the constraint applies to all vehicles. When specifying the constraint, values for `metric_id`, `min_metric_value`, and `max_metric_value` must be given. The metrics are summed across all orders in the routes for the specified vehicle(s).

There are some cases where the duration of an order depends on who is servicing it. For example, a particular technician may complete a repair much faster than his/her colleagues. This variability can be expressed by using the work_speed parameter as a property of the shift. Since a vehicle can have multiple shifts, the work_speed parameter can be tied to the vehicle's operator instead of the vehicle itself.

In the example below, we illustrate a simple request where a manager explores the impact of "What if all my employees could work faster?" This can be achieved by trying different values of work_speed as shown below in the example vehicles array where a work_speed of 0.5 indicates that these workers are twice as fast as the default case.

Expand to view request sample

This experiment shows the manager that five more orders can be completed on this day if the workers are twice as fast since the 0.5 `work_speed` solution allows 22 order to be completed as opposed to 17 in the default case. The first image below shows the default `work_speed` 1 case. The second shows how additional orders are satisfied when workers are twice as fast.

A solution with `work_speed = 1.0`

A solution with `work_speed = 0.5`