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 ImmutableMatrix
A()
Get the coefficients, A, of the greater-than-or-equal-to constraints A * x ≥ b.ImmutableMatrix
Aeq()
Get the coefficients, Aeq, of the equality constraints Aeq * x ≥ beq.ImmutableVector
b()
Get the values, b, of the greater-than-or-equal-to constraints A * x ≥ b.ImmutableVector
beq()
Get the values, beq, of the equality constraints Aeq * x ≥ beq.ImmutableVector
c()
Get the objective function.int
dimension()
Get the number of variables.double
epsilon()
Get the threshold to check whether a variable is an integer.RealScalarFunction
f()
Get the objective function.LinearEqualityConstraints
getEqualityConstraints()
Gets the equality constraints, hi(x) = 0int[]
getIntegerIndices()
Get the indices of the integral variables.LinearLessThanConstraints
getLessThanConstraints()
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.boolean
isFree(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:IPProblem
Get the threshold to check whether a variable is an integer.
-
getIntegerIndices
public int[] getIntegerIndices()
Description copied from interface:IPProblem
Get the indices of the integral variables.- Specified by:
getIntegerIndices
in interfaceIPProblem
- 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 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:ConstrainedOptimProblem
Gets the less-than-or-equal-to constraints, gi(x) ≤ 0- Specified by:
getLessThanConstraints
in interfaceConstrainedOptimProblem
- Returns:
- the less-than-or-equal-to constraints
-
getEqualityConstraints
public LinearEqualityConstraints getEqualityConstraints()
Description copied from interface:ConstrainedOptimProblem
Gets the equality constraints, hi(x) = 0- Specified by:
getEqualityConstraints
in interfaceConstrainedOptimProblem
- Returns:
- the equality constraints
-
dimension
public int dimension()
Description copied from interface:OptimProblem
Get the number of variables.- Specified by:
dimension
in interfaceOptimProblem
- Returns:
- the number of variables.
-
f
public RealScalarFunction f()
Description copied from interface:OptimProblem
Get the objective function.- Specified by:
f
in interfaceOptimProblem
- Returns:
- the objective function
-
c
public ImmutableVector c()
Description copied from interface:LPProblem
Get the objective function.
-
A
public ImmutableMatrix A()
Description copied from interface:LPProblem
Get the coefficients, A, of the greater-than-or-equal-to constraints A * x ≥ b.
-
b
public ImmutableVector b()
Description copied from interface:LPProblem
Get the values, b, of the greater-than-or-equal-to constraints A * x ≥ b.
-
Aeq
public ImmutableMatrix Aeq()
Description copied from interface:LPProblem
Get the coefficients, Aeq, of the equality constraints Aeq * x ≥ beq.
-
beq
public ImmutableVector beq()
Description copied from interface:LPProblem
Get the values, beq, of the equality constraints Aeq * x ≥ beq.
-
-