ilog.concert
Class IloColumnArray
java.lang.Object
|
+--ilog.concert.IloColumnArray
- public abstract class IloColumnArray
- extends java.lang.Object
Objects of class IloColumnArray
are used to create an array
of variables by column-wise modeling. Column-wise modeling means that the
variables are inserted into existing modeling objects at the time of
construction. The term column-wise comes from linear programing,
where the constraints are typically represented as a matrix. Adding new
variables to the optimization problem is equivalent to adding columns to the
constraint matrix.
Here is the procedure for column-wise modeling.
Start with the set of modeling objects of these classes
IloObjective
,
IloRange
, and
IloLPMatrix
to which you want to add new
variables. For each of these objects call
IloMPModeler.columnArray()
, with the object as a parameter, along
with the other parameters needed to install an array of new
variables in the existing modeling objects. See the
IloMPModeler.columnArray() documentation
for details of these
parameters. All the IloColumnArray
objects can then be linked
to one IloColumnArray
object with the method IloColumnArray.add()
, 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 add()
.
The IloColumnArray
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 described by the IloColumnArray
object. This is done by passing the IloColumnArray
object as a
parameter 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 IloColumnArray
object.
The following example function shows how to create an array of two new
variables with bounds 0
and 1
and install them in
an objective and a range constraint, with linear coefficients all set to
1
:
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)
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 |
IloColumnArray
public IloColumnArray()
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 specific length.
The length must be the same in each IloColumnArray
when
combining IloColumnArray
objects
with the method add()
.
- Returns:
- The number of variables created by the
invoking
IloColumnArray
object.