feat: add replaceValue... methods to MutableSolutionView#2180
feat: add replaceValue... methods to MutableSolutionView#2180triceo merged 6 commits intoTimefoldAI:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR optimizes moving and swapping elements inside planning list variables in MoveDirector, aiming to reduce per-move overhead on the solver hot path.
Changes:
- Introduces a
moveInList(...)helper that selects betweenCollections.rotateandremove+addbased on move distance/position. - Updates
moveValueInList(...)to use the new helper and return the moved value via the list after mutation. - Replaces manual swap logic with
Collections.swap(...)inswapValuesInList(...).
core/src/main/java/ai/timefold/solver/core/impl/move/MoveDirector.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/move/MoveDirector.java
Outdated
Show resolved
Hide resolved
Christopher-Chianelli
left a comment
There was a problem hiding this comment.
LGTM when tests are green.
core/src/main/java/ai/timefold/solver/core/impl/move/MoveDirector.java
Outdated
Show resolved
Hide resolved
|
@Christopher-Chianelli Since I was already here, I decided to implement a feature request from the models. Please re-review, new code was added. @winklerm Was this what you had in mind? |
core/src/main/java/ai/timefold/solver/core/impl/move/MoveDirector.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/preview/api/move/MutableSolutionView.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/preview/api/move/MutableSolutionView.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/preview/api/move/MutableSolutionView.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/preview/api/move/MutableSolutionView.java
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/preview/api/move/MutableSolutionView.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/preview/api/move/MutableSolutionView.java
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/preview/api/move/MutableSolutionView.java
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/preview/api/move/MutableSolutionView.java
Outdated
Show resolved
Hide resolved
Yes, thank you very much!! |
Christopher-Chianelli
left a comment
There was a problem hiding this comment.
Code LGTM; although I think a better name can be chosen for replaceValueBetweenLists.
core/src/main/java/ai/timefold/solver/core/preview/api/move/MutableSolutionView.java
Outdated
Show resolved
Hide resolved
|



In addition to moveValue...