Class AbstractPhaseScope<Solution_>

java.lang.Object
ai.timefold.solver.core.impl.phase.scope.AbstractPhaseScope<Solution_>
Type Parameters:
Solution_ - the solution type, the class with the PlanningSolution annotation
Direct Known Subclasses:
ConstructionHeuristicPhaseScope, CustomPhaseScope, ExhaustiveSearchPhaseScope, LocalSearchPhaseScope

public abstract class AbstractPhaseScope<Solution_> extends Object
  • Field Details

    • logger

      protected final transient org.slf4j.Logger logger
    • solverScope

      protected final SolverScope<Solution_> solverScope
    • phaseIndex

      protected final int phaseIndex
    • phaseSendingBestSolutionEvents

      protected final boolean phaseSendingBestSolutionEvents
    • startingSystemTimeMillis

      protected Long startingSystemTimeMillis
    • startingScoreCalculationCount

      protected Long startingScoreCalculationCount
    • startingMoveEvaluationCount

      protected Long startingMoveEvaluationCount
    • startingScore

      protected InnerScore<?> startingScore
    • endingSystemTimeMillis

      protected Long endingSystemTimeMillis
    • endingScoreCalculationCount

      protected Long endingScoreCalculationCount
    • endingMoveEvaluationCount

      protected Long endingMoveEvaluationCount
    • childThreadsScoreCalculationCount

      protected long childThreadsScoreCalculationCount
    • bestSolutionStepIndex

      protected int bestSolutionStepIndex
  • Constructor Details

    • AbstractPhaseScope

      protected AbstractPhaseScope(SolverScope<Solution_> solverScope, int phaseIndex)
      As defined by #AbstractPhaseScope(SolverScope, int, boolean) with the phaseSendingBestSolutionEvents parameter set to true.
    • AbstractPhaseScope

      protected AbstractPhaseScope(SolverScope<Solution_> solverScope, int phaseIndex, boolean phaseSendingBestSolutionEvents)
      Parameters:
      solverScope - never null
      phaseIndex - the index of the phase, >= 0
      phaseSendingBestSolutionEvents - set to false if the phase only sends one best solution event at the end, or none at all; this is typical for construction heuristics, whose result only matters when it reached its natural end.
  • Method Details

    • getSolverScope

      public SolverScope<Solution_> getSolverScope()
    • getPhaseIndex

      public int getPhaseIndex()
    • isPhaseSendingBestSolutionEvents

      public boolean isPhaseSendingBestSolutionEvents()
    • getStartingSystemTimeMillis

      public Long getStartingSystemTimeMillis()
    • getStartingScore

      public <Score_ extends Score<Score_>> InnerScore<Score_> getStartingScore()
    • getEndingSystemTimeMillis

      public Long getEndingSystemTimeMillis()
    • getBestSolutionStepIndex

      public int getBestSolutionStepIndex()
    • setBestSolutionStepIndex

      public void setBestSolutionStepIndex(int bestSolutionStepIndex)
    • getLastCompletedStepScope

      public abstract AbstractStepScope<Solution_> getLastCompletedStepScope()
    • reset

      public void reset()
    • startingNow

      public void startingNow()
    • endingNow

      public void endingNow()
    • getSolutionDescriptor

      public SolutionDescriptor<Solution_> getSolutionDescriptor()
    • calculateSolverTimeMillisSpentUpToNow

      public long calculateSolverTimeMillisSpentUpToNow()
    • calculatePhaseTimeMillisSpentUpToNow

      public long calculatePhaseTimeMillisSpentUpToNow()
    • getPhaseTimeMillisSpent

      public long getPhaseTimeMillisSpent()
    • addChildThreadsScoreCalculationCount

      public void addChildThreadsScoreCalculationCount(long addition)
    • addMoveEvaluationCount

      public void addMoveEvaluationCount(Move<Solution_> move, long count)
    • addMoveEvaluationCountPerType

      public void addMoveEvaluationCountPerType(Move<Solution_> move, long count)
    • getPhaseScoreCalculationCount

      public long getPhaseScoreCalculationCount()
    • getPhaseMoveEvaluationCount

      public long getPhaseMoveEvaluationCount()
    • getPhaseScoreCalculationSpeed

      public long getPhaseScoreCalculationSpeed()
      Returns:
      at least 0, per second
    • getPhaseMoveEvaluationSpeed

      public long getPhaseMoveEvaluationSpeed()
      Returns:
      at least 0, per second
    • getScoreDirector

      public <Score_ extends Score<Score_>> InnerScoreDirector<Solution_,Score_> getScoreDirector()
    • setTermination

      public void setTermination(PhaseTermination<Solution_> termination)
    • getTermination

      public PhaseTermination<Solution_> getTermination()
    • getWorkingSolution

      public Solution_ getWorkingSolution()
    • getWorkingEntityCount

      public int getWorkingEntityCount()
    • calculateScore

      public <Score_ extends Score<Score_>> InnerScore<Score_> calculateScore()
    • assertExpectedWorkingScore

      public <Score_ extends Score<Score_>> void assertExpectedWorkingScore(InnerScore<Score_> expectedWorkingScore, Object completedAction)
    • assertWorkingScoreFromScratch

      public <Score_ extends Score<Score_>> void assertWorkingScoreFromScratch(InnerScore<Score_> workingScore, Object completedAction)
    • assertPredictedScoreFromScratch

      public <Score_ extends Score<Score_>> void assertPredictedScoreFromScratch(InnerScore<Score_> workingScore, Object completedAction)
    • assertShadowVariablesAreNotStale

      public <Score_ extends Score<Score_>> void assertShadowVariablesAreNotStale(InnerScore<Score_> workingScore, Object completedAction)
    • getWorkingRandom

      public Random getWorkingRandom()
    • isBestSolutionInitialized

      public boolean isBestSolutionInitialized()
    • getBestScore

      public <Score_ extends Score<Score_>> InnerScore<Score_> getBestScore()
    • getPhaseBestSolutionTimeMillis

      public long getPhaseBestSolutionTimeMillis()
    • getNextStepIndex

      public int getNextStepIndex()
    • toString

      public String toString()
      Overrides:
      toString in class Object