12.07.2015 Views

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Objective FunctionsThe objective function in Concert Technology is represented by objects of typeIloObjective. Such objects are defined by an optimization sense, an expression, and anoptional name. The objective expression is represented by an IloNumExpr. The objectivesense is represented by an object of class IloObjectiveSense and can take two values,IloObjectiveSense.Maximize or IloObjectiveSense.Minimize. The most generalconstructor for an objective function object is:IloObjective obj = cplex.objective(sense, expr, name);where sense is of type IloObjectiveSense, expr is of type IloNumExpr, and name is astring.For convenience, the methods maximize and minimize are provided to create amaximization or minimization objective respectively, without using anIloObjectiveSense parameter. Names for objective function objects are optional, so allconstructor methods come in pairs, one with and one without the name parameter.The Active ModelModeling objects, constraints and objective functions, created as explained in UsingIloModeler on page 76, are now added to the active model. The active model is the modelimplemented by the IloCplex object itself. In fact, IloModeler is an extension of theIloModel interface defining the model API. Thus, IloCplex implements IloModel, or inother words, an IloCplex object is a model. The model implemented by the IloCplexobject itself is referred to as the active model of the IloCplex object, or if there is nopossibility 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 andIloRange. Objects of classes implementing this interface can be added to an instance ofIloModel. Other IloAddable objects usable with IloCplex are IloLPMatrix,IloConversion, IloSOS1, and IloSOS2. These will be covered in the IloMPModelersection.Variables cannot be added to a model because IloNumVar is not an extension ofIloAddable. All variables used by other modeling objects (IloAddable objects) that havebeen added to a model are implicitly part of this optimization model. The explicit addition ofa variable to a model can thus be avoided.During modeling, a typical sequence of operations is to create a modeling object andimmediately add it to the active model. To facilitate this, for most constructors with a namesuch as ConstructorName, there is also a method addConstructorName whichimmediately adds the newly constructed modeling object to the active model. For example,the callIloObjective obj = cplex.addMaximize(expr);is equivalent to78 <strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!