Class ILPProblemImpl1
- java.lang.Object
-
- dev.nm.solver.multivariate.constrained.integer.linear.problem.ILPProblemImpl1
-
- All Implemented Interfaces:
LPProblem,IPProblem,ILPProblem,ConstrainedOptimProblem,OptimProblem
- Direct Known Subclasses:
PureILPProblem
public class ILPProblemImpl1 extends Object implements ILPProblem
This implementation is an ILP problem, in which the variables can be real or integral.
-
-
Constructor Summary
Constructors Constructor Description ILPProblemImpl1(Vector cost, LinearGreaterThanConstraints greater, LinearLessThanConstraints less, LinearEqualityConstraints equal, BoxConstraints bounds, int[] integers, double epsilon)Construct an ILP problem, in which the variables can be real or integral.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableMatrixA()Get the coefficients, A, of the greater-than-or-equal-to constraints A * x ≥ b.ImmutableMatrixAeq()Get the coefficients, Aeq, of the equality constraints Aeq * x ≥ beq.ImmutableVectorb()Get the values, b, of the greater-than-or-equal-to constraints A * x ≥ b.ImmutableVectorbeq()Get the values, beq, of the equality constraints Aeq * x ≥ beq.ImmutableVectorc()Get the objective function.intdimension()Get the number of variables.doubleepsilon()Get the threshold to check whether a variable is an integer.RealScalarFunctionf()Get the objective function.LinearEqualityConstraintsgetEqualityConstraints()Gets the equality constraints, hi(x) = 0int[]getIntegerIndices()Get the indices of the integral variables.LinearLessThanConstraintsgetLessThanConstraints()Gets the less-than-or-equal-to constraints, gi(x) ≤ 0int[]getNonIntegralIndices(double[] x)Check which elements in x do not satisfy the integral constraints.booleanisFree(int i)Check whether xi is a free variable after handling the box constraints.
-
-
-
Constructor Detail
-
ILPProblemImpl1
public ILPProblemImpl1(Vector cost, LinearGreaterThanConstraints greater, LinearLessThanConstraints less, LinearEqualityConstraints equal, BoxConstraints bounds, int[] integers, double epsilon)
Construct an ILP problem, in which the variables can be real or integral.- Parameters:
cost- the linear objective functiongreater- the greater-than-or-equal-to constraintsless- the less-than-or-equal-to constraintsequal- the equality constraintsbounds- the box constraintsintegers- the indices of the integral variablesepsilon- a precision parameter: when a number |x| ≤ ε, it is considered 0
-
-
Method Detail
-
epsilon
public double epsilon()
Description copied from interface:IPProblemGet the threshold to check whether a variable is an integer.
-
getIntegerIndices
public int[] getIntegerIndices()
Description copied from interface:IPProblemGet the indices of the integral variables.- Specified by:
getIntegerIndicesin interfaceIPProblem- Returns:
- the integral variable indices
-
getNonIntegralIndices
public int[] getNonIntegralIndices(double[] x)
Description copied from interface:IPProblemCheck which elements in x do not satisfy the integral constraints. The indices count from 1.- Specified by:
getNonIntegralIndicesin interfaceIPProblem- 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.
-
getLessThanConstraints
public LinearLessThanConstraints getLessThanConstraints()
Description copied from interface:ConstrainedOptimProblemGets the less-than-or-equal-to constraints, gi(x) ≤ 0- Specified by:
getLessThanConstraintsin interfaceConstrainedOptimProblem- Returns:
- the less-than-or-equal-to constraints
-
getEqualityConstraints
public LinearEqualityConstraints getEqualityConstraints()
Description copied from interface:ConstrainedOptimProblemGets the equality constraints, hi(x) = 0- Specified by:
getEqualityConstraintsin interfaceConstrainedOptimProblem- Returns:
- the equality constraints
-
dimension
public int dimension()
Description copied from interface:OptimProblemGet the number of variables.- Specified by:
dimensionin interfaceOptimProblem- Returns:
- the number of variables.
-
f
public RealScalarFunction f()
Description copied from interface:OptimProblemGet the objective function.- Specified by:
fin interfaceOptimProblem- Returns:
- the objective function
-
c
public ImmutableVector c()
Description copied from interface:LPProblemGet the objective function.
-
A
public ImmutableMatrix A()
Description copied from interface:LPProblemGet the coefficients, A, of the greater-than-or-equal-to constraints A * x ≥ b.
-
b
public ImmutableVector b()
Description copied from interface:LPProblemGet the values, b, of the greater-than-or-equal-to constraints A * x ≥ b.
-
Aeq
public ImmutableMatrix Aeq()
Description copied from interface:LPProblemGet the coefficients, Aeq, of the equality constraints Aeq * x ≥ beq.
-
beq
public ImmutableVector beq()
Description copied from interface:LPProblemGet the values, beq, of the equality constraints Aeq * x ≥ beq.
-
-