Skip to content

Comments

refactor: ScoreDirector is no longer public#2129

Merged
triceo merged 3 commits intoTimefoldAI:mainfrom
triceo:scoredirector
Feb 21, 2026
Merged

refactor: ScoreDirector is no longer public#2129
triceo merged 3 commits intoTimefoldAI:mainfrom
triceo:scoredirector

Conversation

@triceo
Copy link
Collaborator

@triceo triceo commented Feb 19, 2026

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors the ScoreDirector from public API to internal implementation as part of Timefold Solver 2.0. The changes involve moving ScoreDirector from ai.timefold.solver.core.api.score.director to ai.timefold.solver.core.impl.score.director, and introducing a new PhaseCommandContext interface to replace the direct use of ScoreDirector in the public API. This is a significant breaking change that improves API encapsulation.

Changes:

  • ScoreDirector moved from public API to internal implementation package
  • PhaseCommand interface refactored to use PhaseCommandContext instead of ScoreDirector and BooleanSupplier parameters
  • SolutionPartitioner.splitWorkingSolution() signature changed to accept Solution_ instead of ScoreDirector<Solution_>
  • Documentation updated to reflect new API patterns and remove deprecated content
  • Test domain classes updated (comparator/factory naming consistency improvements)
  • MoveDirector enhanced with new assignValuesAndAdd method and executeTemporary variants

Reviewed changes

Copilot reviewed 123 out of 123 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
core/src/main/java/ai/timefold/solver/core/impl/score/director/ScoreDirector.java Moved from api package to impl package, marked as non-public API
core/src/main/java/ai/timefold/solver/core/api/solver/phase/PhaseCommand.java Interface refactored to use PhaseCommandContext parameter
core/src/main/java/ai/timefold/solver/core/api/solver/phase/PhaseCommandContext.java New interface providing access to working solution and move execution
core/src/main/java/ai/timefold/solver/core/impl/phase/custom/DefaultPhaseCommandContext.java Implementation of PhaseCommandContext
core/src/main/java/ai/timefold/solver/core/impl/partitionedsearch/partitioner/SolutionPartitioner.java Interface updated to remove ScoreDirector dependency
core/src/main/java/ai/timefold/solver/core/impl/move/MoveDirector.java Enhanced with new assignValuesAndAdd method and executeTemporary variants
docs/src/modules/ROOT/pages/optimization-algorithms/overview.adoc Updated PhaseCommand documentation with new API
docs/src/modules/ROOT/pages/responding-to-change/responding-to-change.adoc Removed deprecated PinningFilter section, updated ProblemChange references
docs/src/modules/ROOT/pages/constraints-and-score/constraint-configuration.adoc Removed deprecated constraint configuration section
Multiple test files Updated PhaseCommand implementations to use new API, comparator/factory naming improvements
Multiple impl files Updated imports from api.score.director to impl.score.director

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 166 out of 166 changed files in this pull request and generated 2 comments.

Copy link
Contributor

@Christopher-Chianelli Christopher-Chianelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dislike renaming Rebaser to Lookup; the methods are more awkward, and I believe some changes should be made; in particular, the lookup/rebase method should not have "return null if does not exist" method, and instead I propose these two methods:

@NullMarked
interface Rebaser {
    @Nullable
    <Type_> rebase(@Nullable Type_ toRebase);
    <Type_> rebaseExisting(Type_ toRebase);
}

Both methods fail fast if toRebase does not exist in the ScoreDirector. They only differ in one accepts null (and thus return a nullable), the other does not (and thus always return non-null).

Copilot AI review requested due to automatic review settings February 20, 2026 07:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 165 out of 165 changed files in this pull request and generated no new comments.

Copy link
Contributor

@Christopher-Chianelli Christopher-Chianelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I strongly disagree with erroring on unamed package; it forces the user to put classes inside a package, making it unsuitable for defining classes in a scripting context (such as jshell). Why does this matter to us? Rest of changes LGTM.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 170 out of 170 changed files in this pull request and generated no new comments.

@sonarqubecloud
Copy link

@triceo triceo merged commit 41c117e into TimefoldAI:main Feb 21, 2026
25 of 26 checks passed
@triceo triceo deleted the scoredirector branch February 21, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants