ILOG CPLEX 11.0 User's Manual > Discrete Optimization > Using Column Generation: a Cutting Stock Example > Developing the Model: Building and Modifying > Adding Columns to a Model

Creating a new column to add to a model in Concert Technology is a two-step process:

  1. Create a column expression defining the new column.
  2. Create a variable using that column expression and add the variable to the model.

For example, in this problem, RollsUsed is an instance of IloObjective. The statement RollsUsed(1) creates a term in a column expression defining how to add a new variable as a linear term with a coefficient of 1 (one) to the expression RollsUsed.

The terms of a column expression are connected to one another by the overloaded operator +.

The master model is initialized with one variable for each size. Each such variable represents the pattern of cutting a roll into as many strips of that size as possible. These variables are stored as they are created in the array Cut by the following loop:

IloInt nWdth = size.getSize();
for (j = 0; j < nWdth; j++)
   Cut.add(IloNumVar(RollsUsed(1) + Fill(1)(int(rollWidth / size[j]))));

Consequently, the variable Cut[j] will have an objective coefficient of 1 (one) and only one other nonzero coefficient (rollWidth/size[j]) for constraint Fill[j]. Later, in the column generation loop, new variables will be added. Those variables will have coefficients defined by the solution vectors of the subproblem stored in the array newPatt.

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 with coefficient newPatt[i] for constraint Fill[i]; they also 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.