Restricting the use of certain vehicles

With the service, you can limit the number of vehicles of a specific type that are used in planning. For example, for your own fleet, you can set a restriction so that the number of vehicles doesn't exceed the number of available drivers. At the same time, the use of rented vehicles is unlimited.

To implement this scenario, in an API request:

  • For all vehicles that are ready to use, in the vehicles array, specify an additional numeric field vehicles.N.custom_value set to 1 (the default value is 0). If custom_value = 1, the vehicle with a courier is ready to work.

  • For the remaining vehicles, don't specify custom_value at all or specify custom_value = 0.

  • In the options object, set values for the following fields:

    • max_total_vehicles_custom_value: Maximum number of available couriers.

    • penalty.vehicles_custom_values_excess: Penalty for exceeding the value of max_total_vehicles_custom_value, where:

      • penalty.vehicles_custom_values_excess.fixed: Penalty for the violation itself.
      • penalty.vehicles_custom_values_excess.per_value: Penalty for each unit of violation.

The penalty for violating the restriction will appear in the result.metrics._tasks_summary.options.metrics.vehicles_custom_value_excess_penalty field of the API response.

Example 1

Couriers need to complete 100 orders. There are 4 vehicles in your company's fleet:

  • Vehicles 1 and 2 are rented.
  • Vehicles 3 and 4 are owned by the company.

No restrictions are set on the use of certain vehicles.

As a result, all orders are distributed evenly among couriers. No penalty is set for exceeding the options.max_total_vehicles_custom_value value.

API request (JSON)API responseView on map

Example 2

The conditions are the same as in example 1, but only one vehicle from the company's own fleet can be used. For this reason, the parameter vehicles.N.custom_value = 1 for vehicles 3 and 4. For rented vehicles, this parameter isn't set.

In addition to that:

  • The options.max_total_vehicles_custom_value parameter is set to 1. This means that orders can be delivered by all couriers driving rented vehicles and one courier driving a vehicle from your company's own fleet.

  • Penalties are assigned for the violation itself and for each unit exceeding the options.max_total_vehicles_custom_value value:

    • options.penalty.vehicles_custom_values_excess.fixed = 10,000,000.
    • options.penalty.vehicles_custom_values_excess.per_value = 100,000,000.

As a result, the planning algorithm distributes orders to couriers 1, 2, and 4, which leads to violations of time windows. Since only one vehicle from the company's own fleet is used, no penalty is charged for exceeding the options.max_total_vehicles_custom_value value.

API request (JSON)API responseView on map

Contact support