I use incremental score calculator for my model. After several hours/days of optimization in "full assert" mode Score corruption exception thrown out:
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]
That's scores differs in parameter timelineGapsScore
. Score instance is created from score calculator object fields prioritiesScore
, timelineGapsScore
, requirementGapsScore
and timelineVersionsScore
. Going by log, instances of both scores are equivalent in these fields, but optaplanner engine find differences (-86591/-2765/-422/-591) vs (-86591/-2873/-422/-591). How it's possible?
I suspect references leaks on solution cloning (it's specific implementation and do deep copying), but careful code check doesn't show such errors.
UPD: I forgot to mention: optaplanner runs in daemon mode, model is capable to change facts in real-time. So I have suspicion on race conditions in model. But I don't know how changes injection realized under hood of optaplanner (it isn't enough info in docs).
"When a Solution changes, incremental score calculation (AKA delta based score calculation), will calculate the delta with the previous state to find the new Score, instead of recalculating the entire score on every solution evaluation.
For example, if a single queen A moves from row 1 to 2, it won't bother to check if queen B and C can attack each other, since neither of them changed."
Score corruption happens when the incremental score and the real score (= uncorrupted score) get out of sync.
There can be several causes. It could even be a bug in Drools if you're using Drools score calculation. If you can isolate it and file a jira with a reproducer, then we give usually look at it quickly.
Isolation means (in this order!):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With