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
,KOptListMoveSelectorFactory
,KOptMoveSelectorFactory
,ListChangeMoveSelectorFactory
,ListSwapMoveSelectorFactory
,MoveIteratorFactoryFactory
,MoveListFactoryFactory
,PillarChangeMoveSelectorFactory
,PillarSwapMoveSelectorFactory
,SubChainChangeMoveSelectorFactory
,SubChainSwapMoveSelectorFactory
,SubListChangeMoveSelectorFactory
,SubListSwapMoveSelectorFactory
,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
-
Method Summary
Modifier and TypeMethodDescriptionprotected MoveSelector<Solution_>
applySorting
(SelectionCacheType resolvedCacheType, SelectionOrder resolvedSelectionOrder, MoveSelector<Solution_> moveSelector) protected abstract MoveSelector<Solution_>
buildBaseMoveSelector
(HeuristicConfigPolicy<Solution_> configPolicy, SelectionCacheType minimumCacheType, boolean randomSelection) Builds a baseMoveSelector
without any advanced capabilities (filtering, sorting, ...).buildMoveSelector
(HeuristicConfigPolicy<Solution_> configPolicy, SelectionCacheType minimumCacheType, SelectionOrder inheritedSelectionOrder) BuildsMoveSelector
from theMoveSelectorConfig
and provided parameters.protected MoveSelectorConfig<?>
buildUnfoldedMoveSelectorConfig
(HeuristicConfigPolicy<Solution_> configPolicy) To provide unfolded MoveSelectorConfig, override this method in a subclass.protected static void
checkUnfolded
(String configPropertyName, Object configProperty) protected boolean
determineBaseRandomSelection
(SelectionCacheType resolvedCacheType, SelectionOrder resolvedSelectionOrder) protected boolean
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, deduceGenuineVariableDescriptor, deduceVariableDescriptorList, getDefaultEntitySelectorConfigForEntity, getTheOnlyEntityDescriptor, getTheOnlyVariableDescriptor, getVariableDescriptorForName
-
Constructor Details
-
AbstractMoveSelectorFactory
-
-
Method Details
-
buildBaseMoveSelector
protected abstract MoveSelector<Solution_> buildBaseMoveSelector(HeuristicConfigPolicy<Solution_> configPolicy, SelectionCacheType minimumCacheType, boolean randomSelection) Builds a baseMoveSelector
without any advanced capabilities (filtering, sorting, ...).- Parameters:
configPolicy
- never nullminimumCacheType
- never null, If caching is used (different fromSelectionCacheType.JUST_IN_TIME
), then it should be at least thisSelectionCacheType
because an ancestor already uses such caching and less would be pointless.randomSelection
- true is equivalent toSelectionOrder.RANDOM
, false is equivalent toSelectionOrder.ORIGINAL
- Returns:
- never null
-
buildMoveSelector
public MoveSelector<Solution_> buildMoveSelector(HeuristicConfigPolicy<Solution_> configPolicy, SelectionCacheType minimumCacheType, SelectionOrder inheritedSelectionOrder) BuildsMoveSelector
from theMoveSelectorConfig
and provided parameters.- Specified by:
buildMoveSelector
in interfaceMoveSelectorFactory<Solution_>
- Parameters:
configPolicy
- never nullminimumCacheType
- never null, If caching is used (different fromSelectionCacheType.JUST_IN_TIME
), then it should be at least thisSelectionCacheType
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
-
checkUnfolded
-
determineBaseRandomSelection
protected boolean determineBaseRandomSelection(SelectionCacheType resolvedCacheType, SelectionOrder resolvedSelectionOrder) -
isBaseInherentlyCached
protected boolean isBaseInherentlyCached() -
validateSorting
-
applySorting
protected MoveSelector<Solution_> applySorting(SelectionCacheType resolvedCacheType, SelectionOrder resolvedSelectionOrder, MoveSelector<Solution_> moveSelector)
-