Interface MoveIteratorFactory<Solution_,Move_ extends Move<Solution_>>
- Type Parameters:
Solution_
- the solution type, the class with thePlanningSolution
annotation
public interface MoveIteratorFactory<Solution_,Move_ extends Move<Solution_>>
An interface to generate an
Iterator
of custom Move
s.
For a more simple version, see MoveListFactory
.
-
Method Summary
Modifier and TypeMethodDescriptioncreateOriginalMoveIterator
(ScoreDirector<Solution_> scoreDirector) When it is called depends on the configuredSelectionCacheType
.createRandomMoveIterator
(ScoreDirector<Solution_> scoreDirector, Random workingRandom) When it is called depends on the configuredSelectionCacheType
.long
getSize
(ScoreDirector<Solution_> scoreDirector) default void
phaseEnded
(ScoreDirector<Solution_> scoreDirector) Called when the phase (for example Local Search) ends, to clean up anything cached sincephaseStarted(ScoreDirector)
.default void
phaseStarted
(ScoreDirector<Solution_> scoreDirector) Called when the phase (for example Local Search) starts.
-
Method Details
-
phaseStarted
Called when the phase (for example Local Search) starts.- Parameters:
scoreDirector
- never null
-
phaseEnded
Called when the phase (for example Local Search) ends, to clean up anything cached sincephaseStarted(ScoreDirector)
.- Parameters:
scoreDirector
- never null
-
getSize
- Parameters:
scoreDirector
- never null, theScoreDirector
which has theScoreDirector.getWorkingSolution()
of which theMove
s need to be generated- Returns:
- the approximate number of elements generated by
createOriginalMoveIterator(ScoreDirector)
- Throws:
UnsupportedOperationException
- if not supported
-
createOriginalMoveIterator
When it is called depends on the configuredSelectionCacheType
.- Parameters:
scoreDirector
- never null, theScoreDirector
which has theScoreDirector.getWorkingSolution()
of which theMove
s need to be generated- Returns:
- never null, an
Iterator
that will end sooner or later - Throws:
UnsupportedOperationException
- if onlycreateRandomMoveIterator(ScoreDirector, Random)
is supported
-
createRandomMoveIterator
Iterator<Move_> createRandomMoveIterator(ScoreDirector<Solution_> scoreDirector, Random workingRandom) When it is called depends on the configuredSelectionCacheType
.- Parameters:
scoreDirector
- never null, theScoreDirector
which has theScoreDirector.getWorkingSolution()
of which theMove
s need to be generatedworkingRandom
- never null, theRandom
to use when any random number is needed, soEnvironmentMode.REPRODUCIBLE
works correctly- Returns:
- never null, an
Iterator
that is allowed (or even presumed) to be never ending - Throws:
UnsupportedOperationException
- if onlycreateOriginalMoveIterator(ScoreDirector)
is supported
-