> Languages and APIs > ILOG Concert Technology for Java Users > Advanced Modeling with IloLPMatrix |
Advanced Modeling with IloLPMatrix |
INDEX PREVIOUS NEXT |
So far the constraints have been considered only individually as ranged constraints of type IloRange
; this approach is known as modeling by rows. However, mathematically the models that can be solved with IloCplex
are frequently represented as:
Minimize (or Maximize) f(x)
such that L Ax U
with these bounds L x U
where A is a sparse matrix. A sparse matrix is one in which a significant portion of the coefficients are zero, so algorithms and data structures can be designed to take advantage of it by storing and working with the substantially smaller subset of nonzero coefficients.
Objects of type IloLPMatrix
are provided for use with IloCplex
to express constraint matrices rather than individual constraints. An IloLPMatrix
object allows you to view a set of ranged constraints and the variables used by them as a matrix, that is, as: L
Ax
U
Every row of an IloLPMatrix
object corresponds to an IloRange
constraint, and every column of an IloLPMatrix
object corresponds to a modeling variable (an instance of IloNumVar
).
An IloLPMatrix
object is created with the method LPMatrix
defined in IloMPModeler
like this:
IloLPMatrix lp = cplex.LPMatrix(); |
(or cplex.addLPMatrix
to add it immediately to the active model). The rows and columns are then added to it by specifying the non-zero matrix coefficients. Alternatively, you can add complete IloRange
and IloNumVar
objects to it to create new rows and columns. When adding ranged constraints, columns will be implicitly added for all the variables in the constraint expression that do not already correspond to a column of the IloLPMatrix
. The IloLPMatrix
object will make sure of consistency between the mapping of rows to constraints and columns to variables. For example, if a ranged constraint that uses variables not yet part of the IloLPMatrix
is added to the IloLPMatrix
, new columns will automatically be added and associated to those variables.
See the online ILOG CPLEX Java Reference Manual for more information about IloLPMatrix
methods.
Copyright © 1987-2003 ILOG, S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |