ilog.concert
Interface IloRange


public interface IloRange
extends IloConstraint

This is the interface of 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:

for expr == rhs set lb = ub = rhs,
for expr <= rhs set lb = -infinity and ub = rhs,
and for expr >= rhs set lb = rhs and ub = infinity.

Through the selection of lb and ub, constraints usually written as expr ~ rhs with ~ in <=, >=, or == can be expressed as well. 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 ILOG CPLEX.

See Also:
IloModeler.addRange(double, IloNumExpr, double), IloModeler.addEq(IloNumExpr, double), IloModeler.addGe(IloNumExpr, double), IloModeler.addLe(IloNumExpr, double)

Method Summary
 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.
 
Methods inherited from interface ilog.concert.IloAddable
getName, setName
 

Method Detail

getLB

public double getLB()
             throws IloException
Queries the lower bound of the ranged constraints.
Returns:
The lower bound of the ranged constraints.

getUB

public double getUB()
             throws IloException
Queries the upper bound of the ranged constraints.
Returns:
The upper bound of the ranged constraints.

setLB

public void setLB(double lb)
           throws IloException
Sets the lower bound of the ranged constraints.
Parameters:
lb - The new lower bound of the ranged constraints.

setUB

public void setUB(double ub)
           throws IloException
Sets the upper bound of the ranged constraints.
Parameters:
ub - The new upper bound of the ranged constraints.

setBounds

public void setBounds(double lb,
                      double ub)
               throws IloException
Sets the lower and upper bound of the ranged constraints.
Parameters:
lb - The new lower bound of the ranged constraints.
ub - The new upper bound of the ranged constraints.

getExpr

public IloNumExpr getExpr()
                   throws IloException
Queries the expression of the invoking IloRange object.
Returns:
The expression of the ranged constraint.

setExpr

public void setExpr(IloNumExpr expr)
             throws IloException
Sets the expression of the invoking IloRange object to expr.
Parameters:
expr - The new expression of the ranged constraint.

clearExpr

public void clearExpr()
               throws IloException
Sets the expression of the ranged constraint to 0.