Interface InnerScoreDirector<Solution_>

    • Method Detail

      • overwriteConstraintMatchEnabledPreference

        void overwriteConstraintMatchEnabledPreference​(boolean constraintMatchEnabledPreference)
        Parameters:
        constraintMatchEnabledPreference - false if a ScoreDirector implementation should not do ConstraintMatch tracking even if it supports it.
      • doAndProcessMove

        Score doAndProcessMove​(Move<Solution_> move,
                               boolean assertMoveScoreFromScratch)
        Parameters:
        move - never null
        assertMoveScoreFromScratch - true will hurt performance
        Returns:
        never null
      • doAndProcessMove

        void doAndProcessMove​(Move<Solution_> move,
                              boolean assertMoveScoreFromScratch,
                              Consumer<Score> moveProcessor)
        Parameters:
        move - never null
        assertMoveScoreFromScratch - true will hurt performance
        moveProcessor - never null, use this to store the score as well as call the acceptor and forager
      • isWorkingEntityListDirty

        boolean isWorkingEntityListDirty​(long expectedWorkingEntityListRevision)
        Parameters:
        expectedWorkingEntityListRevision - an
        Returns:
        true if the entityList might have a different set of instances now
      • getScoreDefinition

        ScoreDefinition getScoreDefinition()
        Returns:
        never null
      • cloneWorkingSolution

        Solution_ cloneWorkingSolution()
        Returns a planning clone of the solution, which is not a shallow clone nor a deep clone nor a partition clone.
        Returns:
        never null, planning clone
      • cloneSolution

        Solution_ cloneSolution​(Solution_ originalSolution)
        Returns a planning clone of the solution, which is not a shallow clone nor a deep clone nor a partition clone.
        Parameters:
        originalSolution - never null
        Returns:
        never null, planning clone
      • getWorkingEntityCount

        int getWorkingEntityCount()
        Returns:
        >= 0
      • getWorkingEntityList

        List<Object> getWorkingEntityList()
        Returns:
        never null: an empty list if there are none
      • getWorkingValueCount

        int getWorkingValueCount()
        Returns:
        >= 0
      • getCalculationCount

        long getCalculationCount()
        Returns:
        at least 0L
      • resetCalculationCount

        void resetCalculationCount()
      • getSupplyManager

        SupplyManager getSupplyManager()
        Returns:
        never null
      • setAllChangesWillBeUndoneBeforeStepEnds

        void setAllChangesWillBeUndoneBeforeStepEnds​(boolean allChangesWillBeUndoneBeforeStepEnds)
        Do not waste performance by propagating changes to step (or higher) mechanisms.
        Parameters:
        allChangesWillBeUndoneBeforeStepEnds - true if all changes will be undone
      • assertExpectedWorkingScore

        void assertExpectedWorkingScore​(Score expectedWorkingScore,
                                        Object completedAction)
        Asserts that if the Score is calculated for the current working solution in the current ScoreDirector (with possibly incremental calculation residue), it is equal to the parameter expectedWorkingScore.

        Used to assert that skipping ScoreDirector.calculateScore() (when the score is otherwise determined) is correct.

        Parameters:
        expectedWorkingScore - never null
        completedAction - sometimes null, when assertion fails then the completedAction's Object.toString() is included in the exception message
      • assertShadowVariablesAreNotStale

        void assertShadowVariablesAreNotStale​(Score expectedWorkingScore,
                                              Object completedAction)
        Asserts that if all VariableListeners are forcibly triggered, and therefore all shadow variables are updated if needed, that none of the shadow variables of the working solution change, Then also asserts that the Score calculated for the working solution afterwards is equal to the parameter expectedWorkingScore.

        Used to assert that the shadow variables' state is consistent with the genuine variables' state.

        Parameters:
        expectedWorkingScore - never null
        completedAction - sometimes null, when assertion fails then the completedAction's Object.toString() is included in the exception message
      • assertExpectedUndoMoveScore

        void assertExpectedUndoMoveScore​(Move move,
                                         Score beforeMoveScore)
        Asserts that if the Score is calculated for the current working solution in the current ScoreDirector (with incremental calculation residue), it is equal to the parameter beforeMoveScore.

        Furthermore, if the assert fails, a score corruption analysis might be included in the exception message.

        Parameters:
        move - never null
        beforeMoveScore - never null