CVRPPD set lower bound on % capacity utilized of overall route

181 views
Skip to first unread message

Michael Skutt

unread,
Jun 15, 2021, 2:22:34 PM6/15/21
to or-tools-discuss

Hello Team,

 

I’ve gotten great results out of this tool so far. Thanks for all your work, and sorry if these are noob questions.

I currently have a CVRPPD model that has distance, weight, and length dimensions. I’d like to somehow add a ‘utilization%’ dimension (from 0 to 100) for both weight and length that’s calculated using each route’s total distance and add a soft lower bound to it.

 cumulative weight(n) * leg distance(n) + cumulative weight(n+1) * leg distance(n+1) +...
                                                     weight capacity * route distance

Obviously this can’t work as a normal dimension since it depends on the weight dimension and the total route distance. Do you have any suggestions?

I’ve tried manually creating a constantDimension and setting each vehicles end value in an atSolutionCallback with no luck.

 

github gist: Minimum problem for OR Tools help (github.com)
In the gist, the second route of the optimal solution should be dropped. 

Bonus:

-          Is there any way to set multiple levels of soft bounds? (If < 90%, use one coefficient, if <70%, use a higher coefficient, etc.) Or something to that effect?

 

Thanks in advance,

Michael

Mizux Seiha

unread,
Jun 16, 2021, 3:40:17 AM6/16/21
to or-tools-discuss
1.Could you express it by only using the vehicle's CumulVar end node of weight, length and distance dimension

if yes, then you could try to create a dimension to store this computation then use CumulVarSoftUpperBound on it
something close to this: https://github.com/google/or-tools/blob/b37d9c786b69128f3505f15beca09e89bf078a89/ortools/constraint_solver/samples/vrp_node_max.py#L214-L281


2. Routing seems to support a CumulVarPiecewiseLinearCost() which could help you BUT it is only available in C++ (i.e. not wrapped in SWIG) and no sample is available yet sorry...
https://github.com/google/or-tools/blob/b37d9c786b69128f3505f15beca09e89bf078a89/ortools/constraint_solver/routing.h#L2498-L2512
Reply all
Reply to author
Forward
0 new messages