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.

newPatt[i] for constraint Fill[i]; they also create the new variable with bounds at0 (zero) and at MAXCUT.IloNumColumn col = RollsUsed(1);for (IloInt i = 0; i < Fill.getSize(); ++i)col += Fill[i](newPatt[i]);IloNumVar var(col, 0, MAXCUT);(However, those lines do not appear in the example at hand.) Concert Technology offers ashortcut in the operator() for an array of range constraints. Those lines of code can becondensed into the following line:IloNumVar var(RollsUsed(1) + Fill(newPatt), 0, MAXCUT);In other words, Fill(newPatt) returns the column expression that the loop would create.You will see a similar shortcut in the example.Changing the Type of a VariableAfter the column-generation phase terminates, an integer solution to the master problemmust be found. To do so, the type of the variables must be changed from continuous tointeger.With Concert Technology, in order to change the type of a variable in a model, you actuallycreate an extractable object (an instance of IloConversion) and add that object to themodel.In the example, when the application needs to change the elements of Cut (an array ofnumeric variables) from their default type of ILOFLOAT to integer (type ILOINT), it createsan instance of IloConversion for the array Cut, and adds the conversion to the model,cutOpt, like this:cutOpt.add(IloConversion(env, Cut, ILOINT));Cut Optimization ModelHere is a summary of the initial model cutOpt:IloModel cutOpt (env);IloObjective RollsUsed = IloAdd(cutOpt, IloMinimize(env));IloRangeArray Fill = IloAdd(cutOpt,IloRangeArray(env, amount, IloInfinity));IloNumVarArray Cut(env);IloInt nWdth = size.getSize();for (j = 0; j < nWdth; j++)Cut.add(IloNumVar(RollsUsed(1) + Fill[j](int(rollWidth / size[j]))));<strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL 379

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

Saved successfully!

Ooh no, something went wrong!