From 52f33b29f43f61d7370098107359c6ef7149c0d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Petrovick=C3=BD?= Date: Tue, 26 Mar 2024 10:28:44 +0100 Subject: [PATCH] Basic unimproved termination --- .../problems/ProblemInitializer.java | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/src/main/java/ai/timefold/solver/benchmarks/micro/scoredirector/problems/ProblemInitializer.java b/src/main/java/ai/timefold/solver/benchmarks/micro/scoredirector/problems/ProblemInitializer.java index 86a6d4f2..c9bafdba 100644 --- a/src/main/java/ai/timefold/solver/benchmarks/micro/scoredirector/problems/ProblemInitializer.java +++ b/src/main/java/ai/timefold/solver/benchmarks/micro/scoredirector/problems/ProblemInitializer.java @@ -22,7 +22,6 @@ import ai.timefold.solver.core.impl.constructionheuristic.DefaultConstructionHeuristicPhaseFactory; import ai.timefold.solver.core.impl.domain.solution.descriptor.SolutionDescriptor; import ai.timefold.solver.core.impl.heuristic.HeuristicConfigPolicy; -import ai.timefold.solver.core.impl.phase.scope.AbstractPhaseScope; import ai.timefold.solver.core.impl.score.director.InnerScoreDirectorFactory; import ai.timefold.solver.core.impl.solver.ClassInstanceCache; import ai.timefold.solver.core.impl.solver.DefaultSolver; @@ -30,7 +29,6 @@ import ai.timefold.solver.core.impl.solver.random.DefaultRandomFactory; import ai.timefold.solver.core.impl.solver.recaller.BestSolutionRecallerFactory; import ai.timefold.solver.core.impl.solver.scope.SolverScope; -import ai.timefold.solver.core.impl.solver.termination.AbstractTermination; import ai.timefold.solver.core.impl.solver.termination.BasicPlumbingTermination; import ai.timefold.solver.core.impl.solver.termination.TerminationFactory; @@ -94,8 +92,8 @@ null, null, null, null, new Random(0), scoreDirectorFactory.getInitializingScore solverScope.setSolverMetricSet(EnumSet.noneOf(SolverMetric.class)); solverScope.startingNow(); var solver = new DefaultSolver<>(EnvironmentMode.REPRODUCIBLE, new DefaultRandomFactory(RandomType.JDK, 0L), - bestSolutionRecaller, null, new NoopTermination<>(), List.of(constructionHeuristicPhase), solverScope, - null); + bestSolutionRecaller, null, new BasicPlumbingTermination<>(false), List.of(constructionHeuristicPhase), + solverScope, null); constructionHeuristicPhase.setSolver(solver); // Start the construction heuristic. @@ -113,25 +111,4 @@ null, null, null, null, new Random(0), scoreDirectorFactory.getInitializingScore } } - private static final class NoopTermination extends AbstractTermination { - @Override - public boolean isSolverTerminated(SolverScope solverScope) { - return false; - } - - @Override - public boolean isPhaseTerminated(AbstractPhaseScope phaseScope) { - return false; - } - - @Override - public double calculateSolverTimeGradient(SolverScope solverScope) { - return 0; - } - - @Override - public double calculatePhaseTimeGradient(AbstractPhaseScope phaseScope) { - return 0; - } - } }