예제 #1
0
 public void solvingEnded(DefaultSolverScope solverScope) {
   for (SolverPhase solverPhase : solverPhaseList) {
     solverPhase.solvingEnded(solverScope);
   }
   bestSolutionRecaller.solvingEnded(solverScope);
   long timeMillisSpend = solverScope.calculateTimeMillisSpend();
   if (timeMillisSpend == 0L) {
     // Avoid divide by zero exception on a fast CPU
     timeMillisSpend = 1L;
   }
   long averageCalculateCountPerSecond = solverScope.getCalculateCount() * 1000L / timeMillisSpend;
   logger.info(
       "Solving ended: time spend ({}), best score ({}), average calculate count per second ({}).",
       timeMillisSpend,
       solverScope.getBestScoreWithUninitializedPrefix(),
       averageCalculateCountPerSecond);
 }
예제 #2
0
 public void solvingStarted(DefaultSolverScope solverScope) {
   if (solverScope.getBestSolution() == null) {
     throw new IllegalStateException(
         "The planningProblem must not be null." + " Use Solver.setPlanningProblem(Solution).");
   }
   solverScope.setStartingSystemTimeMillis(System.currentTimeMillis());
   solverScope.setScoreDirector(scoreDirectorFactory.buildScoreDirector());
   solverScope.setWorkingRandom(randomFactory.createRandom());
   solverScope.setWorkingSolutionFromBestSolution();
   bestSolutionRecaller.solvingStarted(solverScope);
   for (SolverPhase solverPhase : solverPhaseList) {
     solverPhase.solvingStarted(solverScope);
   }
   logger.info(
       "Solving started: time spend ({}), score ({}), new best score ({}), random ({}).",
       solverScope.calculateTimeMillisSpend(),
       solverScope.getStartingInitializedScore(),
       solverScope.getBestScore(),
       (randomFactory != null ? randomFactory : "not fixed"));
 }
예제 #3
0
 // TODO this shouldn't change after the solve is done
 public long getTimeMillisSpend() {
   return solverScope.calculateTimeMillisSpend();
 }