Balanced Pickup and Unloading
In this example, we have a fictitious company that picks up various sizes of boxes and can unload them at a central facility when the vehicle is full. We have a fleet of heterogeneous vehicles that pick up the three item types as seen in the
items array below
The vehicles are constrained in terms of how much of each item they can carry as well as by volume and weight. Each vehicle’s capacity is expressed separately as part of the vehicle object, and an example vehicle object now looks like this
Similar to delivery problems, we express the amount to be picked up at each order with
pickup_item_quantities. In problems involving pickups, the vehicle may become full during the shift and be therefore unable to service any more orders. By specifying certain orders to have the ability to receive
unloaded items, we can extend the shift since the vehicle can empty its contents at these orders. An example of such an order is below. Note that the amount that can be unloaded must be set – typically this should be a very large value to allow essentially unlimited unloading.
A full request involving pickups, unloading events, and a
num_stops constraint to balance the routes is given below.
Expand to view request sample
All orders are visited and the routes are very balanced in terms of number of stops (either 10 or 11 orders serviced in each route). The unloading facility (boxed in red) is visited a total of 8 times to allow the vehicles to empty their contents and continue the route.
In the routes returned in the API response, any stop where items are picked up will have details of what is picked up, and how much of each item is in the vehicle at that time
In the API response, the
orders array contains the details of all the visits to the order. Of interest is the
Unload at trash facility order:
Additionally, for every stop at the unloading facility, an
items_unloaded array is included to describe the activity at the stop.
Other features of the pickup/delivery aspects of the route are also included in the
route object, such as
max_weight_in_vehicle. Since vehicle capacity constraints are never violated, the optimization engine ensures that no vehicle will ever be carrying more than its capacity at any point during the route (in terms of weight/volume/number of items). The unloading stops are strategically inserted by the algorithm in order to satisfy as many orders as possible while still respecting the vehicle capacities.