Some Useful Set and Get Methods

Table 2.2. Some Useful Set and Get Methods

Method(s) Description
setMaximumIterations(int value)
int maximumIterations()
setMaximumSeconds(double value)
double maximumIterations()
These methods tell CLP to stop after a given number of iterations or seconds (and returns these values).
double objectiveValue() This method returns the objective value.
const double * getObjCoefficients()
double * objective()
These methods return the objective coefficients.
const double * getRowLower()
double * rowLower()
const double * getRowUpper()
double * rowUpper()
const double * getColLower()
double * columnLower()
const double * getColUpper()
double * columnUpper()
These methods give lower and upper bounds on row and column activities.
double * infeasibilityRay()
double * unboundedRay()
If the problem was primal or dual infeasible, these methods will give a pointer to a ray proving infeasibility.
CoinPackMatrix * matrix() There are more options as the user has great flexibility in how the problem matrix is stored, but the default matrix class is CoinPackedMatrix (see the section called “Matrix Classes”). So we have that this method returns a pointer to a CoinPackedMatrix which can be further manipulated.
CoinBigIndex getNumElements() [a] Returns the number of elements in the problem matrix.
void setOptimizationDirection(double value)
double optimizationDirection()
These methods set and get the objective sense. The parameter value should be +1 to minimize, -1 to maximize, and 0 to ignore.

[a] CoinBigIndex is a typedef which in most cases is the same as int.