Fleet Routing with the VRP Solver: Modeling Multiple Capacities

11-13-2018 04:44 PM
Esri Contributor
0 0 554

Sometimes modeling a single capacity constraint just isn’t good enough for your needs, but the VRP solver only offers one capacity field.  We will look at how to model multiple capacities.  So you can model both volume and weight, or number of seats and number of wheel chair positions, or what other capacity combinations you have.

Modeling Steps

Modeling multiple capacities is actually pretty simple.  Capacities and quantities are modeled within the DeliveryQuantities and PickupQuantities field in the Orders feature class and the Capacity field in the Route feature class.  In these fields, you simply put the multiple capacities’ values in the same field separated by a space.  For example, you are tracking volume and weight with a delivery at an order location that is 90 cubic feet and 500 pounds.  In the Delivery Quantities field you enter 90 500.  It is critical that you are consistent in the sequencing of these measurements and use consistent units throughout the problem.  Sequencing and units are not tracked for you. If they are switched in sequence or switch units from one field to another the problem will be solved with the input as input.  This will lead to results that you are not expecting.

Delivery and Pickup Quantities Fields for the Orders Feature Class

For the GP tools in both ArcMap and ArcGIS Pro and the Rest Request system this is all that is needed.  When using the ArcMap UI for VRP layers there is an additional step.  You will also need to go into the Layer Properties Analysis Settings and set the parameter Capacity Count to the correct number according to how many capacities you want to model. 

Capacity Count Field in the Layer Properties

Solver’s Interpretation of differing number of specified capacities

When modeling multiple capacities, it is important to double check the entries to make sure they are accurate.  In correct entries can have unintended consequences that are sometimes hard to identify.  We will look at the effects of having too few or too many values in a field.

Too Few Inputs in a Quantity/Capacity Field

An empty string or null value in a quantity or capacity field is treated as being all zeros.  Null values are often intentional.  However, if it was unintentional and in a quantity field for an order, the order should still be routed.  Since there is now quantity associated with the order, it might overload a route.  if a capacity field on a route is unintentionally left blank, that route would only be able to accommodate orders without a delivery or pickup quantity.

When the field value has fewer dimensions then what is being tracked, the remaining not designated ones will be treated as zeros.  If it is the last number in the sequence is omitted, then this does not matter.  However, if it is in the middle of the sequence of capacities, then all the following ones are pushed forward.  This leaves the last one as zero instead of the intended middle capacity value.  It is recommended to always place a zero in the appropriate location of a capacity that is not needed.  By always including all dimensions it takes out the guess work.

To Many Inputs in a Quantity/Capacity Field

When extra capacity values are included in the ArcMap VRP layer UI it gives a solver error.  This error indicates that the order or route has a string containing too many values and will not solve.  This is because in the ArcMap VRP layer UI the Capacity Count value is set.  This indicates the number of values to be tracked and will not accept extras.

When using the GP tools or Rest Request system a Capacity Count is not set.  Instead the solver will use the maximum number of values for the problem as a Capacity Count.  If an extra value is included in a quantity field for an order, that order will not be routed.  The ViolatedConstraints for that order in the output will indicate Capacities exceeded.  This is because the order has a quantity value for a tracked dimension, but all of the routes will have a zero for that dimension at the end of its sequence. 

If an extra capacity dimension is added to a Route Capacity value, the solver will simply track an extra capacity.  The problem should still solve as intended because all the orders will have zeros in that additional capacity dimension.  The orders can, then, still fit on the vehicles.