Mythological corruption OptaPlanner

I am using an incremental calculator for my model. After several hours / days of optimization in "full assert" mode, an exception error exception is thrown:

java.lang.IllegalStateException: Score corruption: the workingScore (-86591/-2765/-422/-591) is not the uncorruptedScore (-86591/-2873/-422/-591) after completedAction [...]: Uncorrupted: Score calculator 3718238 [schedule=Schedule6422-2015-04-16T09:47:36.932[-86591/-2873/-422/-591], prioritiesScore=-422, timelineGapsScore=-2873, requirementGapsScore=-86591, timelineVersionsScore=-591] Corrupted: Score calculator 3717237 [schedule=Schedule6422-2015-04-16T09:47:36.932[-86591/-2873/-422/-591], prioritiesScore=-422, timelineGapsScore=-2873, requirementGapsScore=-86591, timelineVersionsScore=-591] 

This metric differs in the timelineGapsScore parameter. An instance of the instance is created from the object fields of the scores calculator prioritiesScore , timelineGapsScore , requirementGapsScore and timelineVersionsScore . In this case, the instances of both estimates are equivalent, but the optaplanner mechanism detects differences (-86591 / -2765 / - 422 / -591) vs (-86591 / -2873 / - 422 / -591). How is this possible?

I suspect that cloning solutions leak (this is a concrete implementation and deep copying), but a thorough code check does not show such errors.

UPD: I forgot to mention: optaplanner works in daemon mode, the model is able to change facts in real time. Therefore, I have a suspicion of the race conditions in the model. But I do not know how injection changes are implemented under the hood of an optaplanner (not enough information in the documents ).

+5
source share
2 answers

It was a mistake with my implementation. Be accurate when doing incremental calculator calculations (or try using Drools).

0
source

"When the decision changes, calculating the incremental account (calculating the score on the AKA scale) calculates the delta with the previous state to find a new indicator, instead of recalculating the entire score for each decision score.

For example, if one Queen A moves from line 1 to 2, she will not try to check if the crowns B and C can attack each other, since none of them has changed. "

enter image description here

Corruption fails when an incremental score and a real score (= undamaged score) go out of sync.

There may be several reasons. It could even be a mistake in Drools if you use Drools scoring. If you can isolate it and burn the gira with a reproducing device, then we usually look at it.

Isolation means (in that order!):

  • delete all evaluation rules that are not needed to reproduce it.
  • delete all planning objects that are not needed to reproduce it.
  • delete all steps that are not needed to play it. See Termination.stepCountLimit to save a solution just before it goes wrong, and then decide starting with that solution.
  • (optional) delete all the moves that are not needed to play it. Turn on the trace log. It is difficult to do without hacking optaplanner, so we usually take this step.
0
source

All Articles