Class NearValueNearbyValueSelector<Solution_>
java.lang.Object
org.optaplanner.core.impl.heuristic.selector.AbstractSelector<Solution_>
org.optaplanner.core.impl.heuristic.selector.AbstractDemandEnabledSelector<Solution_>
org.optaplanner.core.impl.heuristic.selector.common.nearby.AbstractNearbySelector<Solution_,ChildSelector_,ReplayingSelector_>
org.optaplanner.core.impl.heuristic.selector.value.nearby.NearValueNearbyValueSelector<Solution_>
- All Implemented Interfaces:
Iterable<Object>
,EventListener
,IterableSelector<Solution_,
,Object> Selector<Solution_>
,EntityIndependentValueSelector<Solution_>
,ValueSelector<Solution_>
,PhaseLifecycleListener<Solution_>
,SolverLifecycleListener<Solution_>
public final class NearValueNearbyValueSelector<Solution_>
extends AbstractNearbySelector<Solution_,ChildSelector_,ReplayingSelector_>
implements EntityIndependentValueSelector<Solution_>
-
Field Summary
Fields inherited from class org.optaplanner.core.impl.heuristic.selector.common.nearby.AbstractNearbySelector
childSelector, nearbyDistanceMatrix, nearbyDistanceMeter, nearbyRandom, randomSelection, replayingSelector
Fields inherited from class org.optaplanner.core.impl.heuristic.selector.AbstractSelector
logger, phaseLifecycleSupport, workingRandom
-
Constructor Summary
ConstructorsConstructorDescriptionNearValueNearbyValueSelector
(EntityIndependentValueSelector<Solution_> childValueSelector, EntityIndependentValueSelector<Solution_> originValueSelector, NearbyDistanceMeter<?, ?> nearbyDistanceMeter, NearbyRandom nearbyRandom, boolean randomSelection) -
Method Summary
Modifier and TypeMethodDescriptionprotected MimicReplayingValueSelector<Solution_>
castReplayingSelector
(Object uncastReplayingSelector) protected AbstractNearbyDistanceMatrixDemand<?,
?, ?, ?> endingIterator
(Object entity) IfSelector.isNeverEnding()
is true, thenValueSelector.iterator(Object)
will never end.long
getSize()
A random JITSelector
withSelector.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
.long
Similar toIterableSelector.getSize()
, but requires an entity.boolean
If false, thenSelector.isNeverEnding()
is true.iterator()
Similar toIterable.iterator()
, but requires an entity.Methods inherited from class org.optaplanner.core.impl.heuristic.selector.common.nearby.AbstractNearbySelector
equals, getNearbyDistanceMatrixDemand, hashCode, isNeverEnding, phaseEnded, phaseStarted, toString
Methods inherited from class org.optaplanner.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 org.optaplanner.core.impl.heuristic.selector.IterableSelector
spliterator
Methods inherited from interface org.optaplanner.core.impl.phase.event.PhaseLifecycleListener
phaseEnded, phaseStarted, stepEnded, stepStarted
Methods inherited from interface org.optaplanner.core.impl.heuristic.selector.Selector
getCacheType, isNeverEnding
Methods inherited from interface org.optaplanner.core.impl.solver.event.SolverLifecycleListener
solvingEnded, solvingError, solvingStarted
-
Constructor Details
-
NearValueNearbyValueSelector
public NearValueNearbyValueSelector(EntityIndependentValueSelector<Solution_> childValueSelector, EntityIndependentValueSelector<Solution_> originValueSelector, NearbyDistanceMeter<?, ?> nearbyDistanceMeter, NearbyRandom nearbyRandom, boolean randomSelection)
-
-
Method Details
-
getVariableDescriptor
- Specified by:
getVariableDescriptor
in interfaceValueSelector<Solution_>
- Returns:
- never null
-
castReplayingSelector
protected MimicReplayingValueSelector<Solution_> castReplayingSelector(Object uncastReplayingSelector) - Specified by:
castReplayingSelector
in classAbstractNearbySelector<Solution_,
EntityIndependentValueSelector<Solution_>, MimicReplayingValueSelector<Solution_>>
-
createDemand
- Specified by:
createDemand
in classAbstractNearbySelector<Solution_,
EntityIndependentValueSelector<Solution_>, MimicReplayingValueSelector<Solution_>>
-
isCountable
public boolean isCountable()Description copied from interface:Selector
If false, thenSelector.isNeverEnding()
is true.- Specified by:
isCountable
in interfaceSelector<Solution_>
- Returns:
- true if all the
ValueRange
s are countable (for example a double value range between 1.2 and 1.4 is not countable)
-
getSize
Description copied from interface:ValueSelector
Similar toIterableSelector.getSize()
, but requires an entity.- Specified by:
getSize
in 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:IterableSelector
A random JITSelector
withSelector.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:
getSize
in interfaceIterableSelector<Solution_,
Object> - Returns:
- the approximate number of elements generated by this
Selector
, always>= 0
-
iterator
Description copied from interface:ValueSelector
Similar toIterable.iterator()
, but requires an entity.- Specified by:
iterator
in interfaceValueSelector<Solution_>
- Parameters:
entity
- never null- Returns:
- never null
-
iterator
-
endingIterator
Description copied from interface:ValueSelector
IfSelector.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 thisValueSelector
entirely.- Specified by:
endingIterator
in interfaceValueSelector<Solution_>
- Parameters:
entity
- never null- Returns:
- never null
- See Also:
-