1

我正在研究一个类似于车辆路线问题的问题,并且我有一个规则来避免多个员工同时使用同一辆车。此外,我使用多级可弯曲分数仅用于详细分数计算。使用此规则,我启用了 FAST_ASSERT 并因此产生以下异常:

java.lang.IllegalStateException: Impossible VariableListener corruption: the expectedWorkingScore
(-788init/[0/0/-10/-20/-3/0/-12/-788/0/0]hard/[0/0/-25/-75/0]soft) is not the workingScore 
(-788init/[0/0/-10/-60/-3/0/-12/-788/0/0]hard/[0/0/-25/-75/0]soft) after all VariableListeners were triggered without changes to the genuine variables.
But all the shadow variable values are still the same, so this is impossible.
    at org.optaplanner.core.impl.score.director.AbstractScoreDirector.assertShadowVariablesAreNotStale(AbstractScoreDirector.java:472)
    at org.optaplanner.core.impl.solver.scope.DefaultSolverScope.assertShadowVariablesAreNotStale(DefaultSolverScope.java:140)
    at org.optaplanner.core.impl.phase.scope.AbstractPhaseScope.assertShadowVariablesAreNotStale(AbstractPhaseScope.java:171)
    at org.optaplanner.core.impl.phase.AbstractPhase.predictWorkingStepScore(AbstractPhase.java:169)
    at org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicPhase.doStep(DefaultConstructionHeuristicPhase.java:108)
    at org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicPhase.solve(DefaultConstructionHeuristicPhase.java:95)
    at org.optaplanner.core.impl.solver.AbstractSolver.runPhases(AbstractSolver.java:87)
    at org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:167)

在 AbstractScoreDirector 中,我查看了移动类型,它是 ChainedChangeMove,它的 toString 看起来像:

T:1568135-2-10- {T:1656844-2-10- -> T:1656844-2-10-}

这让我感到惊讶,因为它试图将相同的链分配给与以前相同的实体(1656844 是链中的第一个实体)。

A.需要帮助理解上述异常,以便我可以修复它。
B.我们如何确保移动创建者不会创建无用的移动,即像以前一样将相同的事实分配给实体,就像上面一样?

更新了 FULL_ASSERT 异常:

java.lang.IllegalStateException: Score corruption: the workingScore
([0/0/0/-1440/-602/0/-633/0/0/0]hard/[-120/0/-813/-2946/0]soft) is not the uncorruptedScore
([0/0/0/-1640/-602/0/-633/0/0/0]hard/[-120/0/-813/-2946/0]soft) after completedAction
 (T:1692296-2-5- {T:1690774-2-10- -> T:1690774-2-10-}):
  The corrupted scoreDirector has no ConstraintMatch(s) which are in excess.
  The corrupted scoreDirector has 20 ConstraintMatch(s) which are missing:
    com.kairos.planning.rules/Employees use same vehicle same time/[E:941, E:785]=[0/0/0/-10/0/0/0/0/0/0]hard/[0/0/0/0/0]soft
    com.kairos.planning.rules/Employees use same vehicle same time/[E:941, E:765]=[0/0/0/-10/0/0/0/0/0/0]hard/[0/0/0/0/0]soft
    com.kairos.planning.rules/Employees use same vehicle same time/[E:941, E:809]=[0/0/0/-10/0/0/0/0/0/0]hard/[0/0/0/0/0]soft
    com.kairos.planning.rules/Employees use same vehicle same time/[E:941, E:1049]=[0/0/0/-10/0/0/0/0/0/0]hard/[0/0/0/0/0]soft
    com.kairos.planning.rules/Employees use same vehicle same time/[E:941, E:881]=[0/0/0/-10/0/0/0/0/0/0]hard/[0/0/0/0/0]soft
    com.kairos.planning.rules/Employees use same vehicle same time/[E:941, E:961]=[0/0/0/-10/0/0/0/0/0/0]hard/[0/0/0/0/0]soft
    com.kairos.planning.rules/Employees use same vehicle same time/[E:785, E:941]=[0/0/0/-10/0/0/0/0/0/0]hard/[0/0/0/0/0]soft
    com.kairos.planning.rules/Employees use same vehicle same time/[E:765, E:941]=[0/0/0/-10/0/0/0/0/0/0]hard/[0/0/0/0/0]soft
    ... 12 more
  Check your score constraints.
    at org.optaplanner.core.impl.score.director.AbstractScoreDirector.assertWorkingScoreFromScratch(AbstractScoreDirector.java:491)
    at org.optaplanner.core.impl.solver.scope.DefaultSolverScope.assertWorkingScoreFromScratch(DefaultSolverScope.java:132)
    at org.optaplanner.core.impl.phase.scope.AbstractPhaseScope.assertWorkingScoreFromScratch(AbstractPhaseScope.java:167)
    at org.optaplanner.core.impl.localsearch.decider.LocalSearchDecider.processMove(LocalSearchDecider.java:163)
    at org.optaplanner.core.impl.localsearch.decider.LocalSearchDecider.doMove(LocalSearchDecider.java:148)
    at org.optaplanner.core.impl.localsearch.decider.LocalSearchDecider.decideNextStep(LocalSearchDecider.java:120)
    at org.optaplanner.core.impl.localsearch.DefaultLocalSearchPhase.solve(DefaultLocalSearchPhase.java:70)
    at org.optaplanner.core.impl.solver.AbstractSolver.runPhases(AbstractSolver.java:87)
    at org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:167)
4

0 回答 0