From a5ab4794fdb333574cfef0165f777f5281e6e216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Petrovick=C3=BD?= Date: Wed, 16 Oct 2024 16:38:40 +0200 Subject: [PATCH 1/2] chore: adapt to Move refactor upstream --- .../micro/scoredirector/problems/AbstractProblem.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/ai/timefold/solver/benchmarks/micro/scoredirector/problems/AbstractProblem.java b/src/main/java/ai/timefold/solver/benchmarks/micro/scoredirector/problems/AbstractProblem.java index 9f299c55..0ad5f1d1 100644 --- a/src/main/java/ai/timefold/solver/benchmarks/micro/scoredirector/problems/AbstractProblem.java +++ b/src/main/java/ai/timefold/solver/benchmarks/micro/scoredirector/problems/AbstractProblem.java @@ -20,6 +20,7 @@ import ai.timefold.solver.core.impl.localsearch.decider.LocalSearchDecider; import ai.timefold.solver.core.impl.localsearch.scope.LocalSearchPhaseScope; import ai.timefold.solver.core.impl.localsearch.scope.LocalSearchStepScope; +import ai.timefold.solver.core.impl.move.director.MoveDirector; import ai.timefold.solver.core.impl.score.director.InnerScoreDirector; import ai.timefold.solver.core.impl.score.director.InnerScoreDirectorFactory; import ai.timefold.solver.core.impl.solver.DefaultSolver; @@ -35,6 +36,7 @@ abstract class AbstractProblem implements Problem { private final InnerScoreDirectorFactory scoreDirectorFactory; private final Solution_ originalSolution; + private MoveDirector moveDirector; private InnerScoreDirector scoreDirector; private MoveSelector moveSelector; private Iterator> moveIterator; @@ -104,6 +106,7 @@ public final void setupIteration() { scoreDirector.setWorkingSolution(scoreDirector.cloneSolution(originalSolution)); // Use fresh solution again. scoreDirector.triggerVariableListeners(); scoreDirector.calculateScore(); + moveDirector = new MoveDirector<>(scoreDirector); // Prepare the lifecycle. var solverScope = new SolverScope(); solverScope.setScoreDirector(scoreDirector); @@ -146,10 +149,14 @@ public final void setupInvocation() { */ @Override public final Object runInvocation() { + var scoreDirector = (InnerScoreDirector) moveDirector.getScoreDirector(); if (willUndo) { - move = move.doMove(scoreDirector); // Do the move and prepare undo. + try (var ephemeralMoveDirector = moveDirector.ephemeral()) { + move.doMoveOnly(ephemeralMoveDirector.getScoreDirector()); + } + } else { + move.doMoveOnly(scoreDirector); // Do the move without any undo. } - move.doMoveOnly(scoreDirector); // Run either the original move, or the undo. return scoreDirector.calculateScore(); } From 4c75200bc5ee960edc95a0418b99bc3cd9306135 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 18:39:02 +0000 Subject: [PATCH 2/2] chore(deps): bump org.apache.maven.plugins:maven-surefire-plugin Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.5.1 to 3.5.2. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.5.1...surefire-3.5.2) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-surefire-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fabbe13d..1429d2f7 100644 --- a/pom.xml +++ b/pom.xml @@ -202,7 +202,7 @@ maven-surefire-plugin - 3.5.1 + 3.5.2 com.diffplug.spotless