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.
Selects a destroy and repair operator pair for each ALNS iteration.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidreset()Restores initial selection state before a solve begins.select(OperatorSelectionContext<S> context) Selects operator indices without modifying the solutions in the context.default voidupdate(OperatorSelectionFeedback<S> feedback) Receives the outcome after each iteration to update selection state.default voidvalidateOperatorCounts(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
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 operatorsrepairOperatorCount- the positive number of configured repair operators- Throws:
IllegalArgumentException- if the counts are incompatible with this selector
-