Annotation Interface PlanningPinToIndex
Specifies that an
int property (or field) of a PlanningEntity determines
how far a PlanningListVariable is pinned.
This annotation can only be specified on a field of the same entity,
which also specifies a PlanningListVariable.
The annotated int field has the following semantics:
- 0: Pinning is disabled. All the values in the list can be removed, new values may be added anywhere in the list, values in the list may be reordered.
- Positive int: Values before this index in the list are pinned. No value can be added at those indexes, removed from them, or shuffled between them. Values on or after this index are not pinned and can be added, removed or shuffled freely.
- Positive int that exceeds the lists size: fail fast.
- Negative int: fail fast.
PlanningPin instead.
The index must never change during planning; to change it, trigger a ProblemChange.
Example: Assuming a list of values [A, B, C]:
- 0 allows the entire list to be modified.
- 1 pins
A; rest of the list may be modified or added to. - 2 pins
A, B; rest of the list may be modified or added to. - 3 pins
A, B, C; the list can only be added to. - 4 fails fast as there is no such index in the list.
PlanningPin and the pin is enabled,
any value of PlanningPinToIndex is ignored.
In other words, enabling PlanningPin pins the entire list without exception.