Package org.optaplanner.core.impl.localsearch.decider.forager

## Class AcceptedLocalSearchForager<Solution_>

- java.lang.Object
- - org.optaplanner.core.impl.solver.event.SolverLifecycleListenerAdapter<Solution_>
  - - org.optaplanner.core.impl.localsearch.event.LocalSearchPhaseLifecycleListenerAdapter<Solution_>
    - - org.optaplanner.core.impl.localsearch.decider.forager.AbstractLocalSearchForager<Solution_>
      - - org.optaplanner.core.impl.localsearch.decider.forager.AcceptedLocalSearchForager<Solution_>

- All Implemented Interfaces:
    `EventListener`, `LocalSearchForager<Solution_>`, `LocalSearchPhaseLifecycleListener<Solution_>`, `SolverLifecycleListener<Solution_>`

      public class AcceptedLocalSearchForager<Solution_>
      extends AbstractLocalSearchForager<Solution_>

  A `LocalSearchForager` which forages accepted moves and ignores unaccepted moves.
  See Also:
    `LocalSearchForager`, `Acceptor`

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected int` | `acceptedCountLimit` |
    `protected long` | `acceptedMoveCount` |
    `protected boolean` | `breakTieRandomly` |
    `protected LocalSearchMoveScope<Solution_>` | `earlyPickedMoveScope` |
    `protected FinalistPodium<Solution_>` | `finalistPodium` |
    `protected LocalSearchPickEarlyType` | `pickEarlyType` |
    `protected long` | `selectedMoveCount` |

    - ### Fields inherited from class org.optaplanner.core.impl.localsearch.decider.forager.AbstractLocalSearchForager

      `logger`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AcceptedLocalSearchForager​(FinalistPodium<Solution_> finalistPodium, LocalSearchPickEarlyType pickEarlyType, int acceptedCountLimit, boolean breakTieRandomly)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addMove​(LocalSearchMoveScope<Solution_> moveScope)` |
    `protected void` | `checkPickEarly​(LocalSearchMoveScope<Solution_> moveScope)` |
    `boolean` | `isQuitEarly()` |
    `void` | `phaseEnded​(LocalSearchPhaseScope<Solution_> phaseScope)` |
    `void` | `phaseStarted​(LocalSearchPhaseScope<Solution_> phaseScope)` |
    `LocalSearchMoveScope<Solution_>` | `pickMove​(LocalSearchStepScope<Solution_> stepScope)` |
    `void` | `solvingEnded​(SolverScope<Solution_> solverScope)` |
    `void` | `solvingStarted​(SolverScope<Solution_> solverScope)` |
    `void` | `stepEnded​(LocalSearchStepScope<Solution_> stepScope)` |
    `void` | `stepStarted​(LocalSearchStepScope<Solution_> stepScope)` |
    `boolean` | `supportsNeverEndingMoveSelector()` |
    `String` | `toString()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### finalistPodium

          protected final FinalistPodium<Solution_> finalistPodium

    - #### pickEarlyType

          protected final LocalSearchPickEarlyType pickEarlyType

    - #### acceptedCountLimit

          protected final int acceptedCountLimit

    - #### breakTieRandomly

          protected final boolean breakTieRandomly

    - #### selectedMoveCount

          protected long selectedMoveCount

    - #### acceptedMoveCount

          protected long acceptedMoveCount

    - #### earlyPickedMoveScope

          protected LocalSearchMoveScope<Solution_> earlyPickedMoveScope

  - ### Constructor Detail

    - #### AcceptedLocalSearchForager

          public AcceptedLocalSearchForager​(FinalistPodium<Solution_> finalistPodium,
                                            LocalSearchPickEarlyType pickEarlyType,
                                            int acceptedCountLimit,
                                            boolean breakTieRandomly)

  - ### Method Detail

    - #### solvingStarted

          public void solvingStarted​(SolverScope<Solution_> solverScope)

      Specified by:
        `solvingStarted` in interface `SolverLifecycleListener<Solution_>`
      Overrides:
        `solvingStarted` in class `SolverLifecycleListenerAdapter<Solution_>`

    - #### phaseStarted

          public void phaseStarted​(LocalSearchPhaseScope<Solution_> phaseScope)

      Specified by:
        `phaseStarted` in interface `LocalSearchPhaseLifecycleListener<Solution_>`
      Overrides:
        `phaseStarted` in class `LocalSearchPhaseLifecycleListenerAdapter<Solution_>`

    - #### stepStarted

          public void stepStarted​(LocalSearchStepScope<Solution_> stepScope)

      Specified by:
        `stepStarted` in interface `LocalSearchPhaseLifecycleListener<Solution_>`
      Overrides:
        `stepStarted` in class `LocalSearchPhaseLifecycleListenerAdapter<Solution_>`

    - #### supportsNeverEndingMoveSelector

          public boolean supportsNeverEndingMoveSelector()

      Returns:
        true if it can be combined with a `Selector.isNeverEnding()` that returns true.

    - #### addMove

          public void addMove​(LocalSearchMoveScope<Solution_> moveScope)

      Parameters:
        `moveScope` - never null

    - #### checkPickEarly

          protected void checkPickEarly​(LocalSearchMoveScope<Solution_> moveScope)

    - #### isQuitEarly

          public boolean isQuitEarly()

      Returns:
        true if no further moves should be selected (and evaluated) for this step.

    - #### pickMove

          public LocalSearchMoveScope<Solution_> pickMove​(LocalSearchStepScope<Solution_> stepScope)

      Parameters:
        `stepScope` - never null
      Returns:
        sometimes null, for example if no move is selected

    - #### stepEnded

          public void stepEnded​(LocalSearchStepScope<Solution_> stepScope)

      Specified by:
        `stepEnded` in interface `LocalSearchPhaseLifecycleListener<Solution_>`
      Overrides:
        `stepEnded` in class `LocalSearchPhaseLifecycleListenerAdapter<Solution_>`

    - #### phaseEnded

          public void phaseEnded​(LocalSearchPhaseScope<Solution_> phaseScope)

      Specified by:
        `phaseEnded` in interface `LocalSearchPhaseLifecycleListener<Solution_>`
      Overrides:
        `phaseEnded` in class `LocalSearchPhaseLifecycleListenerAdapter<Solution_>`

    - #### solvingEnded

          public void solvingEnded​(SolverScope<Solution_> solverScope)

      Specified by:
        `solvingEnded` in interface `SolverLifecycleListener<Solution_>`
      Overrides:
        `solvingEnded` in class `SolverLifecycleListenerAdapter<Solution_>`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`