Class MoveSelectorConfig<C extends MoveSelectorConfig>
- java.lang.Object
-
- org.optaplanner.core.config.AbstractConfig<C>
-
- org.optaplanner.core.config.heuristic.selector.SelectorConfig<C>
-
- org.optaplanner.core.config.heuristic.selector.move.MoveSelectorConfig<C>
-
- Direct Known Subclasses:
AbstractPillarMoveSelectorConfig
,CartesianProductMoveSelectorConfig
,ChangeMoveSelectorConfig
,KOptMoveSelectorConfig
,MoveIteratorFactoryConfig
,MoveListFactoryConfig
,SubChainChangeMoveSelectorConfig
,SubChainSwapMoveSelectorConfig
,SwapMoveSelectorConfig
,TailChainSwapMoveSelectorConfig
,UnionMoveSelectorConfig
public abstract class MoveSelectorConfig<C extends MoveSelectorConfig> extends SelectorConfig<C>
General superclass forChangeMoveSelectorConfig
, etc.
-
-
Field Summary
Fields Modifier and Type Field Description protected SelectionCacheType
cacheType
protected List<Class<? extends SelectionFilter>>
filterClassList
protected Class<? extends SelectionProbabilityWeightFactory>
probabilityWeightFactoryClass
protected Long
selectedCountLimit
protected SelectionOrder
selectionOrder
protected Class<? extends SelectionSorter>
sorterClass
protected Class<? extends Comparator>
sorterComparatorClass
protected SelectionSorterOrder
sorterOrder
protected Class<? extends SelectionSorterWeightFactory>
sorterWeightFactoryClass
-
Constructor Summary
Constructors Constructor Description MoveSelectorConfig()
-
Method Summary
-
Methods inherited from class org.optaplanner.core.config.heuristic.selector.SelectorConfig
validateCacheTypeVersusSelectionOrder
-
Methods inherited from class org.optaplanner.core.config.AbstractConfig
copyConfig, deduceEntityDescriptor, deduceVariableDescriptor, deduceVariableDescriptorList, toString
-
-
-
-
Field Detail
-
cacheType
protected SelectionCacheType cacheType
-
selectionOrder
protected SelectionOrder selectionOrder
-
filterClassList
protected List<Class<? extends SelectionFilter>> filterClassList
-
sorterComparatorClass
protected Class<? extends Comparator> sorterComparatorClass
-
sorterWeightFactoryClass
protected Class<? extends SelectionSorterWeightFactory> sorterWeightFactoryClass
-
sorterOrder
protected SelectionSorterOrder sorterOrder
-
sorterClass
protected Class<? extends SelectionSorter> sorterClass
-
probabilityWeightFactoryClass
protected Class<? extends SelectionProbabilityWeightFactory> probabilityWeightFactoryClass
-
selectedCountLimit
protected Long selectedCountLimit
-
-
Method Detail
-
getCacheType
public SelectionCacheType getCacheType()
-
setCacheType
public void setCacheType(SelectionCacheType cacheType)
-
getSelectionOrder
public SelectionOrder getSelectionOrder()
-
setSelectionOrder
public void setSelectionOrder(SelectionOrder selectionOrder)
-
getFilterClassList
public List<Class<? extends SelectionFilter>> getFilterClassList()
-
setFilterClassList
public void setFilterClassList(List<Class<? extends SelectionFilter>> filterClassList)
-
getSorterComparatorClass
public Class<? extends Comparator> getSorterComparatorClass()
-
setSorterComparatorClass
public void setSorterComparatorClass(Class<? extends Comparator> sorterComparatorClass)
-
getSorterWeightFactoryClass
public Class<? extends SelectionSorterWeightFactory> getSorterWeightFactoryClass()
-
setSorterWeightFactoryClass
public void setSorterWeightFactoryClass(Class<? extends SelectionSorterWeightFactory> sorterWeightFactoryClass)
-
getSorterOrder
public SelectionSorterOrder getSorterOrder()
-
setSorterOrder
public void setSorterOrder(SelectionSorterOrder sorterOrder)
-
getSorterClass
public Class<? extends SelectionSorter> getSorterClass()
-
setSorterClass
public void setSorterClass(Class<? extends SelectionSorter> sorterClass)
-
getProbabilityWeightFactoryClass
public Class<? extends SelectionProbabilityWeightFactory> getProbabilityWeightFactoryClass()
-
setProbabilityWeightFactoryClass
public void setProbabilityWeightFactoryClass(Class<? extends SelectionProbabilityWeightFactory> probabilityWeightFactoryClass)
-
getSelectedCountLimit
public Long getSelectedCountLimit()
-
setSelectedCountLimit
public void setSelectedCountLimit(Long selectedCountLimit)
-
getFixedProbabilityWeight
public Double getFixedProbabilityWeight()
-
setFixedProbabilityWeight
public void setFixedProbabilityWeight(Double fixedProbabilityWeight)
-
withCacheType
public MoveSelectorConfig withCacheType(SelectionCacheType cacheType)
-
withSelectionOrder
public MoveSelectorConfig withSelectionOrder(SelectionOrder selectionOrder)
-
withFilterClassList
public MoveSelectorConfig withFilterClassList(List<Class<? extends SelectionFilter>> filterClassList)
-
withSorterComparatorClass
public MoveSelectorConfig withSorterComparatorClass(Class<? extends Comparator> sorterComparatorClass)
-
withSorterWeightFactoryClass
public MoveSelectorConfig withSorterWeightFactoryClass(Class<? extends SelectionSorterWeightFactory> sorterWeightFactoryClass)
-
withSorterOrder
public MoveSelectorConfig withSorterOrder(SelectionSorterOrder sorterOrder)
-
withSorterClass
public MoveSelectorConfig withSorterClass(Class<? extends SelectionSorter> sorterClass)
-
withProbabilityWeightFactoryClass
public MoveSelectorConfig withProbabilityWeightFactoryClass(Class<? extends SelectionProbabilityWeightFactory> probabilityWeightFactoryClass)
-
withSelectedCountLimit
public MoveSelectorConfig withSelectedCountLimit(Long selectedCountLimit)
-
withFixedProbabilityWeight
public MoveSelectorConfig withFixedProbabilityWeight(Double fixedProbabilityWeight)
-
buildMoveSelector
public MoveSelector buildMoveSelector(HeuristicConfigPolicy configPolicy, SelectionCacheType minimumCacheType, SelectionOrder inheritedSelectionOrder)
- 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 configPolicy)
- Parameters:
configPolicy
- never null- Returns:
- null if no unfolding is needed
-
determineBaseRandomSelection
protected boolean determineBaseRandomSelection(SelectionCacheType resolvedCacheType, SelectionOrder resolvedSelectionOrder)
-
isBaseInherentlyCached
protected boolean isBaseInherentlyCached()
-
buildBaseMoveSelector
protected abstract MoveSelector buildBaseMoveSelector(HeuristicConfigPolicy configPolicy, SelectionCacheType minimumCacheType, boolean randomSelection)
- 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
-
extractLeafMoveSelectorConfigsIntoList
public void extractLeafMoveSelectorConfigsIntoList(List<MoveSelectorConfig> leafMoveSelectorConfigList)
Gather a list of all descendantMoveSelectorConfig
s except forUnionMoveSelectorConfig
andCartesianProductMoveSelectorConfig
.- Parameters:
leafMoveSelectorConfigList
- not null
-
inherit
public C inherit(C inheritedConfig)
Description copied from class:AbstractConfig
Inherits each property of theinheritedConfig
unless that property (or a semantic alternative) is defined by this instance (which overwrites the inherited behaviour).After the inheritance, if a property on this
AbstractConfig
composition is replaced, it should not affect the inherited composition instance.- Specified by:
inherit
in classAbstractConfig<C extends MoveSelectorConfig>
- Parameters:
inheritedConfig
- never null- Returns:
- this
-
inheritFolded
public void inheritFolded(MoveSelectorConfig foldedConfig)
Does not inherit subclass properties because this class andfoldedConfig
can be of a different type.- Parameters:
foldedConfig
- never null
-
-