Total load greater than truck capacity

46 views
Skip to first unread message

AndresJ89

unread,
Sep 13, 2021, 10:24:56 PM9/13/21
to or-tools-discuss
Hello,

I'm trying to solve a VRP with 6 depots (i1 to i6), and 16 customers (k1 to k16). Each vehicle starts and returns to the same depot. The trucks have the following capacity [15, 100, 100, 100, 100, 100]. Below is the solution I'm getting. Notice that the capacity constraint holds for all the routes EXCEPT for vehicle 2 for which the final load is ~101.43. My plan is to later feed this solution to a problem in GAMS, however, this violation of the capacity results in infeasibilities in GAMS.

Route for vehicle 1:
 i1 Load(0) ->  i1 Load(0)
Distance of the route: 0.0m
Load of the route: 0

Route for vehicle 2:
 i2 Load(0) ->  k1 Load(19.642722117202254) ->  k5 Load(39.2854442344045) ->  k7 Load(59.141776937618005) ->  k4 Load(81.78449905482026) ->  k2 Load(101.42722117202251) ->  i2 Load(101.42722117202251)
Distance of the route: 639039.0m
Load of the route: 101.42722117202251

Route for vehicle 3:
 i3 Load(0) ->  i3 Load(0)
Distance of the route: 0.0m
Load of the route: 0

Route for vehicle 4:
 i4 Load(0) ->  i4 Load(0)
Distance of the route: 0.0m
Load of the route: 0

Route for vehicle 5:
 i5 Load(0) ->  k16 Load(21.429111531190987) ->  k14 Load(41.07183364839324) ->  k12 Load(60.71455576559549) ->  k6 Load(80.35727788279775) ->  k13 Load(100.0) ->  i5 Load(100.0)
Distance of the route: 162355.0m
Load of the route: 100.0

Route for vehicle 6:
 i6 Load(0) ->  k9 Load(19.642722117202254) ->  k11 Load(41.07183364839325) ->  k10 Load(60.7145557655955) ->  k15 Load(80.35727788279775) ->  k8 Load(100.0) ->  i6 Load(100.0)
Distance of the route: 571027.0m
Load of the route: 100.0

Total distance of all routes: 1372421.0m
Total load of all routes: 301.42722117202254

This is how I'm defining the truck capacity constraint:
    routing.AddDimensionWithVehicleCapacity(
        demand_callback_index,
        0,  # null capacity slack
        data['vehicle_capacities'],  # vehicle maximum capacities
        True,  # start cumul to zero
        'Capacity')

Any suggestions are appreciated.

Andres J.

Laurent Perron

unread,
Sep 14, 2021, 1:50:56 AM9/14/21
to or-tools-discuss
The solver is integral only, and python silently round all floating point values to the nearest int. 

Make sure you only use integer value, everywhere. 

--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/664f947f-1803-4d5c-a105-0c273ee0a428n%40googlegroups.com.

AndresJ89

unread,
Sep 15, 2021, 8:32:53 AM9/15/21
to or-tools-discuss
Thanks a lot Laurent!
Reply all
Reply to author
Forward
0 new messages