Interface Solution<S extends Solution<S>>

Type Parameters:
S - the concrete solution type

public interface Solution<S extends Solution<S>>
Represents a problem-specific solution for ALNS.

The framework minimizes the objective: \(s_1\) is better than \(s_2\) when \(f(s_1) \lt f(s_2)\). For maximization, return \(f(s) = -g(s)\).

Objective and feasibility queries must not modify the solution and must reflect its current state.

  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a copy preserving this solution's state, objective value, and feasibility.
    double
    Returns the objective value to minimize.
    boolean
    Returns whether this solution satisfies the problem's feasibility constraints.
  • Method Details

    • copy

      S copy()
      Returns a copy preserving this solution's state, objective value, and feasibility.

      Mutable solution data must be independent of the original. Immutable data may be shared; fully immutable solutions may return this.

      Returns:
      a non-null copy of this solution
    • getObjectiveValue

      double getObjectiveValue()
      Returns the objective value to minimize.
      Returns:
      the objective value; must be finite for feasible solutions, while infeasible solutions may return any value, including infinities or NaN
    • isFeasible

      boolean isFeasible()
      Returns whether this solution satisfies the problem's feasibility constraints.
      Returns:
      true if all feasibility constraints are satisfied; false otherwise