Class NearValueNearbyValueSelector<Solution_>
- java.lang.Object
-
- ai.timefold.solver.core.impl.heuristic.selector.AbstractSelector<Solution_>
-
- ai.timefold.solver.core.impl.heuristic.selector.AbstractDemandEnabledSelector<Solution_>
-
- ai.timefold.solver.core.impl.heuristic.selector.common.nearby.AbstractNearbySelector<Solution_,ChildSelector_,ReplayingSelector_>
-
- ai.timefold.solver.core.impl.heuristic.selector.value.nearby.NearValueNearbyValueSelector<Solution_>
-
- All Implemented Interfaces:
IterableSelector<Solution_,Object>,Selector<Solution_>,EntityIndependentValueSelector<Solution_>,ValueSelector<Solution_>,PhaseLifecycleListener<Solution_>,SolverLifecycleListener<Solution_>,Iterable<Object>,EventListener
public final class NearValueNearbyValueSelector<Solution_> extends AbstractNearbySelector<Solution_,ChildSelector_,ReplayingSelector_> implements EntityIndependentValueSelector<Solution_>
-
-
Field Summary
-
Fields inherited from class ai.timefold.solver.core.impl.heuristic.selector.common.nearby.AbstractNearbySelector
childSelector, nearbyDistanceMatrix, nearbyDistanceMeter, nearbyRandom, randomSelection, replayingSelector
-
Fields inherited from class ai.timefold.solver.core.impl.heuristic.selector.AbstractSelector
logger, phaseLifecycleSupport, workingRandom
-
-
Constructor Summary
Constructors Constructor Description NearValueNearbyValueSelector(EntityIndependentValueSelector<Solution_> childValueSelector, EntityIndependentValueSelector<Solution_> originValueSelector, NearbyDistanceMeter<?,?> nearbyDistanceMeter, NearbyRandom nearbyRandom, boolean randomSelection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MimicReplayingValueSelector<Solution_>castReplayingSelector(Object uncastReplayingSelector)protected AbstractNearbyDistanceMatrixDemand<?,?,?,?>createDemand()Iterator<Object>endingIterator(Object entity)IfSelector.isNeverEnding()is true, thenValueSelector.iterator(Object)will never end.longgetSize()A random JITSelectorwithSelector.isNeverEnding()true should return a size as if it would be able to return each distinct element only once, because the size can be used inSelectionProbabilityWeightFactory.longgetSize(Object entity)Similar toIterableSelector.getSize(), but requires an entity.GenuineVariableDescriptor<Solution_>getVariableDescriptor()booleanisCountable()If false, thenSelector.isNeverEnding()is true.Iterator<Object>iterator()Iterator<Object>iterator(Object entity)Similar toIterable.iterator(), but requires an entity.-
Methods inherited from class ai.timefold.solver.core.impl.heuristic.selector.common.nearby.AbstractNearbySelector
equals, getNearbyDistanceMatrixDemand, hashCode, isNeverEnding, phaseEnded, phaseStarted, toString
-
Methods inherited from class ai.timefold.solver.core.impl.heuristic.selector.AbstractSelector
getCacheType, solvingEnded, solvingStarted, stepEnded, stepStarted
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ai.timefold.solver.core.impl.heuristic.selector.IterableSelector
spliterator
-
Methods inherited from interface ai.timefold.solver.core.impl.phase.event.PhaseLifecycleListener
phaseEnded, phaseStarted, stepEnded, stepStarted
-
Methods inherited from interface ai.timefold.solver.core.impl.heuristic.selector.Selector
getCacheType, isNeverEnding
-
Methods inherited from interface ai.timefold.solver.core.impl.solver.event.SolverLifecycleListener
solvingEnded, solvingError, solvingStarted
-
-
-
-
Constructor Detail
-
NearValueNearbyValueSelector
public NearValueNearbyValueSelector(EntityIndependentValueSelector<Solution_> childValueSelector, EntityIndependentValueSelector<Solution_> originValueSelector, NearbyDistanceMeter<?,?> nearbyDistanceMeter, NearbyRandom nearbyRandom, boolean randomSelection)
-
-
Method Detail
-
getVariableDescriptor
public GenuineVariableDescriptor<Solution_> getVariableDescriptor()
- Specified by:
getVariableDescriptorin interfaceValueSelector<Solution_>- Returns:
- never null
-
castReplayingSelector
protected MimicReplayingValueSelector<Solution_> castReplayingSelector(Object uncastReplayingSelector)
- Specified by:
castReplayingSelectorin classAbstractNearbySelector<Solution_,EntityIndependentValueSelector<Solution_>,MimicReplayingValueSelector<Solution_>>
-
createDemand
protected AbstractNearbyDistanceMatrixDemand<?,?,?,?> createDemand()
- Specified by:
createDemandin classAbstractNearbySelector<Solution_,EntityIndependentValueSelector<Solution_>,MimicReplayingValueSelector<Solution_>>
-
isCountable
public boolean isCountable()
Description copied from interface:SelectorIf false, thenSelector.isNeverEnding()is true.- Specified by:
isCountablein interfaceSelector<Solution_>- Returns:
- true if all the
ValueRanges are countable (for example a double value range between 1.2 and 1.4 is not countable)
-
getSize
public long getSize(Object entity)
Description copied from interface:ValueSelectorSimilar toIterableSelector.getSize(), but requires an entity.- Specified by:
getSizein interfaceValueSelector<Solution_>- Parameters:
entity- never null- Returns:
- the approximate number of elements generated by this
Selector, always>= 0
-
getSize
public long getSize()
Description copied from interface:IterableSelectorA random JITSelectorwithSelector.isNeverEnding()true should return a size as if it would be able to return each distinct element only once, because the size can be used inSelectionProbabilityWeightFactory.- Specified by:
getSizein interfaceIterableSelector<Solution_,Object>- Returns:
- the approximate number of elements generated by this
Selector, always>= 0
-
iterator
public Iterator<Object> iterator(Object entity)
Description copied from interface:ValueSelectorSimilar toIterable.iterator(), but requires an entity.- Specified by:
iteratorin interfaceValueSelector<Solution_>- Parameters:
entity- never null- Returns:
- never null
-
endingIterator
public Iterator<Object> endingIterator(Object entity)
Description copied from interface:ValueSelectorIfSelector.isNeverEnding()is true, thenValueSelector.iterator(Object)will never end. This returns an endingIterator, that tries to matchValueSelector.iterator(Object)as much as possible, but return each distinct element only once and therefore it might not respect the configuration of thisValueSelectorentirely.- Specified by:
endingIteratorin interfaceValueSelector<Solution_>- Parameters:
entity- never null- Returns:
- never null
- See Also:
ValueSelector.iterator(Object)
-
-