-
Notifications
You must be signed in to change notification settings - Fork 167
chore: allow Neighborhoods and Move Selectors to coexist #1966
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
MoveAdaptersutility class and bidirectional adapter pattern (NewMoveAdapter,LegacyIteratorAdapter,NewIteratorAdapter) to enable seamless conversion between legacy and new move types - Refactored
DefaultLocalSearchPhaseFactoryto support mixed mode where neighborhoods and move selectors can be used together viaUnionMoveSelector - Added
NeighborhoodsMoveSelectorto 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.
core/src/main/java/ai/timefold/solver/core/impl/heuristic/move/NewMoveAdapter.java
Show resolved
Hide resolved
|


No description provided.