Class IPProblemImpl1

    • Constructor Detail

      • IPProblemImpl1

        public IPProblemImpl1​(RealScalarFunction f,
                              EqualityConstraints equal,
                              LessThanConstraints less,
                              int[] integers,
                              double epsilon)
        Construct a constrained optimization problem with integral constraints.
        Parameters:
        f - the objective function to be minimized
        equal - the set of equality constraints; Use null if the set is empty.
        less - the set of less-than-or-equal-to inequality constraints; Use null if the set is empty.
        integers - the set of indices of the integral variables, counting from 1
        epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
      • IPProblemImpl1

        public IPProblemImpl1​(RealScalarFunction f,
                              EqualityConstraints equal,
                              LessThanConstraints less,
                              int[] integers)
        Construct a constrained optimization problem with integral constraints.
        Parameters:
        f - the objective function to be minimized
        equal - the set of equality constraints; Use null if the set is empty.
        less - the set of less-than-or-equal-to inequality constraints; Use null if the set is empty.
        integers - the set of indices of the integral variables, counting from 1
    • Method Detail

      • getIntegerIndices

        public int[] getIntegerIndices()
        Description copied from interface: IPProblem
        Get the indices of the integral variables.
        Specified by:
        getIntegerIndices in interface IPProblem
        Returns:
        the integral variable indices
      • getNonIntegralIndices

        public int[] getNonIntegralIndices​(double[] x)
        Description copied from interface: IPProblem
        Check which elements in x do not satisfy the integral constraints. The indices count from 1.
        Specified by:
        getNonIntegralIndices in interface IPProblem
        Parameters:
        x - an argument to the objective function
        Returns:
        the set of indices of values in x that do not satisfy the integral constraints. An int[] of length 0 indicates that all integral variables in x are integers.
      • getFirstNonIntegralIndices

        public int getFirstNonIntegralIndices​(double[] x)
        Get the index of the first integral variable whose value is not an integer, violating the integral constraints. The indices count from 1.
        Parameters:
        x - an argument to the objective function
        Returns:
        the index of the first integral variable whose value is not an integer. 0 indicates that the values of all integral variables in x are integers.
      • epsilon

        public double epsilon()
        Description copied from interface: IPProblem
        Get the threshold to check whether a variable is an integer.
        Specified by:
        epsilon in interface IPProblem
        Returns:
        the precision parameter: when a number |x| ≤ ε, it is considered 0
      • dimension

        public int dimension()
        Description copied from interface: OptimProblem
        Get the number of variables.
        Specified by:
        dimension in interface OptimProblem
        Returns:
        the number of variables.