Overview | Group | Tree | Graph | Index | Concepts |
An instance of this class is an environment, managing memory and
identifiers for modeling objects. Every Concert Technology object, such as
an extractable object, a model, or an algorithm, must belong to an
environment. In C++ terms, when you construct a model (an instance of
IloModel
) or an algorithm (an instance of
IloCplex
, documented in the ILOG CPLEX Reference Manual, or
IloSolver
, documented in the ILOG Solver Reference Manual, for
example), then you must pass one instance of IloEnv
as a
parameter of that constructor.
Environment and Memory Management
An environment (an instance of IloEnv
) efficiently manages
memory allocations for the objects constructed with that environment as a
parameter. For example, when Concert Technology objects in your model are
extracted by an algorithm, those extracted objects are handled as efficiently
as possible
with respect to memory management; there is no unnecessary copying that
might cause memory explosions in your application on the part of Concert
Technology.
When your application deletes an instance of IloEnv
, Concert
Technology will automatically delete all models and algorithms depending on
that environment as well. You delete an environment by calling the member
function env.end
.
The memory allocated for Concert Technology arrays, expressions, sets, and columns is not freed until all references to these objects have terminated and the objects themselves have been deleted.
Certain classes documented in this manual, such as IloFastMutex
, are known as system classes. They do not
belong to a Concert Technology environment; in other words, an instance of
IloEnv
is not a parameter in their constructors. As a
consequence, a Concert Technology environment does not attempt to
manage their memory allocation and de-allocation; a call of
IloEnv:end
will not delete an instance of a system
class. These system classes are clearly designated in this documentation,
and the appropriate constructors and destructors for them are documented in
this manual as well.
Environment and Initialization
An instance of IloEnv
in your application initializes
certain data structures and modeling facilities for Concert Technology. For
example, IloEnv
initializes the symbolic constant
IloInfinity
.
The environment also indicates the current assumptions about normalization or the reduction of terms in linear expressions. For an explanation of this concept, see the concept Normalization: Reducing Linear Terms
Environment and Communication Streams
An instance of IloEnv
in your application initializes the
default output streams for general information, for error messages, and for
warnings.
Environment and Extractable Objects
Every extractable object in your problem must belong to an instance of
IloEnv
. In C++ terms, in the constructor of certain extractable
objects that you create, such as a constrained variable, you must pass an
instance of IloEnv
as a parameter to indicate which environment
the extractable object belongs to. An extractable object (that is, an
instance of IloExtractable
or one of its
derived subclasses) is tied throughout its lifetime to the environment where
it is created. It can be used only with extractable objects belonging to the
same environment. It can be extracted only for an algorithm attached to the
same environment.
Two different environments can not share the same extractable object.
You can extract objects from only one environment into a given algorithm. In other words, algorithms do not extract objects from two or more different environments.
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.
See Also:
IloException, IloModel, operator new
Constructor Summary | |
---|---|
public | IloEnv() |
public | IloEnv(IloEnvI *) |
Method Summary | |
---|---|
public IloBool | assumeStrictNumericalDivision() |
public void | assumeStrictNumericalDivision(IloBool) |
public void | end() |
public IloExtractableI * | getExtractable(IloInt) |
public IloEnvI * | getImpl() |
public IloRandom | getRandom() |
public IloNum | getTime() |
public const char * | getVersion() |
public void | printTime() |
public void | setDeleter(IloDeleterMode) |
public void | setNormalizer(IloBool) |
public void | unsetDeleter() |
Constructor Detail |
---|
This constructor creates an environment to manage the extractable objects in Concert Technology.
This constructor creates an environment (a handle) from its implementation object.
Method Detail |
---|
This member function checks whether the arithmetic division operator
/
is restricted to numerical division only. If it returns
IloTrue
, operator /
is restricted, and integer
division is accessible only through the IloDiv function.
If it returns IloFalse
, operator /
is not restricted.
The default value is IloTrue
.
This member function specifies whether the arithmetic division operator
/
is restricted to numerical division only. If val
is IloTrue
, operator /
is restricted, and integer
division is accessible only through the IloDiv function.
If val
is IloFalse
, operator /
is not restricted.
The default value is IloTrue
.
When you call this member function, it cleans up the invoking
environment. In other words, it deletes all the extractable objects
(instances of IloExtractable
and its
subclasses) created in that environment and frees the memory allocated for
them. It also deletes all algorithms (instances of IloAlgorithm
and its subclasses) created in that environment
and frees memory allocated for them as well, including the representations
of extractable objects extracted for those algorithms.
The memory allocated for Concert Technology arrays, expressions, sets, and columns is not freed until all references to these objects have terminated and the objects themselves have been deleted.
This member function returns the extractable associated with the
specified identifier id
.
This member function returns the implementation object of the invoking environment.
Each instance of IloEnv
contains a random number
generator, an instance of the class IloRandom
.
This member function returns that IloRandom
instance.
This member function returns the amount of time elapsed in seconds since
the construction of the invoking environment. (The member function
IloEnv::printTime
directs this information to
the output stream of the invoking environment.)
This member function returns a string indicating the version of ILOG Concert Technology.
This member function directs the output of the member function
IloEnv::getTime
to the output stream of the
invoking environment. (The member function IloEnv::getTime
accesses the elapsed time in seconds since
the creation of the invoking environment.)
This member function sets the mode for the deletion of extractables, as
described in the concept
Deletion of Extractables.
The mode can be IloLinearDeleterMode
or
IloSafeDeleterMode
.
This member function turns on or off the facilities in Concert Technology for normalizing linear expressions. Normalizing linear expressions is also known as reducing the terms of a linear expression. In this context, a linear expression that does not contain multiple terms with the same variable is said to be normalized. The concept in this manual offers examples of this idea.
When val
is IloTrue
, (the default), then
Concert Technology analyzes linear expressions to determine whether any
variable appears more than once in a given linear expression. It then
combines terms in the linear expression to eliminate any duplication of
variables. This mode may require more time during preliminary computation,
but it avoids the possibility of an assertion failing in the case of
duplicated variables in the terms of a linear expression.
When val
is IloFalse
, then Concert Technology
assumes that all linear expressions in the invoking environment have already
been processed to reduce them to their most efficient form. In other words,
Concert Technology assumes that linear expressions have been
normalized. This mode may save time during computation, but it entails the
risk that a linear 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
.
This member function unsets the mode for the deletion of extractables, as described in the concept Deletion of Extractables.