Skip to content

Is it possible to verify already existing solution by OptaPlanner to check how may rules get broken?

Here the already existing solution is generated by any other codebase/tool but we can adjust the attribute as per requirement for OptaPlanner.
Main aim is to verify that existing solution is breaking how many rules then the mature result from optaPlanner.


Yes, that’s possible.

See docs section “explaining the score”. Basically you use SolverFactory.getScoreDirectorFactory() to build a ScoreDirector and then use setWorkingSolution(), calculateScore() and then explainScore() (in that order).