Possible logistic scenarios

For all logistic scenarios, be sure to specify depots, orders, and couriers. The data set is dependent on the couriers and orders in it. If they can be divided into independent parts (so that a group of orders is only carried out by certain vehicles and there's no mixing), we recommend making multiple separate planning runs, each with its own set of orders and couriers. For example, do this if:

  • There are several depots, each depot ships its own set of orders, and each depot has its own set of vehicles.

  • Cargo is delivered from the depot and taken to the depot by different vehicles (and these are different independent orders).

  • A depot has several geographical zones, each of which is served by its own set of vehicles.

The logistic scenarios described below can be combined. If the above examples don't describe your business task, contact your RouteQ manager or support at routing-support@yandex-team.ru.

Delivery from one depot

This is the default scenario when you need to plan the delivery of goods to your clients or build a route that visits a specified set of points. It's used if there's only one depot in the request, and orders have the delivery type specified in the location field, or this field isn't set (see Order type). The algorithm will build a route for delivery of all orders from the specified depot.

Diagram

Example

There are 30 orders in this solution. All of them are delivered from a single depot. The order type isn't explicitly specified, so its default value is delivery .

API request (JSON)API responseView on map

Cargo collection to the depot

This is the default scenario when cargo is collected from your clients to be delivered to the depot. For examples, this cargo may include:

  • Medical tests that are taken at home.

  • Clothes for dry cleaning.

  • Goods that your clients return to the depot.

In the last case, this scenario is often combined with delivery from a single depot.

To specify pickup points, set the order type = pickup (see Order type). After that, different options are possible:

  1. All couriers should return to the depot at the end of the day (see Returning to a depot at the end of the working day), meaning that return_to_depot = true. In this case, you don't need to configure anything else, and the courier completes the route at the depot by default.

  2. The cargo must stay in the courier's vehicle and be returned to the depot the next morning when the courier arrives for their next shift. To do this, set return_to_depot = false. The route will end at the last pickup point. You don't need to configure anything else in this case, either.

  3. Not all couriers return to the depot at the end of the day. The algorithm chooses which ones must return. For couriers, the return_to_depot = false option is used, and for pickup orders, you specify whether it's mandatory to return to the depot in the current route pickup_must_reach_depot = true or set up delivery_deadline, which is the time of order delivery to the depot.

    If the order is linked to a depot (one or more depots are given in the depot_id field), the pickup order will be delivered to one of these depots in the current route, regardless of the pickup_must_reach_depot value.

Schemes

  • Cargo delivery to the depot.

  • Delivery of cargo to one of several depots.

Example 1

Cargo is picked up and taken to the depot. All vehicles must return to the depot at the end of the day (return_to_depot = true). There are 30 orders, 1 depot, and 5 cargo pickup points.

API request (JSON)API responseView on map

Example 2

The same as example 1. One of the vehicles has return_to_depot set to false. This means that the cargo will remain in the courier's vehicle and return to the depot the next morning.

API request (JSON)API responseView on map

Example 3

The same as example 1, but different pickup points are selected. For all vehicles, return_to_depot = false, and delivery_deadline is specified for the cargo pickup points. At the end of the day, only the vehicle that has all the pickup orders will return to the depot.

API request (JSON)API responseView on map

Start or end of the route at an arbitrary point

What situations to use this in

By default, the courier route starts and ends at the depot. However, in some cases, you may need to plan a route from the vehicle's parking spot or from the courier's home. Or the other way around: you may need to complete the route closer to these points.

How to implement this scenario

Start points are defined using the start_at and visit_depot_at_start parameters. End points are defined using the finish_at and return_to_depot parameters.

Tip

Not all combinations of these parameters in the solution use a depot (for example, if all couriers start from home and immediately go to order locations), but it is still required in the data scheme. In this case, you can specify the coordinates of the office or city center as a depot.

The parameters of the start and end points are independent of each other, so you can configure any combination here:

  • Set start and end points separately for each courier.

  • Specify the same point for multiple couriers.

  • Specify the same start and end points.

The garage order type is used to specify the start or end point. If vehicle.visit_depot_at_start = false, and vehicle.start_at isn't specified, the algorithm assumes that the courier can start the route from the first order without visiting the depot.

Alert

You can use the combination of start_at not specified and visit_depot_at_start = false if there are pickup or pickup & delivery orders in the route. Orders delivered from the depot aren't planned first and appear in the route only after the courier visits the depot.

If vehicle.visit_depot_at_start = false, but the courier still needs to start the route with visiting the depot (for example, to pick up delivery orders), set vehicle.can_visit_depot_at_start to true. In this case, the courier can visit the depot.

If start_at is also defined, and orders are:

Assigned to the depot (parameter location.depot_id specified), the courier will start the route from a garage location, then pick up the orders from the depot, and then continue the route.

Not assigned to the depot (the parameter location.depot_id is not set), the courier won't visit the depot and will start working directly from a garage location.

Schemes for start points

  • Starting a route from the order point without going to the depot (start_at isn't defined, visit_depot_at_start = false). The algorithm chooses the start point of the order for the courier.

  • Starting a route from the depot (start_at isn't defined, visit_depot_at_start = true). The algorithm's default behavior.

  • Starting a route from a specific point without going to the depot (start_at is defined, visit_depot_at_start = false). Start points may be different for different couriers.

  • Starting a route from a specific point with a visit to the depot (start_at is defined, visit_depot_at_start = true). Start points may be different for different couriers.

  • Starting a route with visit_depot_at_start = false and can_visit_depot_at_start = true (start_at is defined, the first order is assigned to the depot using location.depot_id).

Schemes for end points

  • Ending a route at the last point without returning to the depot (finish_at isn't defined, return_to_depot = false).

  • Returning to the depot at the end of the route (finish_at isn't defined, return_to_depot = true).

  • Ending a route at a specific point without returning to the depot (finish_at is defined, return_to_depot = false). End points may be different for different couriers.

  • Ending the route at a specific point with a visit to the depot before the end point (finish_at is defined, return_to_depot = true). End points may be different for different couriers.

Pickup & delivery: collecting and delivering cargo at arbitrary points

What situations to use this in

This scenario is used for planning door-to-door cargo delivery without involving intermediate depots or reloading points. For example:

  • Goods must be picked up from the supplier's depot and taken to the client (multiple pickup scenarios are supported for when you need to collect the goods from different suppliers at several depots and deliver them to the same client).

  • Goods are returned (you need to pick them up from the client and take them to the depot for returns, not to the main depot).

You can also use this scenario in cases where there are simple dependencies between points. For example, before you get to the client, you need to pick up tools, documents, or keys.

You can use this scenario together with the scenarios for collecting cargo at the depot and delivery from a single point.

How to implement this scenario

The pickup & delivery scenario uses a linked pair of points: pickup and delivery, and the pickup point is always visited first. The points are linked using the delivery_to field: you fill it in for the pickup point, specifying the ID of the associated delivery .

In a multiple pickup scenario for several different pickup points, you can specify the same value in the delivery_to field. A group of multiple pickup orders and one delivery order will always be assigned to a single courier.

If you need to deliver orders from one pickup point to multiple delivery points, specify different pickup & delivery pairs (where pickup orders have the same coordinates but different IDs). Such pickup & delivery pairs may be assigned to different couriers (despite the fact that the pickup point is the same). To assign them to the same courier, we recommend using grouping locations.

Alert

You don't have to specify the weight, volume, and number of places for delivery points, but they must be specified for the associated pickup order.

If you specify the volume and weight characteristics for a delivery point, they must be the same for the associated pickup order. That is, in case of more than one pickup, it's enough to specify the weight, volume, and number of places only for the pickup orders.

To manage the sequence of performing pickup & delivery pairs, we recommend using the location.in_lifo_order feature (for more information, see Order of reception and delivery).

Schemes

  • pickup & delivery.

  • Multiple pickup for one delivery point.

Example 1

We plan 12 different locations. Half the points are pickup , and the other half are delivery . In total, we get 6 door-to-door deliveries.

API request (JSON)API responseView on map

Example 2

We set 8 different addresses for pickup points and specify the same values for them in the delivery_to field. As a result, we get a plan in which a courier must pick up orders from different places and bring them all to one place.

API request (JSON)API responseView on map

Example 3

Delivery is planned from 1 address to 6 different addresses. We set the pickup type for 16 points with the same address and the delivery type for the other 16 points.

API request (JSON)API responseView on map

Delivery from one of several depots

What situations to use this in

This scenario is used when multiple depots have a ufficient quantity of the same goods, and you need to choose which depot to deliver them from when planning.

How to implement this scenario

Alert

When using this scenario, list all couriers that start from each depot.

When planning, specify multiple depots and which depot each courier is assigned to (which depots they can start from and visit). For more information, see Delivery from one of several depots and Start from one of several depots.

For this scenario, you can also use the function for starting at an arbitrary point without visiting the depot (learn more in Start or end of the route at an arbitrary point when start_at is defined and visit_depot_at_start = false). If you specify the depot as the starting point where shipping must begin for each courier, the planning result will be the same as when planning from several depots.

Note

If you know which depot a particular order should be shipped from, use the location.depot_id parameter. Specify the depot id or an array of depot id in the parameter value.

This scenario can be implemented without the service functions, that is, if you create rigid links between an order and a depot. There are several ways to do this:

  • Nearest depot

    Calculate the distance between the coordinates of the order address and all depots (use the Distance matrix service for making the calculation). The nearest depot is selected for the order.

  • Delivery zone

    Each depot has a pre-defined delivery zone (drawn using Yandex Map Constructor). Each order is pre-checked to see which depot's delivery zone it falls into. Each depot is planned separately and independently following the Delivery from a single depot scenario.

Diagram

Example 1

In this example, the depot_id parameter is used to specify which depot each courier is linked to. This way, couriers deliver orders from their depots only.

API request (JSON)API responseView on map

Example 2

In this example, couriers don't start their route from the depot. They start from one of two garage points. The start point of the route is defined using start_at.

API request (JSON)API responseView on map

Example 3

Three depots, three orders, and three vehicles are given. Each vehicle starts from its own depot. Orders are assigned to depots using location.depot_id:

  • Order 1 is not assigned to a depot. It can be delivered from any depot.

  • Order 2 is assigned to depots 1 and 2. This order can be delivered from one of the two specified depots.

  • Order 3 is assigned to depot 3. It is located in a specific depot.

As a result, the algorithm built two routes:

  1. One courier handles orders 1 and 2 from depot 2.
  2. Another courier handles order 3 from depot 3.

API request (JSON)API responseView on map

Routes with multiple depots

Visiting an additional depot

What situations to use this in

A frequent planning scenario is visiting an additional depot to pick up more orders:

  1. Couriers start from main depot 1.

  2. Part of the couriers immediately go to deliver orders.

  3. Some couriers visit depot 2 to pick up other parts of clients' orders.

  4. The couriers who go to depot 2 can deliver some orders on their way.

How to implement this scenario

Use the following required fields:

  • vehicle.allow_different_depots_in_route: The ability to visit multiple depots in one route:

    • If true, the courier can visit multiple depots on the same route.
    • If false (default value), the courier can only visit the depot where they started the route.
  • vehicle.max_middle_depots: The maximum number of intermediate depots on the route. The default value is 0.

  • If it doesn't matter which depot the routes start from or where they end at, list all depots in the vehicle.depot_id field.

    If there needs to be a specific order of visiting depots, fill in the following fields:

    • vehicle.starting_depot_id: Depots that the courier can start from.

    • vehicle.middle_depot_id: Depots to pick up more orders from (intermediate depots).

    • vehicle.ending_depot_id: Depots where the courier can end the route.

    Depot lists can overlap.

    If the courier completes the route not at a depot (return_to_depot = false), but the vehicle.starting_depot_id and vehicle.middle_depot_id fields are in use, specify any depot in the vehicle.ending_depot_id field — no visit will be planned there.

You can also use the following optional fields:

  • vehicle.depots_only_at_run_beginning: The courier can make stops at intermediate depots to pick up more orders only at the beginning of the run. The default is false.

  • vehicle.finish_route_in_starting_depot or vehicle.finish_run_in_starting_depot: The courier should end the route or run at the same depot where they started. The default is false. These parameters are only useful if allow_different_depots_in_route = true. For more information, see Returning to a depot at the end of the route or run.

The fields picked_orders and delivered_orders in the API response show which depot the order was picked up at and where it was delivered to.

Schemes

  • The courier can stop at an intermediate depot in the middle of the run.

  • The courier can visit an intermediate depot only at the beginning of the run (vehicles.depots_only_at_run_beginning = true).

Example 1

The courier has to deliver 4 orders that are stored in 2 depots. The courier:

  1. Starts from depot 2, where they pick up orders 2, 3, and 4.
  2. Delivers order 3 on the way.
  3. Visits depot 1 to pick up the remaining orders.
  4. Delivers all the remaining orders.

As a result of planning, the picked_orders field will contain the following values:

  • Order 3, Order 4, Order 2 for Depot 2.
  • Order 1 for Depot 1.

API request (JSON)API responseView on map

Example 2

The same as in example 1, but depots_only_at_run_beginning = true. As a result of planning, the courier:

  1. Starts from depot 2, where they pick up orders 2, 3, and 4.
  2. They stop at depot 1 to reload and pick up order 1.
  3. Delivers the orders.

API request (JSON)API responsehttps://yandex.com/courier/mvrp-map#15e25725-cc14d32e-61d3d7bd-8b5e0cd

Example 3

You need to deliver 4 orders:

Order Order type Action
Order 1 delivery Pick up from depot 1 or 2
Order 2 delivery Pick up from depot 3 or 4
Order 3 pickup Take to depot 1 or 3
Order 4 pickup Take to depot 2 or 4

The courier:

  1. Starts at depot 2, where they pick up order 1.
  2. Proceeds to take pickup orders 3 and then 4.
  3. Stops at intermediate depot 3 to unload order 3 and pick up order 2.
  4. Delivers orders 2 and then 1.
  5. Returns to depot 2 and unloads order 4.

The picked_orders field of the API response shows which depot the order was picked up at, and the delivered_orders field shows which depot it was delivered to.

API request (JSON)API responseView on map

Start of a new run from a different depot

What situations to use this in

In this scenario, the courier can make several runs. New runs can be started from a different depot, the one specified in vehicle.starting_depot_id. An empty run from one depot to another is possible between runs.

How to implement this scenario

Use the same parameters as when planning a visit to an additional depot.

To allow a courier to go from one depot to another between runs, set can_change_depot_between_runs = true (the default is false).

Diagram

Example

The same as in the example with a visit to an additional depot, but there are weight restrictions: only 2 orders can fit in the vehicle. The courier can make 2 runs: vehicle.max_runs = 2. Each run must start at depot 2 and end at depot 1. In order for the courier to be able to go from one depot to another between runs, can_change_depot_between_runs = true. The courier performs the following actions:

  1. Starts from depot 2, where they load order 4. Stops at depot 1 to load order 1. Delivers orders 4 and 1. Finishes the first run at depot 1.
  2. Travels to depot 2. Loads orders 2 and 3 for the second run. Delivers the loaded orders. Returns to depot 1 at the end of the run.

API request (JSON)API responseView on map

Choosing the optimal depot to start from

What situations to use this in

In this scenario, you need to decide how to distribute couriers between depots based on the depots' shipping volume. Conditions:

  • There are several depots.

  • Vehicle fleet is common for all depots.

This scenario can be used both when there's no need to visit additional depots and when delivery to a single location may require visiting additional depots.

How to implement this scenario

For each courier in the vehicle.starting_depot_id field, specify one or multiple depots where they can start and pick up orders. The algorithm selects the optimal depot to start from. You also need to specify vehicle.ending_depot_id (the depots where the courier can end the route).

If necessary, use the following fields:

  • vehicle.allow_different_depots_in_route: The ability to visit multiple depots in one route:

    • If true, the courier can visit multiple depots on the same route.
    • If false, the courier can only visit the depot where they started the route.
  • vehicle.middle_depot_id: Depots to pick up more orders from (intermediate depots).

  • vehicle.max_middle_depots: The maximum number of intermediate depots on the route. The default value is 0.

Note

Depot lists can overlap. If the starting, intermediate, and ending depots are the same, they can be listed in the vehicle.depot_id field instead of being specified in three separate fields.

Diagram

Example

There are orders waiting for delivery in two depots. Both depots are listed for the courier in the starting_depot_id field, but the route must be completed at depot 2. Because depot 2 is further from the delivery addresses, the algorithm selects depot 1 to start from, but ends the route at depot 2.

API request (JSON)API responseView on map

Delivery to one of multiple locations

What situations to use this in

Use this scenario in cases where cargo can be delivered to one of several possible points and you need to choose the optimal one:

  • Collecting medical tests from clients' homes to take them to the nearest lab.

  • Collecting garbage or scrap metal to take it to the nearest disposal site.

  • Picking up a parcel from a client to send it via a third-party transport company, which is why you need to take it to the nearest receiving terminal.

  • Courier delivery. You need to plan a meeting between a regular courier and a courier with a fixed route that collects urgent shipments from regular couriers.

How to implement this scenario

Implement the scenario "delivery to one of multiple possible locations" using the delivery_to_any parameter.

You can see where the order was delivered in the API response: in the delivered_orders field for depots or drop_off orders.

Diagram

Example

In this example, a set of pickup orders is implemented. For each order, several identical points are specified indelivery_to_any. After collecting orders, the courier will take them to the nearest drop_off point at the end of their shift. This will be Laboratory 4 for the first courier and Laboratory 2 for second. In the API response, you can see the orders delivered to these locations in the delivered_orders field.

API request (JSON)API responseView on map

Receiving cargo at one of the possible locations

What situations to use this in

Use this scenario in situations where certain cargo can be received at several points and you need to choose the optimal one among them. For example:

  • The goods to be delivered are located at different points (for example, in one of the grocery stores or pharmacies).

  • The cargo can be received at one of the terminals of a third-party transport company.

  • It's necessary to plan a meeting between a regular courier and a courier with a fixed route that takes urgent shipments to regular couriers.

How to implement this scenario

Learn more in the description of the pickup_from_any parameter.

Diagram

Example

In this example, there are 2 delivery orders with pickup_from_any set to true. 2 pickup orders are associated with each of these orders.

Please note that all pickup orders and the linked delivery order must be the same weight.

API request (JSON)API responseView on map

Planning multiple runs from the depot for one courier

What situations to use this in

  • The shipment volume exceeds available load capacity

    In this case, all or some of the vehicles must make more than one run to ship all the orders.

  • It's impossible to collect all orders by the time of shipment

    Sometimes depot capacity doesn't allow you to collect all orders by the time shipment starts, but delivery must start immediately to ensure that order windows are met. In this case, couriers will make their first run not fully loaded, so that they can deliver the orders with earlier delivery windows on time. Meanwhile, the depot will collect orders with later delivery windows, which will be delivered during future runs.

How to implement this scenario

Diagram

Example 1

In this example, the total weight of the three orders (3000 kg) exceeds the total load capacity of two vehicles (2500 kg). Courier 2 will make two runs (max_runs), delivering the third order during the second run.

API request (JSON)API responseView on map

Example 2

In this example, the courier will first deliver the earlier orders (time_window), depot_ready_time determines if they're ready or not. The max_runs parameter will allow them to return to the depot to collect the later orders.

API request (JSON)API responseView on map

Cross docking

A cross docking is a depot for the transshipment, reconsolidation, or reloading of goods. Specify the crossdock value in the type field for such depots.

Cross docking can be used for some orders to ensure the speed of delivery and reduce transport costs: orders are taken to a cross docking closer to distant locations in advance. For example, a depot is located north of the city, and delivery is carried out in the daytime. In this case, to deliver orders to the southern part of the city, a cross docking is created in the south, where some orders are delivered at night by large vehicles.

Orders aren't stored at cross dockings. Instead, one or more vehicles bring the orders, and then one or more vehicles pick them up and deliver them to clients. At the moment, different vehicles must transport orders to and from the cross docking.

For vehicles, the restriction on working with cross dockings is set using the crossdock_mode parameter. It can take the following values:

  • allow: The vehicle can take orders both to clients and to a cross docking (default value).
  • deny: The vehicle can only take orders to clients.
  • mandatory: The vehicle can only take orders to a cross docking.

To specify which depots or cross dockings the vehicle visits, use the vehicle.depot_id, vehicle.starting_depot_id, vehicle.middle_depot_id, and vehicle.ending_depot_id fields.

Alert

You can't specify both regular depots and cross dockings in the vehicle.depot_id, vehicle.starting_depot_id, vehicle.middle_depot_id, and vehicle.ending_depot_id fields. The courier may visit either regular depots or cross dockings in a single route.

For orders, the crossdock_mode parameter is also set with the following values:

  • allow: The order can be delivered both directly from the depot and via a cross docking (default value).
  • deny: The order can only be delivered directly from the depot.
  • mandatory: The order can only be delivered via a cross docking.

To specify which depot the order is stored at or via which cross docking it must be delivered, use the location.depot_id field. If multiple depots and cross dockings are specified, the order can be picked up from any of them.

For pickup orders, you can set the may_drop_in_crossdock parameter with the following values:

  • true: The order can be left in the cross docking (default value).
  • false: The order must be delivered to a regular depot.

The may_drop_in_crossdock parameter can only be used in the Delivery to one of multiple locations scenario. If you have pickup&delivery order pairs where it's possible to visit an intermediate cross docking, use the Pickup & delivery via a cross docking scenario.

Note

The courier first delivers delivery orders to the cross docking and only after that picks up pickup orders from the cross docking.

Handling time

For orders delivered via a cross docking, location.crossdock_service_duration_s is taken into account. When a vehicle arrives from a regular depot to a cross docking, the handling time for it is calculated using the formula:

depot.service_duration_s + Total{ location.crossdock_service_duration_s} for all orders that the vehicle brought.

When using cross docking, it's useful to have a time buffer depot.crossdock_safety_waiting_duration_s: the minimum amount of time that should pass between unloading an order at the cross docking and when it can be picked up for delivery to the client (by default, 3600 seconds, or 1 hour). This buffer is necessary so that the potential delay of the first vehicle (carrying orders to the cross docking) won't affect the routes of vehicles that pick up orders from the cross docking.

Diagram

Example 1

4 couriers and 6 orders that need to be delivered from 2 depots and partially via a cross docking. The depots are located in the west of Moscow, and the cross docking is in the east. Orders 1, 2 and 3 are located in the west and are delivered from depots. Orders 4, 5, and 6 are in the east and are delivered via a cross docking.

Planning result:

Courier Courier characteristics Route
Courier 1 Starts from depot 1. Isn't allowed to take orders to the cross docking. Picks up orders 1 and 3 from depot 1 and delivers them to clients.
Courier 2 Starts from depot 2. All routes are allowed. Picks up orders 2 and 6 from depot 2. Delivers order 2 to the client and order 6 to the cross docking.
Courier 3 Starts from depot 1. Can only take orders to the cross docking. Picks up orders 4 and 5 at depot 1, takes them to the cross docking, and returns to depot 1.
Courier 4 Starts from the cross docking. Picks up orders 4, 5, and 6 from the cross docking and takes them to clients.

API request (JSON)API responseView on map

Example 2

The planning task has 2 couriers, 1 depot in the south of Moscow, and a cross docking in the east. The following conditions are set for orders:

Order Order type Where it is located Where it is delivered to Via a cross docking You can leave it at the cross docking
1 delivery At the depot To the client Yes -
2 pickup From the client To the cross docking No Yes
3 pickup From the client To the cross docking No Yes
4 pickup From the client To the depot Yes No

Planning result:

Courier Courier characteristics Route
Courier 1 Starts from depot 1. Can only take orders to the cross docking. Picks up order 1 from the depot and takes it to the cross docking. After waiting, picks up order 4 from the cross docking and takes it to the depot.
Courier 2 Starts from the cross docking. Picks up order 1 from the cross docking. Picks up orders 2, 3, and 4 from clients and delivers order 1 to the client. Takes orders 2, 3, and 4 to the cross docking.

API request (JSON)API responseView on map

Example 3

The same depots and couriers as in example 2. The following conditions are set for orders:

Order Order type Where it is located Where it is delivered to Via a cross docking You can leave it at the cross docking
1 delivery At the depot To the client Yes -
2 pickup From the client To drop_off or drop_off_2 (delivery_to_any) No Yes
3 pickup From the client To the cross docking No Yes
4 pickup From the client To the depot Yes No

Planning result:

Courier Courier characteristics Route
Courier 1 Starts from depot 1. Can only take orders to the cross docking. Picks up order 1 from the depot and takes it to the cross docking. Picks up order 4 from the cross docking and takes it to the depot.
Courier 2 Starts from the cross docking. Picks up order 1 from the cross docking. Picks up order 3 from the client, delivers order 1 to the client, picks up orders 2 and 4 from clients, delivers order 2 to drop_off_2, takes orders 3 and 4 to the cross docking.

API request (JSON)API responseView on map

Planning without accounting for the delivery distance to the cross docking

What situations to use this in

Use this option if there is no need to take into account the delivery distance from the main depot to the cross docking.

How to implement this scenario

This scenario is similar to Delivery from one of several depots, and it can be implemented the same way.

Alert

Unlike the cross docking scenario described above, delivery of orders to the cross docking isn't included in the routes in this scenario. When planning, it's assumed that any order can be taken to a cross docking, and you need to choose which orders are more profitable to ship from there. You also need to know in advance which vehicles start from the main depot and which ones start from a cross docking platform.

Diagram

Example

The 60 delivery points are orders to deliver. The garage point is a cross docking. One courier must start the route from the depot, and the other one must start from the cross docking.

API request (JSON)API responseView on map

Pickup & delivery via a cross docking

What situations to use this in

This scenario is used if the orders that need to be delivered from the cross docking must be picked up from pickup points in advance.

How to implement this scenario

Set time limits for routes to bring orders to the cross docking and then deliver them to clients.

  • Pickup and delivery by different vehicles

    Split delivery to and from the cross docking into different planning runs. You will get one planning according to the Cargo collection to the depot scenario and the second according to the Delivery from a single depot scenario.

    Example

    Cross docking with two 2 different planning runs: pickup and delivery.

    1. The first part is the pickup. During the morning shift, one vehicle collects orders from different addresses and returns to the depot.

    API request (JSON)API responseView on map

    2. The second part is the delivery. During the day shift, another vehicle collects orders from the depot and delivers them to clients.

    API request (JSON)API responseView on map

  • Collection and delivery by a single vehicle

    Set a time limit for order collection and delivery.

    1. For orders that need to be collected at a cross docking:

    2. For orders that need to be delivered from a cross docking:

    Between the delivery_deadline and depot_ready_time parameter values, there must be a window to allow for cross docking operations. For example, collect the cargo before 13:00 and start delivery at 14:00.

    Example

    1 courier, 10 pickup orders, and 10 delivery orders. The orders are not linked. All pickup orders need to be delivered to the depot before 13:00, and all delivery orders can be picked up from the depot beginning at 14:00. For the courier to carry out the orders in 2 runs, vehicle.max_runs = 2 is specified.

    API request (JSON)API responseView on map

Diagram

Delivery with vehicle parking before the walking part of the route

What situations to use this in

The scenario is used when there are several closely located orders along the route. The courier can arrive by vehicle, park, and deliver orders on foot. If it's not possible to carry all orders in one run, the courier makes several runs. At the start of each run, the courier takes some of the orders, delivers them, and then gets back to the vehicle and takes the next batch of the orders.

The route may include a few walking parts.

How to implement this scenario

Set the parameters:

  • location.parking_service_duration_s: The amount of time that the courier spends parking the vehicle.

    Note

    For the walking and transit transportation methods, the location.parking_service_duration_s parameter isn't taken into account in the calculations of the time spent.

    For other transportation methods, the time specified in the location.parking_service_duration_s parameter will be taken into account only once: before the start of the walking part of the route.

  • vehicle.walking_courier.capacity.units: The maximum number of units that the courier can carry. To use this feature, specify the number of units for the order using the location.shipment_size parameter.

    If the courier needs to carry more units than specified in the vehicle.walking_courier.capacity.units parameter, the algorithm can build the route so that the courier makes multiple runs. For example, if the courier needs to visit 10 locations during the walking delivery, and vehicle.walking_courier.capacity.units = 5, the courier delivers 5 units first, goes back to the vehicle, and then picks up the remaining 5 units.

    Note

    RouteQ supports scenarios where only one courier leaves the vehicle and delivers orders on foot.

  • vehicle.walking_courier.cost.hour and/or vehicle.walking_courier.cost.km: The cost of walking delivery per hour and per kilometer. The cost of walking delivery is calculated the same way as the vehicle or courier cost.

  • vehicle.walking_courier.restrictions: Restrictions for walking parts of routes:

    • max_walking_edge_distance_m.value and max_walking_edge_distance_m.penalty: The maximum distance (in meters) between two points on walking parts of the route and the penalty for violating the restriction.
    • max_parking_walking_distance_m.value and max_parking_walking_distance_m.penalty: The maximum walking distance (in meters) in a parking session and the penalty for violating the restriction.
    • max_parking_duration_s.value and max_parking_duration_s.penalty: The maximum duration (in seconds) of a parking session and the penalty for violating the restriction.
    • close_locations: Array of restrictions for nearby order locations:
    • duration_till_service_s.value and duration_till_service_s.penalty: The maximum time (in seconds) between handling two nearby orders and the penalty for violating the restriction.
    • distance_till_service_m.value and distance_till_service_m.penalty: The maximum distance (in meters) walked between two nearby orders and the penalty for violating the restriction.
    • search_radius_m: The distance between two orders, which are considered nearby and subject to restrictions.
    • soft_search_radius_m: If the value of this parameter exceeds the value of the corresponding search_radius_m, orders at a distance from search_radius_m to soft_search_radius_m are also subject to penalties, but their size decreases linearly depending on the distance. For example, at the distance (search_radius_m + soft_search_radius_m) / 2, a penalty with a weight of 0.5 applies.
    Example of using the settings of closely located orders
    {
    ...
    "walking_courier": {
    ...
    "restrictions": {
            "close_locations": [
                {
                    "routing_mode": "walking",
                    "search_radius_m": 400,
                    "soft_search_radius_m": 500,
                    "distance_till_service_m": {
                        "penalty": 0.02,
                        "value": 1500
                    }
                },
                {
                    "routing_mode": "walking",
                    "search_radius_m": 100,
                    "soft_search_radius_m": 160,
                    "duration_till_service_s": {
                        "penalty": 0.02,
                        "value": 1500
                    }
                }
            ],
    ...
          }
    ...
        },
    ...
    }
    

    In the example above, the first restriction is that orders up to 400 meters away from each other must be handled within the next 1500 meters of movement. The penalty for violating the restriction is 0.02 for every meter. For orders 400 to 500 meters away from each other, this restriction also applies, but it decreases linearly depending on the distance. For example, for an order 430 meters away, a penalty equal to 0.7 of the main penalty is applied.

    The second restriction is similar to the first one, but it sets the time between handling orders. Orders within a radius of 100 meters must be handled within 25 minutes with a 0.02 penalty for each second over. Orders at a distance of 100 to 160 meters are subject to the penalty, which decreases linearly as the distance grows.

To balance the cost of visiting orders on foot and vehicle, use options.average_projection_walking_part_distance_m. This option sets the average walking distance from the road to the order. When the option is used, for each visit to an order by vehicle, the courier is subject to twice the penalty cost for walking.

For example, if average_projection_walking_part_distance_m = 15, the cost of 30 meters of the walking route is added to the cost of each visit. You can use this setting to compensate for the cost of walking part of the way when using the driving transportation method compared to the same distance with the walking transportation method.

Diagram

Example 1

The route includes 10 orders. Some orders are near each other:

  • Orders 1, 2, 3, and 4.
  • Orders 5, 7, and 9.
  • Orders 8 and 10.

Because the cost of delivery on foot is less than the cost of driving, the courier parks the vehicle and delivers nearby orders on foot. To deliver the remaining orders, the courier travels by vehicle.

API request (JSON)API responseView on map

Example 2

The same as example 1, but vehicle.walking_courier.capacity.units = 2. To deliver orders located close to each other, the courier parks the vehicle and delivers no more than two units per run.

API request (JSON)API responseView on map

Using a trailer

What situations to use this in

By default, only a truck without a trailer can arrive at the order location. Use this scenario if the order location is available for trucks with a trailer. For settings that affect trucks with a trailer, see Trailers.

Note

This scenario isn't used for trucks with a semi-trailer.

How to implement this scenario

The accessibility of an order location for a truck with a trailer is set in the location.allow_trailers field. The default is location.allow_trailers = false, a non-accessible location where only a truck without a trailer can arrive. To implement a scenario with an accessible location, set location.allow_trailers = true. In this case, the location is considered accessible for a truck with a trailer.

Types of orders for trucks with trailers:

  • anchor: Location where you can leave a trailer for some time and perform a rolling if required.

  • parking: Location where you can leave a trailer only while unloading an order.

You can arrive at the point with the anchor type with a trailer, leave it for a few hours, and perform rolling. This order must have a unique id. If you need to deliver cargo to this point, create another order with the delivery type (see Order type).

The number of vehicles (truck and trailer couplings) that the anchor location can serve is unlimited by default. If necessary, specify the maximum number of vehicles that the anchor location can serve during the planning period in the max_total_vehicles parameter.

To limit the number of vehicles that can be at the anchor location at the same time, use the rolling_throughput.vehicle_count field.

If the anchor location's throughput capacity is exceeded during the planning period, the following penalties apply:

  • penalty.rolling_throughput.fixed: For violation.

  • penalty.rolling_throughput.vehicle: For each vehicle over the rolling_throughput.vehicle_count limit.

You can leave a trailer at the location with the parking type only while unloading one order in a non-accessible store.

When performing the planning task for orders with the anchor and parking type, the following fields are indicated:

Field

Description

trailer_used

Shows whether the truck left the depot with or without a trailer. It may have the values true/false. The truck can arrive at a non-accessible location if it left without a trailer (trailer_used = false).

trailer_decoupled

Describes the case when the truck left the depot with a trailer. Shows whether a trailer was decoupled on the route or not. It may have the values true/false. If a trailer is decoupled (trailer_decoupled = true), the truck can arrive at a non-accessible location.

Response fragment
{
    "arrival_time_s": 36726.340873455316,
    "node": {
        "type": "location",
        "used_time_window": "12:00:00-18:00:00",
        "value": {
            "anchor_mode": "Decoupling",
            "hard_window": false,
            "id": 1,
            "penalty": {
                "out_of_time": {
                    "fixed": 1000,
                    "minute": 17
                }
            },
            "point": {
                "lat": 55.780426,
                "lon": 37.712129
            },
            "ref": "",
            "service_duration_s": 0,
            "shared_service_duration_s": 0,
            "time_window": "12:00:00-18:00:00",
            "total_service_duration_s": 0,
            "trailer_decoupled": true,
            "trailer_used": true,
            "type": "anchor"
        }
    },
    "transit_distance_m": 4035.227074751774,
    "transit_duration_s": 726.3408734553194,
    "violations": [],
    "waiting_duration_s": 6473.659126544684
  }

The following fields are indicated in the solution only for orders with the anchor type:

Field

Description

anchor_mode

The anchor point use mode. It may have the following values:

  • Decoupling: Decouple a trailer and continue the route.
  • Coupling: Couple a trailer and continue the route.
  • Rolling: Roll the cargo from the trailer, decouple it, and continue the route.

load_to_head

Contains a list of orders that need to be moved from the trailer to the truck (only for locations with anchor_mode = Rolling). Note that the order can be partially moved to a truck. In this case, part of the order remains in the trailer if the truck capacity was exceeded after moving the cargo.

Response fragment
{
    "route": [
        {
            "arrival_time_s": 49003,
            "departure_time_s": 52603,
            "load_to_head": [
                "Order 1",
                "Order 2",
                "Order 3",
                "Order 4"
            ],
            "node": {
                "type": "location",
                "used_time_window": "08:00:00-14:00:00",
                "value": {
                    "anchor_mode": "Rolling",
                    "hard_window": false,
                    "id": "anchor43",
                    "point": {
                        "lat": 52.527983,
                        "lon": 85.227133
                    },
                    "ref": "",
                    "service_duration_s": 3600,
                    "shared_service_duration_s": 0,
                    "time_window": "08:00:00-14:00:00",
                    "total_service_duration_s": 3600,
                    "trailer_decoupled": true,
                    "trailer_used": true,
                    "type": "anchor"
                }
            }
        }
    ]
  }

When performing the routing task with trailers, the following fields are indicated:

Field

Description

trailer_used

Shows whether the truck left the garage with or without a trailer. It may have the values true/false. It may change during the route.

trailer_decoupled

Shows whether the truck left the depot with or without a trailer. It may have the values true/false. It may change during the route.

load_to_head

The list of orders to be loaded into the truck.

load_to_trailer

The list of orders to be loaded into the trailer.

Response fragment
{
    "route": [
        {
            "arrival_time_s": 0,
            "departure_time_s": 5040,
            "load_to_head": [
                "Order 5",
                "Order 6",
                "Order 7",
                "Order 8"
            ],
            "load_to_trailer": [
                "Order 1",
                "Order 2",
                "Order 3",
                "Order 4"
            ],
            "node": {
                "type": "depot",
                "used_time_window": "00:00:00-1.23:59:59",
                "value": {
                    "finish_service_duration_s": 1800,
                    "flexible_start_time": true,
                    "hard_window": true,
                    "id": "576",
                },
                "point": {
                    "lat": 53.400374288503,
                    "lon": 83.967696868016
                },
                "preliminary_service_duration_s": 0,
                "ref": "",
                "service_duration_s": 5040,
                "time_window": "00:00:00-1.23:59:59",
                "total_service_duration_s": 5040,
                "trailer_decoupled": false,
                "trailer_used": true
            }
        }
    ]
  }

Diagram

Note

To have the trailer rolling, decoupling, and coupling locations displayed on the map, contact support to activate this option.

Exporting solutions with trailers to Track & Trace is not currently supported.

Example 1

In the example, one truck with a trailer must deliver three orders. You can arrive at one of the points with a trailer (allow_trailers = true), to the other two — no (allow_trailers = false). The route has locations where you can leave a trailer for some time (type = parking).

In the resulting solution, the truck first arrives at the parking spot, leaves a trailer there, and then goes to unload the cargo at a non-accessible location. After delivering the cargo, the tractor returns to the parking spot, picks up the trailer, and continues the route.

API request (JSON)API responseView on map

Example 2

In the example, one truck with a trailer must deliver four orders. You can't arrive at two points with a trailer (allow_trailers = false), but you can at the other two (allow_trailers = true). The route also has an anchor location (type = anchor) where you can leave a trailer for a long time.

The algorithm builds a route taking non-accessible locations into account. The truck first arrives at the anchor location and leaves the trailer. It delivers orders to the points where trailers are forbidden. Then the truck returns to the anchor location to pick up the trailer and delivers the cargo to where trailers are allowed.

API request (JSON)API responseView on map

Example 3

In the example, one truck with a trailer must deliver four orders to points where trailers are forbidden (allow_trailers = false). The route has an anchor location (type = anchor). The total weight of orders is much greater than the vehicle capacity. The truck can't deliver all orders without using a trailer.

The truck first arrives at the anchor location, leaves the trailer, and delivers two orders without it. Then, the truck returns to the anchor location, rolls the cargo from the trailer to the truck, and leaves again without the trailer to deliver the remaining orders.

API request (JSON)API responseView on map

Example 4

In this example, there are 23 orders with non-accessible locations (allow_trailers = false) and 4 couriers. The route has two anchor locations (type = anchor). No throughput capacity limit is set, so all couriers use only one anchor location.

API request (JSON)API responseView on map

Example 5

Same as example 4, but there are throughput capacity limits set for the anchor locations. The first one can't have more than two vehicles at a time (rolling_throughput.vehicle_count = 2). The other anchor location can only serve two trucks per day (max_total_vehicles = 2). There are per-vehicle penalties for throughput capacity violations (penalty.rolling_throughput.vehicle).

The resulting solution makes use of both anchor locations in line with their throughput capacity.

API request (JSON)API responseView on map

Contact support