예제 #1
0
 protected void configurePhase(
     AbstractPhase phase,
     int phaseIndex,
     HeuristicConfigPolicy configPolicy,
     BestSolutionRecaller bestSolutionRecaller,
     Termination solverTermination) {
   phase.setPhaseIndex(phaseIndex);
   phase.setBestSolutionRecaller(bestSolutionRecaller);
   TerminationConfig terminationConfig_ =
       terminationConfig == null ? new TerminationConfig() : terminationConfig;
   phase.setTermination(
       terminationConfig_.buildTermination(
           configPolicy, new PhaseToSolverTerminationBridge(solverTermination)));
 }
 public void phaseEnded(ConstructionHeuristicPhaseScope<Solution_> phaseScope) {
   super.phaseEnded(phaseScope);
   Solution_ newBestSolution = phaseScope.getScoreDirector().cloneWorkingSolution();
   bestSolutionRecaller.updateBestSolution(phaseScope.getSolverScope(), newBestSolution);
   entityPlacer.phaseEnded(phaseScope);
   decider.phaseEnded(phaseScope);
   phaseScope.endingNow();
   logger.info(
       "Construction Heuristic phase ({}) ended: time spent ({}), best score ({}),"
           + " score calculation speed ({}/sec), step total ({}).",
       phaseIndex,
       phaseScope.calculateSolverTimeMillisSpentUpToNow(),
       phaseScope.getBestScore(),
       phaseScope.getPhaseScoreCalculationSpeed(),
       phaseScope.getNextStepIndex());
 }
 public void stepEnded(ConstructionHeuristicStepScope<Solution_> stepScope) {
   super.stepEnded(stepScope);
   entityPlacer.stepEnded(stepScope);
   decider.stepEnded(stepScope);
   if (logger.isDebugEnabled()) {
     long timeMillisSpent = stepScope.getPhaseScope().calculateSolverTimeMillisSpentUpToNow();
     logger.debug(
         "    CH step ({}), time spent ({}), score ({}), selected move count ({}),"
             + " picked move ({}).",
         stepScope.getStepIndex(),
         timeMillisSpent,
         stepScope.getScore(),
         stepScope.getSelectedMoveCount(),
         stepScope.getStepString());
   }
 }
 @Override
 public void solvingEnded(DefaultSolverScope<Solution_> solverScope) {
   super.solvingEnded(solverScope);
   entityPlacer.solvingEnded(solverScope);
   decider.solvingEnded(solverScope);
 }
 public void stepStarted(ConstructionHeuristicStepScope<Solution_> stepScope) {
   super.stepStarted(stepScope);
   entityPlacer.stepStarted(stepScope);
   decider.stepStarted(stepScope);
 }
 public void phaseStarted(ConstructionHeuristicPhaseScope<Solution_> phaseScope) {
   super.phaseStarted(phaseScope);
   entityPlacer.phaseStarted(phaseScope);
   decider.phaseStarted(phaseScope);
 }