Interface OperatorSelector<S extends Solution<S>>

Type Parameters:
S - the solution type
All Known Implementing Classes:
RandomOperatorSelector, RouletteWheelOperatorSelector, SegmentedRouletteWheelOperatorSelector
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface OperatorSelector<S extends Solution<S>>
Selects a destroy and repair operator pair for each ALNS iteration.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Restores initial selection state before a solve begins.
    Selects operator indices without modifying the solutions in the context.
    default void
    Receives the outcome after each iteration to update selection state.
    default void
    validateOperatorCounts(int destroyOperatorCount, int repairOperatorCount)
    Validates the operator counts when the solver is built.
  • Method Details

    • select

      Selects operator indices without modifying the solutions in the context.
      Parameters:
      context - the non-null search context
      Returns:
      a non-null selection with zero-based indices within the configured operator lists
    • update

      default void update(OperatorSelectionFeedback<S> feedback)
      Receives the outcome after each iteration to update selection state.

      The candidate solution must not be modified. The default implementation does nothing.

      Parameters:
      feedback - the non-null outcome and reward eligibility of the selected operator pair
    • reset

      default void reset()
      Restores initial selection state before a solve begins.

      The default implementation does nothing.

    • validateOperatorCounts

      default void validateOperatorCounts(int destroyOperatorCount, int repairOperatorCount)
      Validates the operator counts when the solver is built.

      Selectors with fixed counts must check that both counts match their configuration. The default implementation does nothing.

      Parameters:
      destroyOperatorCount - the positive number of configured destroy operators
      repairOperatorCount - the positive number of configured repair operators
      Throws:
      IllegalArgumentException - if the counts are incompatible with this selector