Class SolutionCostPair<T extends Copyable<T>>

    • Constructor Detail

      • SolutionCostPair

        public SolutionCostPair​(T solution,
                                int cost)
        Constructs a SolutionCostPair with integer cost.
        Parameters:
        solution - The solution.
        cost - The cost of the solution.
      • SolutionCostPair

        public SolutionCostPair​(T solution,
                                double cost)
        Constructs a SolutionCostPair with integer cost.
        Parameters:
        solution - The solution.
        cost - The cost of the solution.
    • 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.
      • 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