google / or-tools

Google's Operations Research tools:
https://developers.google.com/optimization/
Apache License 2.0
10.77k stars 2.09k forks source link

VRP with breaks minor bug? #4234

Open vuongdanghuy opened 1 month ago

vuongdanghuy commented 1 month ago

What version of OR-Tools and what language are you using? Version: stable branch Language: C++

Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi) Routing Library

What operating system (Linux, Windows, ...) and version? Linux Mint 21.3

What did you do? Using VRP with breaks. GlobalVehicleBreaksConstraint will be added to the Solver.

What did you expect to see I believe here we're updating StartMin value of the arc path_[pos] -> path_[pos + 1] to EndMin value of the break interval. This arc StartMin is CumulVar(path_[pos])->Min() - arc_start_offset. So instead of SetMin(CapSub(interval_end_min, arc_start_offset)) it should be SetMin(CapAdd(interval_end_min, arc_start_offset)).

https://github.com/google/or-tools/blob/5124f4975bd6ab5a863ea55657833ab640730429/ortools/constraint_solver/routing_breaks.cc#L943-L951

ghost commented 1 month ago

You are correct, this should be a CapAdd() instead of a CapSub(). The current SetMin() is weaker than it could be. Thank you for the report!

varshneydevansh commented 1 month ago

So all we have to do is to replace the CapSub with the CapAdd ?

Or is there anything else which I should consider?

vuongdanghuy commented 1 month ago

yeah, replace CapSub by CapAdd will do

varshneydevansh commented 1 month ago

Okay creating a PR :)