ilog.concert
Class IloColumnArray

java.lang.Object
  extended byilog.concert.IloColumnArray

public abstract class IloColumnArray
extends java.lang.Object

Objects of the class IloColumnArray are used to create an array of variables using column-wise modeling.

In column-wise modeling, newly constructed variables are inserted into existing modeling objects. The term column-wise comes from linear programming, where the constraints are typically represented as a matrix. Adding new variables to the optimization problem corresponds to adding columns to the constraint matrix.

This is the procedure for column-wise modeling:

Start with the set of modeling objects of these classes

to which you want to add new variables.

For each of these objects call IloMPModeler.columnArray, with the object as an argument, along with the other arguments needed to install an array of new variables in the existing modeling objects. See the documentation of IloMPModeler.columnArray for details of these parameters.

The column-array objects can then be linked to an aggregate column-array object with the method IloColumnArray.and, which will include all the individual objects. If the new variables are to be installed in only one modeling object, there is no need to use the method and.

The column-array object constructed this way is now ready to be used to create an array of new variables and install them in the existing modeling objects, as defined by the column-array object. This is done by passing the column-array object as an argument to the constructor methods for arrays of variables, for example IloMPModeler.numVarArray or IloMPModeler.intVarArray. The newly created variables will immediately be part of the existing modeling objects that have been used for constructing the column-array object.

The following example shows how to create an array of two new variables with the bounds 0(zero) and 1 (one) and how to install them in an objective and a range constraint, with linear coefficients all set to 1 (one):

  IloNumVar[] newColumns(IloMPModeler modeler, IloObjective obj, IloRange rng) {
    double[] ones = {1.0, 1.0};
    IloColumnArray objcol = modeler.columnArray(obj, ones);
    IloColumnArray rngcol = modeler.columnArray(rng, ones);
    return modeler.numVarArray(objcol.and(rngcol), 0.0, 1.0);
  }
  

See Also:
IloMPModeler.columnArray(IloObjective, double[]), IloMPModeler.columnArray(IloLPMatrix, int, int[][], double[][]), IloMPModeler.columnArray(IloRange, double[]), IloMPModeler.numVarArray(IloColumnArray, double[], double[]), IloMPModeler.intVarArray(IloColumnArray, int[], int[]), IloMPModeler.semiContVarArray(IloColumnArray, double[], double[], IloNumVarType[])

Nested Class Summary
static class IloColumnArray.SizeMismatchException
          An exception that indicates a mismatched number of variables.
 
Constructor Summary
IloColumnArray()
           
 
Method Summary
abstract  int getSize()
          Returns the number of variables that are created by the invoking IloColumnArray object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IloColumnArray

public IloColumnArray()
Method Detail

getSize

public abstract int getSize()
Returns the number of variables that are created by the invoking IloColumnArray object. Every IloColumnArray object is suitable for constructing a variable array of a specific length. The length must be the same in each IloColumnArray when combining IloColumnArray objects with the method and.

Returns:
The number of variables created by the invoking IloColumnArray object.