I am still using the OptaPlanner to optimize a chained planning problem which is similar to the VehicleRoutingExample. My planning entities have a planning variable which is another planning entity. The scores are HardSoftScores.
I have initialized an IncrementalScore to solve my runtime-problem, but something isn’t working right and I wasn’t able to find the reason why. (with debugging, system.out… ect. ...)
The Problem is that the Solver doesn’t create a feasible solution of my testing dataset by using the IncrementalScore. I know that it is possible to find a feasible solution because the solver created one with my EasyScore.
The optimal solution created by the EasyScore gives me the score: (0hard/-151763soft) when the IncrementalScore is solving I get some strange values.
The score given by solver.getBestsolution().getScore() is (-25hard/-207111soft), when I instantiate an extra IncrementalScoreCalculator and let it calculate a Score of the bestSolution, I get the values (-34hard/-207111soft). I checked the solution and found out, that the first values are just wrong, but the second ones are “correct” (but not feasible).
Does someone has an idea where the mistake is? Or are there some other ways to find the reason?
In the manual see chapter "5.3.6. Invalid score detection" to find out when the easy and incremental score calculation go out of sync.
<environmentMode>FULL_ASSERT</environmentMode>
...
<scoreDirectorFactory>
<scoreDefinitionType>...</scoreDefinitionType>
<incrementalScoreCalculatorClass>...IncrementalScoreCalculator</incrementalScoreCalculatorClass>
<assertionScoreDirectorFactory>
<easyScoreCalculatorClass>...EasyScoreCalculator</easyScoreCalculatorClass>
</assertionScoreDirectorFactory>
</scoreDirectorFactory>
Then comment out constraint type's in both implementation to zero in on the constraint that's implemented differently. It looks like it's one of your hard constraints that's calculating invalidly.