public interface IloRange extends IloConstraint
This is the interface for modeling objects representing ranged
constraints of the format lb <= expr <= ub.
lb and ub are double values, referred
to as the lower bound and upper bound of the ranged constraint,
and expr is an expression. Values +- infinity
can be used as bounds. This allows you to use IloRange
objects to represent more commonly used constraints:
expr == rhs, set lb = ub = rhsexpr <= rhs, set lb = -infinity and
ub = rhsexpr >= rhs, set lb = rhs and
ub = infinity
Through the selection of lb and ub, constraints
usually written as expr ~ rhs with ~ in
<=, >=, or == can also be expressed.
IloRange objects
can be constructed using a variety of methods
defined for IloModeler: addRange(), addEq(), addLe(), addGe(),
range(), eq(), le(), and ge(). The methods of
IloRange allow you to query the expressions and bounds of a
ranged constraint and to change its bounds or replace the expression. In
addition to this, the CPLEX methods
IloMPModeler.setLinearCoef() and
IloMPModeler.setLinearCoefs() allow you to edit the constraint
expression for the special case of a linear expression, as supported by
IloMPModeler. IloMPModeler is available to users
of CPLEX®.
| Modifier and Type | Method and Description |
|---|---|
void |
clearExpr()
Sets the expression of the ranged constraint to
0. |
IloNumExpr |
getExpr()
Queries the expression of the invoking
IloRange object. |
double |
getLB()
Queries the lower bound of the ranged constraints.
|
double |
getUB()
Queries the upper bound of the ranged constraints.
|
void |
setBounds(double lb,
double ub)
Sets the lower and upper bound of the ranged constraints.
|
void |
setExpr(IloNumExpr expr)
Sets the expression of the invoking
IloRange object to
expr. |
void |
setLB(double lb)
Sets the lower bound of the ranged constraints.
|
void |
setUB(double ub)
Sets the upper bound of the ranged constraints.
|
getName, setNamedouble getLB()
throws IloException
IloExceptiondouble getUB()
throws IloException
IloExceptionvoid setLB(double lb)
throws IloException
IloExceptionlb - The new lower bound of the ranged constraints.void setUB(double ub)
throws IloException
IloExceptionub - The new upper bound of the ranged constraints.void setBounds(double lb,
double ub)
throws IloException
IloExceptionlb - The new lower bound of the ranged constraints.ub - The new upper bound of the ranged constraints.IloNumExpr getExpr() throws IloException
IloRange object.IloExceptionvoid setExpr(IloNumExpr expr) throws IloException
IloRange object to
expr.IloExceptionexpr - The new expression of the ranged constraint.void clearExpr()
throws IloException
0.IloException