Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

routing(.Net): Span upper bounds causing broken depot time windows #4573

Open
AdamLithgow opened this issue Feb 27, 2025 · 0 comments
Open
Assignees
Labels
Bug Lang: .NET .Net wrapper issue OS: Windows Windows OS Solver: Routing Uses the Routing library and the original CP solver
Milestone

Comments

@AdamLithgow
Copy link

What version of OR-Tools and what language are you using?
Version: v9.11
Language: C#

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

What operating system (Linux, Windows, ...) and version?
Windows 11 Enterprise version 10.0.26100 Build 26100

What did you do?
Steps to reproduce the behavior:

  1. Open the linked demo solution
  2. Run all unit tests in the test project (SolverTests)

What did you expect to see
All 3 tests should pass

What did you see instead?
For one of the tests, the solve is marked as successful, and the start and end depots of the route are set to occur outside the hard time windows specified by approx. 5 hours. This is only occurring for a specific set of circumstances, which was brought on by attempting to cap the duration of the routes.

Adding SetSpanUpperBoundForVehicle on all vehicles caused slack to not properly factor into the solve, resulting in hours of excess wait time (vehicle leaving depot hours early to wait at an order location). Adding SetSpanCostCoeffieicntForAllVehicles causes the slack to be correctly factored into the solve, but results in the time windows being thrown off for empty routes.

Also, in one of my callbacks I have a ternary evaluation. If I change it to always return the true condition, I get 0 unassigned orders, and the time windows for the depots are correct. If I change it to always return the false condition, I get ROUTING_INFEASIBLE. However, if I let the ternary evaluate, I get ROUTING_SUCCESS with an empty route and broken time windows on the depots, but only if SetSpanUpperBoundForVehicle and/or SetSpanCostCoeffieicntForAllVehicles is set. If neither of those are present, I get ROUTING_SUCCESS with an empty route, but correct start and end depot time windows.

Make sure you include information that can help us debug (full error message, model Proto).

Anything else we should know about your project / environment
The code in Solver.cs has been commented with TODOs pertaining to the relevant lines of code and what happens with each.

https://github.com/AdamLithgow/OrToolsBugDemo

@google google locked and limited conversation to collaborators Feb 27, 2025
@lperron lperron converted this issue into a discussion Feb 27, 2025
@lperron lperron reopened this Feb 27, 2025
@lperron lperron converted this issue into a discussion Feb 27, 2025
@lperron lperron reopened this Feb 27, 2025
@Mizux Mizux added Lang: .NET .Net wrapper issue Solver: Routing Uses the Routing library and the original CP solver OS: Windows Windows OS labels Feb 27, 2025
@Mizux Mizux self-assigned this Feb 27, 2025
@Mizux Mizux added the Bug label Feb 27, 2025
@Mizux Mizux added this to the v9.13 milestone Feb 27, 2025
@Mizux Mizux changed the title Span upper bounds causing broken depot time windows routing(.Net): Span upper bounds causing broken depot time windows Feb 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Lang: .NET .Net wrapper issue OS: Windows Windows OS Solver: Routing Uses the Routing library and the original CP solver
Projects
None yet
Development

No branches or pull requests

3 participants