ILOG CPLEX 11.0 User's Manual > Languages and APIs > ILOG Concert Technology for Java Users > Modeling an Optimization Problem with Concert Technology > The Active Model |
The Active Model |
INDEX PREVIOUS NEXT |
Modeling objects, constraints and objective functions, created as explained in Using IloModeler, are now added to the active model. The active model is the model implemented by the IloCplex
object itself. In fact, IloModeler
is an extension of the IloModel
interface defining the model API. Thus, IloCplex
implements IloModel
, or in other words, an IloCplex
object is a model. The model implemented by the IloCplex
object itself is referred to as the active model of the IloCplex
object, or if there is no possibility of confusion between several optimizers, simply as the active model.
A model is just a set of modeling objects of type IloAddable
such as IloObjective
and IloRange
. Objects of classes implementing this interface can be added to an instance of IloModel
. Other IloAddable
objects usable with IloCplex
are IloLPMatrix
, IloConversion
, IloSOS1
, and IloSOS2.
These will be covered in the IloMPModeler
section.
Variables cannot be added to a model because IloNumVar
is not an extension of IloAddable
. All variables used by other modeling objects (IloAddable
objects) that have been added to a model are implicitly part of this optimization model. The explicit addition of a variable to a model can thus be avoided.
During modeling, a typical sequence of operations is to create a modeling object and immediately add it to the active model. To facilitate this, for most constructors with a name such as ConstructorName, there is also a method add
ConstructorName which immediately adds the newly constructed modeling object to the active model. For example, the call
IloObjective obj = cplex.addMaximize(expr);
is equivalent to
IloObjective obj = cplex.add(cplex.maximize(expr));
Not only do the add
ConstrucorName methods simplify the program, they are also more efficient than the two equivalent calls because an intermediate copy can be avoided.
Copyright © 1987-2007 ILOG S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |