VRP Resource Constraints bug - solver over allocating resources #4159
Replies: 2 comments
-
Few notes:
At the end try to add this loop to force solver to fix each CumulVar...: for (int i = 0; i < data.JobNumber; i++)
{
long index = manager.NodeToIndex(i + 1);
routing.AddVariableMinimizedByFinalizer(timeDimension.CumulVar(index));
}
public int ServiceSiteClosingTime = 3540+250; note: Maybe allowing the solver to drop few node would be better in your case... as well as enabling the GLS. searchParameters.FirstSolutionStrategy = FirstSolutionStrategy.Types.Value.Automatic;
searchParameters.LocalSearchMetaheuristic = LocalSearchMetaheuristic.Types.Value.GuidedLocalSearch;
searchParameters.TimeLimit = new Google.Protobuf.WellKnownTypes.Duration{ Seconds = 10, }; to get the output: Start 69: dotnet_constraint_solver_Tsp_net60
69: Test command: /usr/bin/cmake "-E" "env" "--unset=TARGETNAME" "/usr/bin/dotnet" "run" "--no-build" "--framework" "net6.0" "-c" "Release"
69: Working Directory: /home/mizux/work/main/build/dotnet/constraint_solver/Tsp
69: Test timeout computed to be: 1500
69: Objective 6600:
69: Route for Vehicle 0:
69: 0 Time(0,0) -> 0 Time(0,0)
69: Time of the route: 0min
69: Route for Vehicle 1:
69: 0 Time(0,0) -> 5 Time(0,0) -> 4 Time(600,600) -> 3 Time(1200,1200) -> 2 Time(1800,1800) -> 1 Time(2400,2400) -> 0 Time(3000,3000)
69: Time of the route: 3000min
69: Route for Vehicle 2:
69: 0 Time(0,0) -> 11 Time(0,0) -> 10 Time(600,600) -> 9 Time(1200,1200) -> 8 Time(1800,1800) -> 7 Time(2400,2400) -> 6 Time(3000,3000) -> 0 Time(3600,3600)
69: Time of the route: 3600min
69: Total time of all routes: 6600min
1/1 Test #69: dotnet_constraint_solver_Tsp_net60 ... Passed 10.56 sec |
Beta Was this translation helpful? Give feedback.
-
Hi @Mizux , To clarify - in this example, I expect the solver to find no solution (i.e. your output). Since the service site can only accommodate 2 vehicles at a time, and is only available for 59 minutes, a maximum of 10 jobs can be done, so I expect it to find no solution if jobs aren't allowed to be dropped.
Thank you for your assistance. |
Beta Was this translation helpful? Give feedback.
-
Version: v 9.9.3963
Language: C#
Routing Solver
Windows 10
Please find an MRE below.
I expect to see a maximum of 2 jobs being executed simultaneously (as the ServiceSite has a capacity of 2).
From the output (also attached below), it seems that all three vehicles are executing jobs at ServiceSite at time 0, which would be violating the constraint. Not sure if my implementation is wrong, or if there is a bug in the solver.
Beta Was this translation helpful? Give feedback.
All reactions