Class HillClimbing<S extends Solution<S>>
java.lang.Object
io.github.nhtc2005.alns.acceptance.HillClimbing<S>
- Type Parameters:
S- the solution type
- All Implemented Interfaces:
AcceptanceCriterion<S>
public final class HillClimbing<S extends Solution<S>>
extends Object
implements AcceptanceCriterion<S>
Accepts only candidates whose objective is not worse than the current solution's objective.
Acceptance requires \(f(s_{\mathrm{candidate}}) \le f(s_{\mathrm{current}})\); candidates with equal objective values are accepted. This criterion is stateless.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanshouldAccept(AcceptanceContext<S> context) Evaluates acceptance, once per iteration, including for infeasible candidates and new bests.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.nhtc2005.alns.acceptance.AcceptanceCriterion
reset
-
Constructor Details
-
HillClimbing
public HillClimbing()Creates a stateless hill-climbing criterion.
-
-
Method Details
-
shouldAccept
Description copied from interface:AcceptanceCriterionEvaluates 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.
- Specified by:
shouldAcceptin interfaceAcceptanceCriterion<S extends Solution<S>>- Parameters:
context- the non-null acceptance context- Returns:
trueto accept the candidate, subject to the solver's feasibility checks
-