Interface StoppingCriterion<S extends Solution<S>>

Type Parameters:
S - the solution type
All Known Implementing Classes:
AnyOfStoppingCriterion, MaxIterations, MaxRuntime, NoImprovement
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 StoppingCriterion<S extends Solution<S>>
Decides whether an ALNS search should stop before the next iteration.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Restores initial state before a solve begins.
    boolean
    Checks whether the search should stop, including before the first iteration.
  • Method Details

    • shouldStop

      boolean shouldStop(StoppingContext<S> context)
      Checks whether the search should stop, including before the first iteration.

      Implementations may update their own state but must not modify solutions in the context.

      Parameters:
      context - the non-null search context
      Returns:
      true to stop; false to begin another iteration
    • reset

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

      The default implementation does nothing.