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).