Help: Setting multiple SoftUpperBound for different vehicles #2963
Replies: 6 comments
-
|
You could implement 3 separate dimensions, force their accumulated values to be offset properly, and apply an upper bound on each of these. ? |
Beta Was this translation helpful? Give feedback.
-
|
Good suggestion. Also when I tried to implement SetCumulVarSoftUpperBound directly into my code, the solver uses upper bound as a hard constraint rather than finding a solution with minimized cost . The code I used is shown below. Did I go wrong somewhere? |
Beta Was this translation helpful? Give feedback.
-
|
@jayadevc I've got a similar problem, have you been able to make any progress on yours? |
Beta Was this translation helpful? Give feedback.
-
|
There are piecewise linear cost, but only in C++. |
Beta Was this translation helpful? Give feedback.
-
|
Hi! I would also be interested in using piecewise linear functions in Python for a routing problem. Does the last messages of @Mizux about modifying the milestones mean that it will be available through 9.1 version? Thank you very much for your efforts on doing or-tools an excelent way of solving optimization problems. |
Beta Was this translation helpful? Give feedback.
-
|
@Mizux Will piecewise linear cost function available in 9.1 for C# ? Its much awaited feature for which we have been waiting for past 2+ years. Thanks for all your efforts... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have modeled a VRP with capacity and time window constraints which are working perfectly.
Now I need to add cost of vehicles depending on the total distance travelled by the vehicle.
The cost of a vehicle consists of different slabs depending on the distance traveled as shown below.
-- Vehicle_1 --
Slab 1. Fixed Cost: 10000
Slab 2. 0 to 100 km / Cost: 5000
Slab 3. 101 to 250 km / Cost: 7000
Slab 4. >250 km / Cost: 100/km
Suppose the distance traveled by vehicle_1 is 270 km, cost will be 24000 (10000 + 5000 + 7000 + 20*100)
For each vehicle cost slab will be different.
I have achieved first and forth slabs using following method -
distanceDimension.SetFixedCostOfVehicle(10000, vehicle);distanceDimension.SetEndCumulVarSoftUpperBound(vehicle, 250, 100);For achieving 2nd and 3rd slab I tried using
SetEndCumulVarSoftUpperBoundmultiple times with different upper bound and coefficient, but only the lastSetEndCumulVarSoftUpperBoundis working.
Can someone suggest a way to achieve this?
or-tools version: 6.5
lang: C#
Beta Was this translation helpful? Give feedback.
All reactions