According to that two-step procedure for adding a column to a model, the following lines create the column with coefficient 1 (one) for the objective RollsUsed
and create the new variable with bounds at 0 (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 a shortcut in the operator()
for an array of range constraints. Those lines of code can be condensed 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.
There are also other ways of modifying an objective in a Concert Technology model. For example, you can call the method IloObjective::setCoef
to change a coefficient in an objective. In this example, you see this way of changing a coefficient when the application wants to find a new pattern.
ReducedCost.setCoef(Use, price);
|
You can also change the sense of an objective in Concert Technology. There are at least two ways to do so. One approach uses the method setSense
of the class IloObjective
. The other approach first removes the current objective function from the model, then uses either the function IloMinimize
or IloMaximize
to create a new objective function, and finally adds that new objective to the model.