CPXXchgcoeflist and CPXchgcoeflist
The routine CPXXchgcoeflist/CPXchgcoeflist changes a list of
matrix coefficients of a CPLEX problem object.
int CPXXchgcoeflist( CPXCENVptr env, CPXLPptr lp, CPXNNZ numcoefs, CPXDIM const * rowlist, CPXDIM const * collist, double const * vallist )
int CPXchgcoeflist( CPXCENVptr env, CPXLPptr lp, int numcoefs, int const * rowlist, int const * collist, double const * vallist )
Description
The routine CPXXchgcoeflist/CPXchgcoeflist changes a list of
matrix coefficients of a CPLEX problem object. The list is prepared as a set
of triples (i, j, value), where i is the row
index, j is the column index, and value is the new
value. The list may be in any order.
The corresponding rows and columns must already exist in the CPLEX problem object.
This routine cannot be used to change objective, righthand side, range, or bound coefficients.
Duplicate entries, that is, two triplets with identical i
and j, are not allowed.
Setting an entry to zero deletes the entry; that is, the matrix becomes sparse.
When you build or modify your problem with this routine,
you can verify that the results are as you intended
by calling CPXcheckchgcoeflist
during application development.
Arguments
- env
-
A pointer to the CPLEX environment as returned by
CPXXopenCPLEX/CPXopenCPLEX. - lp
-
A pointer to a CPLEX problem object as returned by
CPXXcreateprob/CPXcreateprob. - numcoefs
-
The number of coefficients to change, or, equivalently, the length of the arrays
rowlist,collist, andvallist. - rowlist
-
An array of length
numcoefsthat withcollistandvallistspecifies the coefficients to change. - collist
-
An array of length
numcoefsthat withrowlistandvallistspecifies the coefficients to change. - vallist
-
An array of length
numcoefsthat withrowlistandcollistspecifies the coefficients to change. The entriesrowlist[k],collist[k], andvallist[k]specify that the matrix coefficient in rowrowlist[k]and columncollist[k]should be changed to the valuevallist[k].
Return
The routine returns 0 (zero) if successful and nonzero if an error occurs.Example
status = CPXchgcoeflist (env, lp, numcoefs, rowlist, collist, vallist);