Package org.optaplanner.core.impl.heuristic.selector.move

## Class AbstractMoveSelectorFactory<Solution_,​MoveSelectorConfig_ extends MoveSelectorConfig<MoveSelectorConfig_>>

- java.lang.Object
- - org.optaplanner.core.impl.AbstractFromConfigFactory<Solution_,​SelectorConfig_>
  - - org.optaplanner.core.impl.heuristic.selector.AbstractSelectorFactory<Solution_,​MoveSelectorConfig_>
    - - org.optaplanner.core.impl.heuristic.selector.move.AbstractMoveSelectorFactory<Solution_,​MoveSelectorConfig_>

- All Implemented Interfaces:
    `MoveSelectorFactory<Solution_>`
  Direct Known Subclasses:
    `CartesianProductMoveSelectorFactory`, `ChangeMoveSelectorFactory`, `KOptMoveSelectorFactory`, `MoveIteratorFactoryFactory`, `MoveListFactoryFactory`, `PillarChangeMoveSelectorFactory`, `PillarSwapMoveSelectorFactory`, `SubChainChangeMoveSelectorFactory`, `SubChainSwapMoveSelectorFactory`, `SwapMoveSelectorFactory`, `TailChainSwapMoveSelectorFactory`, `UnionMoveSelectorFactory`

      public abstract class AbstractMoveSelectorFactory<Solution_,​MoveSelectorConfig_ extends MoveSelectorConfig<MoveSelectorConfig_>>
      extends AbstractSelectorFactory<Solution_,​MoveSelectorConfig_>
      implements MoveSelectorFactory<Solution_>

- - ### Field Summary

    - ### Fields inherited from class org.optaplanner.core.impl.AbstractFromConfigFactory

      `config`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AbstractMoveSelectorFactory​(MoveSelectorConfig_ moveSelectorConfig)` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected MoveSelector<Solution_>` | `applySorting​(SelectionCacheType resolvedCacheType, SelectionOrder resolvedSelectionOrder, MoveSelector<Solution_> moveSelector)` |
    `protected abstract MoveSelector<Solution_>` | `buildBaseMoveSelector​(HeuristicConfigPolicy<Solution_> configPolicy, SelectionCacheType minimumCacheType, boolean randomSelection)` | Builds a base `MoveSelector` without any advanced capabilities (filtering, sorting, ...).
    `MoveSelector<Solution_>` | `buildMoveSelector​(HeuristicConfigPolicy<Solution_> configPolicy, SelectionCacheType minimumCacheType, SelectionOrder inheritedSelectionOrder)` | Builds `MoveSelector` from the `MoveSelectorConfig` and provided parameters.
    `protected MoveSelectorConfig<?>` | `buildUnfoldedMoveSelectorConfig​(HeuristicConfigPolicy<Solution_> configPolicy)` | To provide unfolded MoveSelectorConfig, override this method in a subclass.
    `protected boolean` | `determineBaseRandomSelection​(SelectionCacheType resolvedCacheType, SelectionOrder resolvedSelectionOrder)` |
    `protected boolean` | `isBaseInherentlyCached()` |
    `protected void` | `validateSorting​(SelectionOrder resolvedSelectionOrder)` |

    - ### Methods inherited from class org.optaplanner.core.impl.heuristic.selector.AbstractSelectorFactory

      `validateCacheTypeVersusSelectionOrder`

    - ### Methods inherited from class org.optaplanner.core.impl.AbstractFromConfigFactory

      `deduceEntityDescriptor, deduceEntityDescriptor, deduceVariableDescriptor, deduceVariableDescriptor, deduceVariableDescriptorList`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractMoveSelectorFactory

          public AbstractMoveSelectorFactory​(MoveSelectorConfig_ moveSelectorConfig)

  - ### Method Detail

    - #### buildBaseMoveSelector

          protected abstract MoveSelector<Solution_> buildBaseMoveSelector​(HeuristicConfigPolicy<Solution_> configPolicy,
                                                                           SelectionCacheType minimumCacheType,
                                                                           boolean randomSelection)

      Builds a base `MoveSelector` without any advanced capabilities (filtering, sorting, ...).
      Parameters:
        `configPolicy` - never null
        `minimumCacheType` - never null, If caching is used (different from `SelectionCacheType.JUST_IN_TIME`), then it should be at least this `SelectionCacheType` because an ancestor already uses such caching and less would be pointless.
        `randomSelection` - true is equivalent to `SelectionOrder.RANDOM`, false is equivalent to `SelectionOrder.ORIGINAL`
      Returns:
        never null

    - #### buildMoveSelector

          public MoveSelector<Solution_> buildMoveSelector​(HeuristicConfigPolicy<Solution_> configPolicy,
                                                           SelectionCacheType minimumCacheType,
                                                           SelectionOrder inheritedSelectionOrder)

      Builds `MoveSelector` from the `MoveSelectorConfig` and provided parameters.
      Specified by:
        `buildMoveSelector` in interface `MoveSelectorFactory<Solution_>`
      Parameters:
        `configPolicy` - never null
        `minimumCacheType` - never null, If caching is used (different from `SelectionCacheType.JUST_IN_TIME`), then it should be at least this `SelectionCacheType` because an ancestor already uses such caching and less would be pointless.
        `inheritedSelectionOrder` - never null
      Returns:
        never null

    - #### buildUnfoldedMoveSelectorConfig

          protected MoveSelectorConfig<?> buildUnfoldedMoveSelectorConfig​(HeuristicConfigPolicy<Solution_> configPolicy)

      To provide unfolded MoveSelectorConfig, override this method in a subclass.
      Parameters:
        `configPolicy` - never null
      Returns:
        null if no unfolding is needed

    - #### determineBaseRandomSelection

          protected boolean determineBaseRandomSelection​(SelectionCacheType resolvedCacheType,
                                                         SelectionOrder resolvedSelectionOrder)

    - #### isBaseInherentlyCached

          protected boolean isBaseInherentlyCached()

    - #### validateSorting

          protected void validateSorting​(SelectionOrder resolvedSelectionOrder)

    - #### applySorting

          protected MoveSelector<Solution_> applySorting​(SelectionCacheType resolvedCacheType,
                                                         SelectionOrder resolvedSelectionOrder,
                                                         MoveSelector<Solution_> moveSelector)