Interface VisitedSolutionTracker<S extends Solution<S>>

Type Parameters:
S - the solution type
All Known Implementing Classes:
HashSetVisitedSolutionTracker
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 VisitedSolutionTracker<S extends Solution<S>>
Tracks solution visits to support reward eligibility during an ALNS search.

The solver records the initial solution and accepted candidates. Tracking does not prevent acceptance of repeated solutions.

  • Method Summary

    Modifier and Type
    Method
    Description
    static <S extends Solution<S>>
    VisitedSolutionTracker<S>
    Returns a stateless tracker that stores nothing and treats every solution as new.
    boolean
    recordIfNew(S solution)
    Records a solution without modifying it and reports whether it is new to this tracker.
    default void
    Clears visit history before a solve begins.
  • Method Details

    • recordIfNew

      boolean recordIfNew(S solution)
      Records a solution without modifying it and reports whether it is new to this tracker.
      Parameters:
      solution - the non-null solution to record
      Returns:
      true if newly recorded; false if already recorded
    • reset

      default void reset()
      Clears visit history before a solve begins.

      The default implementation does nothing.

    • disabled

      static <S extends Solution<S>> VisitedSolutionTracker<S> disabled()
      Returns a stateless tracker that stores nothing and treats every solution as new.
      Type Parameters:
      S - the solution type
      Returns:
      a tracker that always returns true from recordIfNew