Interface AcceptanceCriterion<S extends Solution<S>>
- Type Parameters:
S- the solution type
- All Known Implementing Classes:
HillClimbing,SimulatedAnnealing
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Decides whether to accept a candidate solution during an ALNS iteration.
The solver always rejects infeasible candidates and accepts feasible candidates that improve the global best, regardless of this criterion's decision.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidreset()Restores this criterion's initial state before a solve begins.booleanshouldAccept(AcceptanceContext<S> context) Evaluates acceptance, once per iteration, including for infeasible candidates and new bests.
-
Method Details
-
shouldAccept
Evaluates acceptance, once per iteration, including for infeasible candidates and new bests.Implementations may update their own state but must not modify the solutions in the context.
- Parameters:
context- the non-null acceptance context- Returns:
trueto accept the candidate, subject to the solver's feasibility checks
-
reset
default void reset()Restores this criterion's initial state before a solve begins.The default implementation does nothing.
-