]
Mario Fusco reassigned DROOLS-668:
----------------------------------
Assignee: Mario Fusco (was: Geoffrey De Smet)
java.lang.IllegalStateException: Score corruption for
'employeeWeeklyHours' rule
--------------------------------------------------------------------------------
Key: DROOLS-668
URL:
https://issues.jboss.org/browse/DROOLS-668
Project: Drools
Issue Type: Bug
Affects Versions: 6.2.0.CR2
Environment: Windows 8 x64, java version 8 (1.8.0_25), IntelliJ IDE Community
Edition
Reporter: Marco Alesiani
Assignee: Mario Fusco
Labels: new_and_noteworthy
Attachments: reproducer.zip, reproducer.zip
I've been getting the error
{quote}
Exception in thread "main" java.lang.IllegalStateException: Score corruption:
the workingScore (-1300hard/0soft) is not the uncorruptedScore (-1320hard/0soft) after
completedAction ([ShiftAssignment for shift: MONDAY, from 8:0 to 8:20, assigned employee:
null => null, ShiftAssignment for shift: MONDAY, from 8:0 to 8:20, assigned employee:
null => null]):
Score corruption analysis could not be generated because either corrupted
constraintMatchEnabled (true) or uncorrupted constraintMatchEnabled (false) is disabled.
Check your score constraints manually.
at
org.optaplanner.core.impl.score.director.AbstractScoreDirector.assertWorkingScoreFromScratch(AbstractScoreDirector.java:296)
at
org.optaplanner.core.impl.phase.scope.AbstractPhaseScope.assertExpectedUndoMoveScore(AbstractPhaseScope.java:139)
at
org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider.doMove(ConstructionHeuristicDecider.java:108)
at
org.optaplanner.core.impl.constructionheuristic.decider.ConstructionHeuristicDecider.decideNextStep(ConstructionHeuristicDecider.java:77)
at
org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicPhase.solve(DefaultConstructionHeuristicPhase.java:67)
at org.optaplanner.core.impl.solver.DefaultSolver.runPhases(DefaultSolver.java:213)
at org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:176)
at TeRo.TeRoAppMain.main(TeRoAppMain.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
{quote}
when executing the following rule with an EasyScoreCalculator
{code:drl}
// Employees are forced to work the exact amount specified in their contracts
rule "employeeWeeklyHours"
when
$employee : Employee( $weeklyHours : weeklyHours, weeklyHoursAreMandatory == true )
$totalWorkAssignedMinutes : Number(intValue != $weeklyHours * 60)
from accumulate( $shiftAssignment : ShiftAssignment( $shift : shift )
and eval($shiftAssignment.employeeIsAssigned($employee) == true)
and Shift(this == $shift, $shiftTime : shiftTime),
sum($shiftTime.getShiftTotalMinutes())
)
then
scoreHolder.addHardConstraintMatch( kcontext, -1 *
Math.abs($totalWorkAssignedMinutes.intValue() - $weeklyHours * 60) );
end
{code}