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.

@FunctionalInterface public interface AcceptanceCriterion<S extends Solution<S>>
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 Type
    Method
    Description
    default void
    Restores this criterion's initial state before a solve begins.
    boolean
    Evaluates acceptance, once per iteration, including for infeasible candidates and new bests.
  • Method Details

    • shouldAccept

      boolean shouldAccept(AcceptanceContext<S> context)
      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:
      true to 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.