docs: document nearby selection for basic variables in move selector reference#2362
docs: document nearby selection for basic variables in move selector reference#2362mvanhorn wants to merge 1 commit into
Conversation
|
|
||
| In a nutshell, when nearby selection is used in a list move selector, | ||
| `Origin_` is always a planning value (for example `Customer`) | ||
| In a nutshell, the `Origin_` type follows the selector that is mimicked by the `nearbySelection` configuration, |
There was a problem hiding this comment.
The paragraph can be simplified. I was thinking of something like this:
In a nutshell, when nearby selection is applied, the `Origin_` and `Destination_` types are determined by the relevant selectors within the `nearbySelection` configuration. For a basic variable, `Origin_` is defined by the planning entity of the nearby definition, while `Destination_` can be either a planning value or a planning entity. As for a list variable, `Origin_` is always a planning value (for example `Customer`),
but `Destination_` can be either a planning value or a planning entity.
That means that in VRP the distance meter must be able to handle both `Customer` and `Vehicle` as the `Destination_` argument:
| involving the generation of the distance matrix and sorting operations without taking advantage of the feature. | ||
| ==== | ||
|
|
||
| ==== Nearby selection with a basic variable |
There was a problem hiding this comment.
Please add a section ID so it can be referenced in the introduction paragraph when mentioning the basic variables.
| </unionMoveSelector> | ||
| ---- | ||
|
|
||
| ==== Nearby selection with a list variable |
There was a problem hiding this comment.
Please add a section ID so it can be referenced in the introduction paragraph when mentioning the list variables.
| Change with Nearby, | ||
| and Swap with Nearby. | ||
|
|
||
| For a model that mixes basic and list variables, |
There was a problem hiding this comment.
Please add the following paragraph as an [IMPORTANT] block.
| add a `nearbySelection` element in the `valueSelector` of a `changeMoveSelector` | ||
| or in the `secondaryEntitySelector` of a `swapMoveSelector`, | ||
| and use xref:optimization-algorithms/move-selector-reference.adoc#mimicSelection[mimic selection] | ||
| to specify which entity should be the origin of the distance calculation. |
There was a problem hiding this comment.
| to specify which entity should be the origin of the distance calculation. | |
| to specify which entity should be nearby the selection. |
| to specify which entity should be the origin of the distance calculation. | ||
|
|
||
| For a `changeMoveSelector`, | ||
| `Origin_` is the entity selected by the mimicking `entitySelector` |
There was a problem hiding this comment.
| `Origin_` is the entity selected by the mimicking `entitySelector` | |
| `Origin_` is the entity selected |
|
|
||
| For a `changeMoveSelector`, | ||
| `Origin_` is the entity selected by the mimicking `entitySelector` | ||
| and `Destination_` is the planning value selected by the `valueSelector`. |
There was a problem hiding this comment.
| and `Destination_` is the planning value selected by the `valueSelector`. | |
| and `Destination_` is the nearby planning value selected by the `valueSelector`. |
| `Origin_` is the entity selected by the mimicking `entitySelector` | ||
| and `Destination_` is the planning value selected by the `valueSelector`. | ||
| For a `swapMoveSelector`, | ||
| `Origin_` is the entity selected by the mimicking `entitySelector` |
There was a problem hiding this comment.
| `Origin_` is the entity selected by the mimicking `entitySelector` | |
| both `Origin_` and `Destination_` are planning entities. |
| and `Destination_` is the planning value selected by the `valueSelector`. | ||
| For a `swapMoveSelector`, | ||
| `Origin_` is the entity selected by the mimicking `entitySelector` | ||
| and `Destination_` is the other planning entity selected by the `secondaryEntitySelector`. |
There was a problem hiding this comment.
| and `Destination_` is the other planning entity selected by the `secondaryEntitySelector`. | |
| The `Destination_` is determined by the configuration setting `secondaryEntitySelector`. |
| For a `swapMoveSelector`, | ||
| `Origin_` is the entity selected by the mimicking `entitySelector` | ||
| and `Destination_` is the other planning entity selected by the `secondaryEntitySelector`. | ||
| If one distance meter is reused for both selectors, |
There was a problem hiding this comment.
| If one distance meter is reused for both selectors, |
| `Origin_` is the entity selected by the mimicking `entitySelector` | ||
| and `Destination_` is the other planning entity selected by the `secondaryEntitySelector`. | ||
| If one distance meter is reused for both selectors, | ||
| its `Destination_` type must accept both destination types. |
There was a problem hiding this comment.
| its `Destination_` type must accept both destination types. |
| <nearbyDistanceMeterClass>org.acme.schooltimetabling.domain.solver.nearby.LectureNearbyDistanceMeter</nearbyDistanceMeterClass> | ||
| </nearbySelection> | ||
| </secondaryEntitySelector> | ||
| <variableNameIncludes> |
There was a problem hiding this comment.
Let's simplify the example by removing the node variableNameIncludes.
Summary
The Move Selector Reference now documents nearby selection for basic planning variables: what origin and destination mean outside of list variables, and the advanced XML configuration for wiring
nearbySelectionintochangeMoveSelectorandswapMoveSelector. This covers the part of #2292 that stayed open after the heading fix.Why this matters
#2292 was reopened by @triceo with the note that "the nearby part was not resolved". The nearby selection section of
move-selector-reference.adoconly describedNearbyDistanceMetersemantics and XML configuration for list variables, while the surrounding text ("In a nutshell, when nearby selection is used in a list move selector, ...") implies a basic-variable counterpart that the page never had. Anyone configuring nearby selection on a basic variable model had to reverse-engineer the selector configs to find the right XML shape.Testing
nearbySelection,originEntitySelector,mimicSelectorRef,nearbyDistanceMeterClass) were checked against the selector config classes undercore/src/main/java/ai/timefold/solver/core/config/heuristic/selector/.Fixes #2292