Package io.github.nhtc2005.alns.memory
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.
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 TypeMethodDescriptionstatic <S extends Solution<S>>
VisitedSolutionTracker<S>disabled()Returns a stateless tracker that stores nothing and treats every solution as new.booleanrecordIfNew(S solution) Records a solution without modifying it and reports whether it is new to this tracker.default voidreset()Clears visit history before a solve begins.
-
Method Details
-
recordIfNew
Records a solution without modifying it and reports whether it is new to this tracker.- Parameters:
solution- the non-null solution to record- Returns:
trueif newly recorded;falseif already recorded
-
reset
default void reset()Clears visit history before a solve begins.The default implementation does nothing.
-
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
truefromrecordIfNew
-