Skip to main content
FRAMES NO FRAMES

Column-Wise Modeling in CPLEX
PREVIOUS NEXT

Concert Technology supports column-wise modeling, a technique widely used in the math programming and operations research communities to build a model column by column. In Concert Technology, creating a new column is comparable to creating a new variable and adding it to a set of constraints. You use an instance of IloNumColumn to do so. An instance of IloNumColumn allows you to specify to which constraints or other extractable objects Concert Technology should add the new variable along with its data. For example, in a linear programming problem (an LP), if the new variable will appear in some linear constraints as ranges (instances of IloRange), you need to specify the list of such constraints along with the nonzero coefficients (a value of IloNum) for each of them.

You then create a new column in your model when you create a new variable with an instance of IloNumColumn as its parameter. When you create the new variable, Concert Technology will add it along with appropriate parameters to all the extractable objects you have specified in the instance of IloNumColumn.

Instead of building an instance of IloNumColumn, as an alternative, you can use a column expression directly in the constructor of the variable. You can also use instances of IloNumColumn within column expressions.

The following undocumented classes provide the underlying mechanism for column-wise modeling:

The following operators are useful in column-wise modeling:

IloAddValueToRange operator() (IloNum value);

IloAddValueToObj operator () (IloNum value);

That is, the operator () in extractable classes, such as IloRange or IloObjective, creates descriptors of how Concert Technology should add the new, yet-to-be-created variable to the invoking extractable object.

You can use the operator + to link together the objects returned by operator () to form a column. You can then use an instance of IloNumColumn to build up column expressions within a programming loop and thus save them for later use or to pass them to functions.

Here is how to use an instance of IloNumColumn with operators from IloRange and IloObjective to create a column with a coefficient of 2 in the objective, with 10 in range1, and with 3 in range2. The example then uses that column when it creates the new variable newvar1, and it uses column expressions when it creates newvar2 and newvar3.

    IloNumColumn col = obj(2) + range1(10) + range2(3);
    IloNumVar newvar1(col);
    IloNumVar newvar2(col + range3(17));
    IloNumVar newvar3(range1(1) + range3(3));
    

In other words, given an instance obj of IloObjective and the instances range1, range2, and range3 of IloRange, those lines create the new variables newvar1, newvar2, and newvar3 and add them as linear terms to obj, range1, and range3 in the following way:

    obj: + 2*newvar1 + 2*newvar2
    range1: +10*newvar1 + 10*newvar2 + 1*newvar3
    range2: + 3*newvar1 + 3*newvar2
    range3: + 17*newvar2 +3*newvar3
    

For more information, refer to the documentation of IloNumColumn,IloObjective, and IloRange.

PREVIOUS NEXT