Skip to content

Conversation

@triceo
Copy link
Collaborator

@triceo triceo commented Dec 4, 2025

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 PR refactors the solver to allow the Neighborhoods API and Move Selectors API to coexist, removing the previous mutual exclusivity constraint. The implementation introduces bidirectional adapter classes to convert between legacy moves and new moves, enabling both APIs to work together seamlessly.

Key changes:

  • Introduced MoveAdapters utility class and bidirectional adapter pattern (NewMoveAdapter, LegacyIteratorAdapter, NewIteratorAdapter) to enable seamless conversion between legacy and new move types
  • Refactored DefaultLocalSearchPhaseFactory to support mixed mode where neighborhoods and move selectors can be used together via UnionMoveSelector
  • Added NeighborhoodsMoveSelector to integrate neighborhoods-based moves into the move selector framework

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
core/src/main/java/ai/timefold/solver/core/impl/heuristic/move/MoveAdapters.java New utility class providing static methods for bidirectional conversion between legacy and new move types
core/src/main/java/ai/timefold/solver/core/impl/heuristic/move/NewMoveAdapter.java New adapter to wrap new moves as legacy moves
core/src/main/java/ai/timefold/solver/core/impl/heuristic/move/NewIteratorAdapter.java New adapter to wrap new move iterators as legacy move iterators
core/src/main/java/ai/timefold/solver/core/impl/heuristic/move/LegacyIteratorAdapter.java New adapter to wrap legacy move iterators as new move iterators
core/src/main/java/ai/timefold/solver/core/impl/heuristic/move/LegacyMoveAdapter.java Refactored to use MoveAdapters utility and removed isDoable static method
core/src/main/java/ai/timefold/solver/core/impl/localsearch/DefaultLocalSearchPhaseFactory.java Removed mutual exclusivity check and added buildMixedDecider to support combining neighborhoods with move selectors
core/src/main/java/ai/timefold/solver/core/impl/neighborhood/NeighborhoodsMoveSelector.java New move selector wrapping neighborhoods-based move repository
core/src/main/java/ai/timefold/solver/core/impl/neighborhood/MoveSelectorBasedMoveRepository.java Removed move repository initialization/cleanup (now handled by NeighborhoodsMoveSelector)
core/src/main/java/ai/timefold/solver/core/impl/score/director/AbstractScoreDirector.java Added guard against double initialization of move repository
core/src/main/java/ai/timefold/solver/core/impl/localsearch/decider/LocalSearchDecider.java Updated to use MoveAdapters.isDoable() and improved error message formatting
core/src/main/java/ai/timefold/solver/core/config/localsearch/LocalSearchPhaseConfig.java Enhanced Javadoc to document that neighborhoods and move selectors can now work together
core/src/test/java/ai/timefold/solver/core/impl/solver/DefaultSolverTest.java Renamed test and changed expectation from failure to success when both APIs are used
core/src/test/java/ai/timefold/solver/core/impl/solver/MoveAsserter.java Simplified API by removing unused overloads and consolidating legacy move handling
core/src/test/java/ai/timefold/solver/core/testutil/CodeAssertable.java Updated to use MoveAdapters.extractLegacyMoveOrReturn()
Various placer and move-related classes Updated to use MoveAdapters utility methods instead of directly instantiating adapters
core/src/main/java/ai/timefold/solver/core/impl/heuristic/selector/move/factory/LegacyIteratorAdapter.java Deleted (functionality moved to MoveAdapters)
core/src/main/java/ai/timefold/solver/core/impl/heuristic/selector/move/factory/MoveIteratorFactory.java Removed adaptIterator method (functionality moved to MoveAdapters)
core/src/main/java/ai/timefold/solver/core/impl/heuristic/selector/move/composite/UnionMoveSelector.java Added getter for selectorProbabilityWeightFactory to support mixed mode validation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@triceo triceo marked this pull request as draft December 4, 2025 10:24
@triceo triceo marked this pull request as ready for review December 4, 2025 11:24
@triceo triceo requested a review from zepfred December 4, 2025 11:37
@triceo triceo linked an issue Dec 4, 2025 that may be closed by this pull request
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 4, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
63.8% Coverage on New Code (required ≥ 70%)

See analysis details on SonarQube Cloud

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.

Neighborhoods: Solver config integration

1 participant