[OR-Tools] Scalable Way to Handle Refueling with Variable Costs Per Node? #4663
Unanswered
kharabyasser
asked this question in
CP-SAT questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on a VRP with refueling using OR-Tools, and I’ve taken inspiration from the VRP with refuel py example. In my case, each refueling station has a different fuel cost, and I want to model this in the objective function.
Here's how I approached it:
I have a main fuel dimension that tracks vehicle fuel, using negative transits for fuel consumption between nodes.
Refueling is modeled by enabling slack at refuel station nodes.
To capture the cost of fuel at each station (slack * cost at node), I do the following:
For each refuel station node, I create a new dimension (let’s call it d_i) that activates only at that node.
I then constrain the slack of d_i to match the slack of the main fuel dimension at that node. This allows me to isolate how much fuel is added there.
I apply a slack_span_cost_coefficient to d_i equal to the fuel cost at that station, so the amount of refueled fuel × cost is added to the objective.
This works well for a small number of stations, but scales poorly because each refuel node introduces a new set of constraints.
My question is:
Is there a better (i.e., more scalable and elegant) way to model variable refueling costs per station without requiring a separate dimension and constraint per station? Ideally, I’d like a way to capture refueling amounts and their corresponding costs in a way that scales well with many potential refuel nodes.
Has anyone tackled a similar problem or have a better idea to model this ?
Thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions