Interface IntegerCostOptimizationProblem<T extends Copyable<T>>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      int cost​(T candidate)
      Computes the cost of a candidate solution to the problem instance.
      default double costAsDouble​(T candidate)
      Computes the cost of a candidate solution to the problem instance.
      default SolutionCostPair<T> getSolutionCostPair​(T candidate)
      Computes the cost of a candidate solution to the problem instance.
      default boolean isMinCost​(int cost)
      Checks if a given cost value is equal to the minimum theoretical cost across all possible solutions to the problem instance, where lower cost implies better solution.
      default int minCost()
      A lower bound on the minimum theoretical cost across all possible solutions to the problem instance, where lower cost implies better solution.
      int value​(T candidate)
      Computes the value of the candidate solution within the usual constraints and interpretation of the problem.
    • Method Detail

      • cost

        int cost​(T candidate)
        Computes the cost of a candidate solution to the problem instance. The lower the cost, the more optimal the candidate solution.
        Parameters:
        candidate - The candidate solution to evaluate.
        Returns:
        The cost of the candidate solution. Lower cost means better solution.
      • minCost

        default int minCost()
        A lower bound on the minimum theoretical cost across all possible solutions to the problem instance, where lower cost implies better solution. The default implementation returns Integer.MIN_VALUE.
        Returns:
        A lower bound on the minimum theoretical cost of the problem instance.
      • isMinCost

        default boolean isMinCost​(int cost)
        Checks if a given cost value is equal to the minimum theoretical cost across all possible solutions to the problem instance, where lower cost implies better solution.
        Parameters:
        cost - The cost to check.
        Returns:
        true if cost is equal to the minimum theoretical cost,
      • value

        int value​(T candidate)
        Computes the value of the candidate solution within the usual constraints and interpretation of the problem.
        Parameters:
        candidate - The candidate solution to evaluate.
        Returns:
        The actual optimization value of the candidate solution.
      • getSolutionCostPair

        default SolutionCostPair<T> getSolutionCostPair​(T candidate)
        Computes the cost of a candidate solution to the problem instance. The lower the cost, the more optimal the candidate solution.

        The default implementation delegates work to the cost(T) method, which is the desired behavior in most (probably all) cases. You will not likely need to override this default behavior.

        Specified by:
        getSolutionCostPair in interface Problem<T extends Copyable<T>>
        Parameters:
        candidate - The candidate solution to evaluate.
        Returns:
        A SolutionCostPair object containing the candidate solution and the cost of that candidate solution. Lower cost means better solution.
      • costAsDouble

        default double costAsDouble​(T candidate)
        Computes the cost of a candidate solution to the problem instance. The lower the cost, the more optimal the candidate solution. Note that subinterfaces provide methods for computing the cost as more specific types (e.g., as an int).

        The default implementation delegates work to the cost(T) method. You should not need to override this default behavior.

        Specified by:
        costAsDouble in interface Problem<T extends Copyable<T>>
        Parameters:
        candidate - The candidate solution to evaluate.
        Returns:
        The cost of the candidate solution as a value of type double. Lower cost means better solution.