Class SolutionCostPair<T extends Copyable<T>>

    • Constructor Summary

      Constructors 
      Constructor Description
      SolutionCostPair​(T solution, double cost, boolean isKnownOptimal)
      Constructs a SolutionCostPair with integer cost.
      SolutionCostPair​(T solution, int cost, boolean isKnownOptimal)
      Constructs a SolutionCostPair with integer cost.
    • Constructor Detail

      • SolutionCostPair

        public SolutionCostPair​(T solution,
                                int cost,
                                boolean isKnownOptimal)
        Constructs a SolutionCostPair with integer cost.
        Parameters:
        solution - The solution.
        cost - The cost of the solution.
        isKnownOptimal - Pass true if this solution is known to be the optimal, and false otherwise.
      • SolutionCostPair

        public SolutionCostPair​(T solution,
                                double cost,
                                boolean isKnownOptimal)
        Constructs a SolutionCostPair with integer cost.
        Parameters:
        solution - The solution.
        cost - The cost of the solution.
        isKnownOptimal - Pass true if this solution is known to be the optimal, and false otherwise.
    • Method Detail

      • getCost

        public int getCost()
        Gets the cost contained in this solution cost pair as an int. Behavior is undefined if costs are floating-point values.
        Returns:
        the cost
      • getCostDouble

        public double getCostDouble()
        Gets the cost contained in this solution cost pair as a double.
        Returns:
        the cost of the current best solution
      • getSolution

        public T getSolution()
        Gets the solution in this solution cost pair.
        Returns:
        the solution
      • containsIntCost

        public boolean containsIntCost()
        Checks whether the cost of the solution contained in this SolutionCostPair is integer valued.
        Returns:
        true if the solution has integer valued cost, and false otherwise. If this method returns false, then the behavior of the getCost() method is undefined.
      • containsKnownOptimal

        public boolean containsKnownOptimal()
        Checks if the solution contained in this object has a cost value equal to the theoretical minimum cost for the problem instance, such as if the cost is equal to a lower bound on the cost for the problem instance.
        Returns:
        true if the solution is a known optimal, and false otherwise.
      • compareTo

        public int compareTo​(SolutionCostPair<T> other)
        Compares this SolutionCostPair with the specified SolutionCostPair for order. Returns a negative integer, zero, or a positive integer as this SolutionCostPair has a cost that is less than, equal to, or greater than the cost of the specified SolutionCostPair.
        Specified by:
        compareTo in interface Comparable<T extends Copyable<T>>
        Parameters:
        other - The other SolutionCostPair with which to compare.
        Returns:
        a negative integer, zero, or a positive integer as this SolutionCostPair has a cost that is less than, equal to, or greater than the cost of the specified SolutionCostPair