org.optaplanner.core.impl.heuristic.selector.move.factory

## Interface MoveIteratorFactory<Solution_>

- Type Parameters:
    `Solution_` - the solution type, the class with the `PlanningSolution` annotation

      public interface MoveIteratorFactory<Solution_>

  An interface to generate an `Iterator` of custom `Move`s.

  For a more simple version, see `MoveListFactory`.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Iterator<? extends Move<Solution_>>` | `createOriginalMoveIterator(ScoreDirector<Solution_> scoreDirector)` When it is called depends on the configured `SelectionCacheType`.
    `Iterator<? extends Move<Solution_>>` | `createRandomMoveIterator(ScoreDirector<Solution_> scoreDirector, Random workingRandom)` When it is called depends on the configured `SelectionCacheType`.
    `long` | `getSize(ScoreDirector<Solution_> scoreDirector)`

- - ### Method Detail

    - #### getSize

          long getSize(ScoreDirector<Solution_> scoreDirector)

      Parameters:
        `scoreDirector` - never null, the `ScoreDirector` which has the `ScoreDirector.getWorkingSolution()` of which the `Move`s need to be generated
      Returns:
        the approximate number of elements generated by `createOriginalMoveIterator(ScoreDirector)`
      Throws:
        `UnsupportedOperationException` - if not supported

    - #### createOriginalMoveIterator

          Iterator<? extends Move<Solution_>> createOriginalMoveIterator(ScoreDirector<Solution_> scoreDirector)

      When it is called depends on the configured `SelectionCacheType`.
      Parameters:
        `scoreDirector` - never null, the `ScoreDirector` which has the `ScoreDirector.getWorkingSolution()` of which the `Move`s need to be generated
      Returns:
        never null, an `Iterator` that will end sooner or later
      Throws:
        `UnsupportedOperationException` - if only `createRandomMoveIterator(ScoreDirector, Random)` is supported

    - #### createRandomMoveIterator

          Iterator<? extends Move<Solution_>> createRandomMoveIterator(ScoreDirector<Solution_> scoreDirector,
                                                                       Random workingRandom)

      When it is called depends on the configured `SelectionCacheType`.
      Parameters:
        `scoreDirector` - never null, the `ScoreDirector` which has the `ScoreDirector.getWorkingSolution()` of which the `Move`s need to be generated
        `workingRandom` - never null, the `Random` to use when any random number is needed, so `EnvironmentMode.REPRODUCIBLE` works correctly
      Returns:
        never null, an `Iterator` that is allowed (or even presumed) to be never ending
      Throws:
        `UnsupportedOperationException` - if only `createOriginalMoveIterator(ScoreDirector)` is supported

Copyright © 2006–2021 JBoss by Red Hat. All rights reserved.