Class ElementDestinationSelector<Solution_>

java.lang.Object
org.optaplanner.core.impl.heuristic.selector.AbstractSelector<Solution_>
org.optaplanner.core.impl.heuristic.selector.list.ElementDestinationSelector<Solution_>
Type Parameters:
Solution_ - the solution type, the class with the PlanningSolution annotation
All Implemented Interfaces:
Iterable<ElementRef>, EventListener, IterableSelector<Solution_,ElementRef>, DestinationSelector<Solution_>, Selector<Solution_>, PhaseLifecycleListener<Solution_>, SolverLifecycleListener<Solution_>

public class ElementDestinationSelector<Solution_> extends AbstractSelector<Solution_> implements DestinationSelector<Solution_>
Selects destinations for list variable change moves. The destination specifies a future position in a list variable, expressed as an ElementRef, where a moved element or subList can be inserted.

Destination completeness is achieved by using both entity and value child selectors. When an entity A is selected, the destination becomes A[0]. When a value x is selected, its current position A[i] is determined using inverse and index supplies and the destination becomes A[i + 1].

Fairness in random selection is achieved by first deciding between entity and value selector with a probability that is proportional to the entity/value ratio. The child entity and value selectors are assumed to be fair.