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.

Developing the Model: Building and ModifyingIn this problem, an initial model cutOpt is built first to represent the master model. Later,through its modifications, another model patGen is built to generate the new columns. Thatis, patGen represents the subproblem.The first model cutOpt, an instance of IloModel, is declared like this:IloModel cutOpt (env);As a model for this problem is built, there will be opportunities to demonstrate to you how tomodify a model by adding extractable objects, adding columns, changing coefficients in anobjective function, and changing the type of a variable. When you modify a model by meansof the methods of extractable objects, Concert Technology notifies the algorithms (instancesof subclasses of IloAlgorithm, such as IloCplex or IloSolver) about the modification.(For more about that idea, see the concept of Notification in the Reference <strong>Manual</strong> of theC++ API.)When IloCplex, for example, is notified about a change in an extractable object that it hasextracted, it maintains as much of the current solution information as it can accurately andreasonably. Other parts of the <strong>ILOG</strong> <strong>CPLEX</strong> User’s <strong>Manual</strong> offer more detail about how thealgorithm responds to modifications in the model.Adding Extractable Objects: Both WaysIn a Concert Technology application, there are two ways of adding extractable objects to amodel: by means of a template function (IloAdd) or by means of a method of the model(IloModel::add). In this example, you see both ways.Using a Template to Add ObjectsWhen an objective is added to the model, the application needs to keep a handle to theobjective RollsUsed because it is needed when the application generates columns. For thatpurpose, the application relies on the template function IloAdd, like this:IloObjectiveRollsUsed = IloAdd(cutOpt, IloMinimize(env));Apart from the fact that it preserves type information, that single line is equivalent to theselines:IloObjective RollsUsed = IloMinimize(env);cutOpt.add(RollsUsed);<strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL 377

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

Saved successfully!

Ooh no, something went wrong!