Constructing the environment: IloEnv
The class IloEnv constructs a CPLEX environment.
An environment, that is, an instance of IloEnv is
typically the first object created in any Concert Technology application.
You construct an IloEnv object by declaring a
variable of type IloEnv . For example, to create
an environment named env , you do this:
IloEnv env;
The environment object created in a Concert Technology application
is different from the environment created in the CPLEX C library by
calling the routine CPXopenCPLEX.
The environment object is of central importance and needs to be available to the constructor of all other Concert Technology classes because (among other things) it provides optimized memory management for objects of Concert Technology classes. This provides a boost in performance compared to the memory management of the operating system.
As is the case for most Concert Technology classes, IloEnv is
a handle class. This means that the variable env is
a pointer to an implementation object, which is created at the same
time as env in the above declaration. One advantage
of using handles is that if you assign handle objects, all that is
assigned is a pointer. So the statement
IloEnv env2 = env;
creates a second handle pointing to the implementation object that env already
points to. Hence there may be an arbitrary number of IloEnv handle
objects all pointing to the same implementation object. When terminating
the Concert Technology application, the implementation object must
be destroyed as well. This must be done explicitly by the user by
calling
env.end();
for just ONE of the IloEnv handles pointing
to the implementation object to be destroyed. The call to env.end is
generally the last Concert Technology operation in an application.