Modeling by nonzero elements
CPLEX supports the approach of modeling by nonzero elements in the sample.
The last of the three functions that can be used to build
the model is populatebynonzero. It creates
objects for the objective and the ranges without expressions, and
variables without columns. The methods IloObjective::setLinearCoef, setLinearCoefs,
and IloRange::setLinearCoef, setLinearCoefs are
used to set individual nonzero values in the expression of the objective
and the range constraints. As usual, the objective and ranges must
be added to the model.
You can view the complete program online in the standard
distribution of the product at yourCPLEXinstallation /examples/src/ilolpex1.cpp.