Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-668

java.lang.IllegalStateException: Score corruption for 'employeeWeeklyHours' rule

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 6.2.0.Final
    • 6.2.0.CR2
    • None

    Description

      I've been getting the error

      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)

      when executing the following rule with an EasyScoreCalculator

      Unable to find source-code formatter for language: drl. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      // 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
      

      Attachments

        1. reproducer.zip
          179 kB
        2. reproducer.zip
          179 kB

        Activity

          People

            mfusco@redhat.com Mario Fusco
            mdiiga88 Marco Alesiani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: