NO FRAMES

Class IloEnv

Definition file: ilconcert/iloenv.h
The class of environments for models or algorithms in Concert Technology.

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:

Constructor Summary
public IloEnv()
public IloEnv(IloEnvI *)
Method Summary
public IloBoolassumeStrictNumericalDivision()
public voidassumeStrictNumericalDivision(IloBool)
public voidend()
public IloExtractableI *getExtractable(IloInt)
public IloEnvI *getImpl()
public IloRandomgetRandom()
public IloNumgetTime()
public const char *getVersion()
public voidprintTime()
public voidsetDeleter(IloDeleterMode)
public voidsetNormalizer(IloBool)
public voidunsetDeleter()
Constructor Detail

IloEnv

public IloEnv()

This constructor creates an environment to manage the extractable objects in Concert Technology.


IloEnv

public IloEnv(IloEnvI * impl)

This constructor creates an environment (a handle) from its implementation object.


Method Detail

assumeStrictNumericalDivision

public IloBool assumeStrictNumericalDivision()

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.


assumeStrictNumericalDivision

public void assumeStrictNumericalDivision(IloBool val)

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.


end

public void end()

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.


getExtractable

public IloExtractableI * getExtractable(IloInt id)

This member function returns the extractable associated with the specified identifier id.


getImpl

public IloEnvI * getImpl()

This member function returns the implementation object of the invoking environment.


getRandom

public IloRandom getRandom()

Each instance of IloEnv contains a random number generator, an instance of the class IloRandom. This member function returns that IloRandom instance.


getTime

public IloNum getTime()

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.)


getVersion

public const char * getVersion()

This member function returns a string indicating the version of ILOG Concert Technology.


printTime

public void printTime()

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.)


setDeleter

public void setDeleter(IloDeleterMode mode)

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.


setNormalizer

public void setNormalizer(IloBool val)

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.


unsetDeleter

public void unsetDeleter()

This member function unsets the mode for the deletion of extractables, as described in the concept Deletion of Extractables.