Repository navigation
docs: [docs-drift] nearby-multiple-matrices - #2878
Open
timefold-automations[bot] wants to merge 1 commit into
Open
timefold-automations[bot] wants to merge 1 commit into
timefold-automations[bot] wants to merge 1 commit into
Conversation
TimefoldAI/timefold-solver-enterprise#974 ranks list change and sub-list change candidates by the trip from the neighbor value to the moved item, instead of the trip from the moved item to the neighbor.
timefold-automations
Bot
requested review from
TomCools,
rsynek and
triceo
as code owners
December 4, 2026 15:06
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merged group: TimefoldAI/timefold-solver-enterprise#974 by triceo. The Community Edition counterpart is #2842, also by triceo. It is on the same branch and already merged. It added the section "Several distance matrices" and the upgrade note "Nearby selection also measures the trip back".
Finding 1: list change and sub-list change rank by the trip back only
The code change:
TimefoldAI/timefold-solver-enterprise,core/src/main/java/ai/timefold/solver/enterprise/core/nearby/list/ListNearbyDistanceMatrixDemand.java(newgetRanking()returnsNearbyRanking.CHANGE_LEG) and.../nearby/list/SubListNearbyDistanceMatrixDemand.java(same).NearbyRanking.CHANGE_LEGis defined in.../nearby/common/NearbyRanking.java. Kind: changed behaviour. Before this PR,ListVariableNearbyDistanceMatrix.addAllDestinations()ranked each destination bygetNearbyDistance(origin, destination). Now list change and sub-list change rank a value destination bygetNearbyDistance(destination, origin), which is only the trip from the neighbor to the moved item. A vehicle destination still uses moved item to vehicle. Basic change keepsORIGIN_TO_DESTINATION. Swaps and k-opt use both directions (SWAP_LEGS).The docs location:
docs/src/modules/ROOT/pages/optimization-algorithms/move-selector-reference.adoc:842: "Where a move also needs the trip back, the solver calls the meter with the neighbor as the moved item."docs/src/modules/ROOT/pages/upgrading-timefold-solver/upgrade-to-latest.adoc:99: "Nearby selection now also measures the trip back…"Both sentences say the trip back is measured in addition to the trip from the moved item. For list change and sub-list change, the trip back now replaces that trip. A user with an asymmetric meter cannot learn from these pages that these moves now rank in the opposite direction.
Confidence: medium. Prose describes behaviour that changed.
What I changed: I added one sentence after each of the two sentences quoted above. Each new sentence says that a list change or sub-list change to a neighbor value measures only the trip back, because the move puts the moved item right after the neighbor.
Checked, no drift
NearbyMeterInitializationDemandallows 1 to 16 matrices and fails fast outside that range. This matches "Return a matrix count from one to 16".blockDistributionUniformDistributionProbabilityset to 0. This matches the rule in the docs.DefaultPartitionedSearchPhasenow gives each partition its ownClassInstanceCache. This matches "each partition has its own meter instance".NearbyDistanceMeteris wrapped byNearbyDistanceMeterAdapterto give one matrix. This matches "The solver calls only the three-argumentgetNearbyDistance()".minimumSubListSize: the PR removes the check that rejectedminimumSubListSizegreater than 1 together with a nearby size maximum. No docs page states that restriction, so nothing is stale.nearbyandpartitionedcode. It is not underapi/**and no docs page names it.🤖 Generated with Claude Code
Generated by Solver Docs Drift with Claude. The group is already merged, so this pull request fixes
main. It is updated when more pull requests on the same branch merge.