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 Details

    • HillClimbing

      public HillClimbing()
      Creates a stateless hill-climbing criterion.
  • Method Details

    • shouldAccept

      public boolean shouldAccept(AcceptanceContext<S> context)
      Description copied from interface: AcceptanceCriterion
      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.

      Specified by:
      shouldAccept in interface AcceptanceCriterion<S extends Solution<S>>
      Parameters:
      context - the non-null acceptance context
      Returns:
      true to accept the candidate, subject to the solver's feasibility checks