Overview | Group | Tree | Graph | Index | Concepts |
An instance of this class is a range in a model, that is, a constraint of the form:
lowerBound <= expression <= upperBound
You can create a range from the constructors in this class or from the arithmetic
operators on numeric variables (instances of IloNumVar
and its subclasses) or on expressions (instances of
IloExpr
and its subclasses):
operator <=
operator >=
operator ==
After you create a constraint, such as an instance of IloRange
, you
must explicitly add it to the model in order for it to be taken into account. To do so,
use the member function IloModel::add
to add the range
to a model and the member function IloAlgorithm::extract
to extract the model for an algorithm.
Most member functions in this class contain assert
statements. For an
explanation of the macro NDEBUG
(a way to turn on or turn off these
assert
statements), see the concept
Assert and NDEBUG.
What Is Extracted
All the variables (that is, instances of IloNumVar
or one of its subclasses) in the range (an instance of IloRange
) will be
extracted when an algorithm such as IloCplex
, documented in the ILOG CPLEX
Reference Manual, extracts the range.
Normalizing Linear Expressions: Reducing the Terms
Normalizing is sometimes known as reducing the terms of a linear expression.
Linear expressions consist of terms made up of constants and variables related by arithmetic operations; for example, x + 3y. In some linear expressions, a given variable may appear in more than one term, for example, x + 3y +2x. Concert Technology has more than one way of dealing with linear expressions in this respect, and you control which way Concert Technology treats linear expressions from your application.
In one mode (the default mode), Concert Technology analyzes linear expressions that
your application passes it, and attempts to reduce them so that a given variable
appears in only one term in the expression. You set this mode with the member function
IloEnv::setNormalizer(IloTrue)
.
Certain constructors and member functions in this class check this setting in the model and behave accordingly: they attempt to reduce expressions. This mode may require more time during preliminary computation, but it avoids the possibility of an assertion in some of the member functions of this class failing in the case of duplicates.
In the other mode, Concert Technology assumes that no variable appears in more than
one term in any of the linear expressions that your application passes to Concert
Technology. We call this mode assume normalized linear expressions. You set this mode
with the member function IloEnv::setNormalizer(IloFalse)
.
Certain constructors and member functions in this class check this setting in the
model and behave accordingly: they assume that no variable appears in more than one
term in an expression. This mode may save time during computation, but it entails the
risk that an expression may contain one or more variables, each of which appears in
one or more terms. This situation will cause certain assert
statements
in Concert Technology to fail if you do not compile with the flag
-DNDEBUG
.
See Also:
Constructor Summary | |
---|---|
public | IloRange() |
public | IloRange(IloRange::ImplClass *) |
public | IloRange(const IloEnv, IloNum, IloNum, const char *) |
public | IloRange(const IloEnv, IloNum, const IloNumExprArg, IloNum, const char *) |
public | IloRange(const IloEnv, const IloNumExprArg, IloNum, const char *) |
Method Summary | |
---|---|
public IloNumExprArg | getExpr() |
public IloRange::ImplClass * | getImpl() |
public IloNum | getLB() |
public IloNum | getUB() |
public IloAddValueToRange | operator()(IloNum) |
public void | setBounds(IloNum, IloNum) |
public void | setExpr(const IloNumExprArg) |
public void | setLB(IloNum) |
public void | setLinearCoef(const IloNumVar, IloNum) |
public void | setLinearCoefs(const IloNumVarArray, const IloNumArray) |
public void | setUB(IloNum) |
Inherited Methods from IloConstraint |
---|
getImpl |
Inherited Methods from IloIntExprArg |
---|
getImpl |
Inherited Methods from IloNumExprArg |
---|
getImpl |
Inherited Methods from IloExtractable |
---|
end, getEnv, getId, getImpl, getName, getObject, setName, setObject |
Constructor Detail |
---|
This constructor creates an empty range constraint. Before you use this constraint,
you must fill the range. The optional argument name
is set to 0
by default.
After you create a range constraint, you must explicitly add it to a model in order
for it to be taken into account. To do so, use the member function
IloModel::add
.
This constructor creates a range constraint from an expression (an
instance of the class IloNumExprArg
) and
its upper bound (rhs
). The default bound for rhs
is the symbolic constant IloInfinity
. The optional argument
name
is set to 0
by default.
IloEnv::setNormalizer
to
determine whether to assume the expression has already been reduced or to
reduce the expression before using it.This constructor creates a range constraint from an expression (an
instance of the class IloNumExprArg
) and
its upper bound (rhs
). Its lower bound (lhs
)
will be -IloInfinity
. The default bound for rhs
is IloInfinity
. The optional argument name
is
set to 0
by default.
IloEnv::setNormalizer
to
determine whether to assume the expression has already been reduced or to
reduce the expression before using it.Method Detail |
---|
This member function returns the expression of the invoking
IloRange
object.
This member function returns the lower bound of the invoking range.
This member function returns the upper bound of the invoking range.
This operator creates the objects needed internally to represent a range in column-wise modeling. See the concept Column-Wise Modeling for an explanation of how to use this operator in column-wise modeling.
This member function sets lb
as the lower bound and ub
as
the upper bound of the invoking range, and it creates the appropriate instance of the
undocumented class IloChange
to notify algorithms about this change of an
extractable object in the model.
setBounds
notifies Concert Technology algorithms about
this change of this invoking object.This member function sets expr
as the invoking range, and it creates
the appropriate instance of the undocumented class IloChange
to notify
algorithms about this change of an extractable object in the model.
This member function sets lb
as the lower bound of the invoking range,
and it creates the appropriate instance of the undocumented class
IloChange
to notify algorithms about this change of an extractable object
in the model.
setLB
notifies Concert Technology algorithms about
this change of this invoking object.
This member function sets value
as the linear coefficient of the
variable var
in the invoking range, and it creates the appropriate
instance of the undocumented class IloChange
to notify algorithms about
this change of an extractable object in the model.
setLinearCoef
notifies Concert Technology algorithms
about this change of this invoking object.
If you attempt to use setLinearCoef
on a non linear expression, it
will throw an exception on platforms that support C++ exceptions when exceptions are
enabled.
For each of the variables in vars
, this member function sets the
corresponding value of values
(whether integer or floating-point) as its
linear coefficient in the invoking range, and it creates the appropriate instance of
the undocumented class IloChange
to notify algorithms about this change
of an extractable object in the model.
setLinearCoefs
notifies Concert Technology algorithms
about this change of this invoking object.
If you attempt to use setLinearCoef
on a non linear expression, it will
throw an exception on platforms that support C++ exceptions when exceptions are enabled.
This member function sets ub
as the upper bound of the invoking range,
and it creates the appropriate instance of the undocumented class
IloChange
to notify algorithms about this change of an extractable object
in the model.
setUB
notifies Concert Technology algorithms about
this change of this invoking object.