Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: adapt to latest changes in the solver #31

Merged
merged 3 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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.constraint.ConstraintMatchPolicy;
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;
Expand Down Expand Up @@ -102,7 +103,8 @@ public final void setupTrial() {
public final void setupIteration() {
// We only care about incremental performance; therefore calculate the entire solution outside of invocation.
scoreDirector = scoreDirectorFactory.buildScoreDirector(false,
scoreDirectorType == ScoreDirectorType.CONSTRAINT_STREAMS_JUSTIFIED);
scoreDirectorType == ScoreDirectorType.CONSTRAINT_STREAMS_JUSTIFIED ? ConstraintMatchPolicy.ENABLED
: ConstraintMatchPolicy.DISABLED);
scoreDirector.setWorkingSolution(scoreDirector.cloneSolution(originalSolution)); // Use fresh solution again.
scoreDirector.triggerVariableListeners();
scoreDirector.calculateScore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
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.score.constraint.ConstraintMatchPolicy;
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;
Expand Down Expand Up @@ -60,7 +61,7 @@ public static synchronized <Solution_> Solution_ getSolution(Example example,

private static <Solution_> Solution_ initialize(Example example, Solution_ uninitializedSolution,
InnerScoreDirectorFactory<Solution_, ?> scoreDirectorFactory) {
try (var scoreDirector = scoreDirectorFactory.buildScoreDirector(false, false)) {
try (var scoreDirector = scoreDirectorFactory.buildScoreDirector(false, ConstraintMatchPolicy.DISABLED)) {
scoreDirector.setWorkingSolution(uninitializedSolution);
scoreDirector.triggerVariableListeners();
var score = scoreDirector.calculateScore();
Expand Down
Loading