I’ve been trying to implement multiple custom HardConstraints - MaxDrivingTime, MaxJobs, MaxActivities, DisallowedVehicles (for shipments and services) and currently neither of them seem to be working. Well, I found the fault why my constraints werent working, mainly the usage of getRoute().getVehicle() instead of getNewVehicle(), thanks for the help of everyone. I will be closing this thread if I knew how .
I’ve checked the fulfilled method through debugging and it reacts how it should to routes, yet somehow jobs that do not fulfill the constraint end up as BestSolution. What it does is only filter bad solutions to certain extent - 10% bad solutions.
As far as I know HardConstraints should eliminate every Not_Fulfilled solution.
Also that Ruin could be the problem for those constraints.
And that possible solutions could be applying the constraint twice, either by adding it to RuinListener or by adding it to customCostCalculator .
My questions are:
- When is HardConstraint in JSprit applied? Are there any gaps other than Ruin?
- What are the default HardConstraints?
- What is the difference iFacts.getRoute().getVehicle() and iFacts.getNewVehicle() [iFacts being JobInsertionContext]
- What happens if there are 2 constraints that directly oppose each other?
for example (opossing hardConstraints): route every job & limit routing to only jobs that are services
- ServiceInsertionCalculator and ShipmentInsertionCalculator (jie31best)
- TimeWindow, Load, Skills and SwitchNotFeasible found at AlgorithmUtil.class
- iFacts.getRoute().getVehicle() is vehicle which already went through HardConstraints. iFacts.getNewVehicle() is the one that should be tested