I build a VRP solution based on optaplanner 7.4.1. using a default construction heuristic "FIRST_FIT_DECREASING". In the ConstructionHeuristicDecider I can see now, that at the end of method decideNextStep a step is chosen and handed back to the solve method of DefaultConstructionHeuristicPhase. All fine. The score of this step is ok, but the next placement in the solve loop is now starting with the score of the last checked move in the move loop of decideNextStep, rather than the score of the chosen move.
So if in the first step the score "init:-157/hard:0/soft:-2100" was chosen he is now starting the first calculation based on the last checked score (e.g. "init:-157/hard:-111/soft:-2200"). As the init score of the second step is lower, and no hard constraint is touched, in the first "addMove" call of the ConstructionHeuristicDecider an invalid score is added (the first move of the second step should not have a hard score at all).
I think the core issue is the fact, that when calling "kieSession.fireAllRules()" in DroolsScoreDirector calculateScore, the workingScoreHolder still holds the last checked, but not accepted score from the last move of the previos step. Has anyone an idea how to deal with this issue?
Additional Info: maybe another approach might be to check whether in doMove of the ConstructionHeuristicDecider after the execution of the undoMove, the workingScoreHolder should not be reset to the score before executing the original move. As far as I understand it, the scoring for the move is explicitely done in processmove. After that the working score is not recalculated after execuitng the undo move. So score and solution are out of sync at that moment in time.
Regards, Frank
rebuilding scoring via a dedicated ScoreCalculator, avoiding probablyx some flaws in my CustomShadowVaribleListeners solved the issue