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.

Note:

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, and vallist.
rowlist
An array of length numcoefs that with collist and vallist specifies the coefficients to change.
collist
An array of length numcoefs that with rowlist and vallist specifies the coefficients to change.
vallist
An array of length numcoefs that with rowlist and collist specifies the coefficients to change. The entries rowlist[k], collist[k], and vallist[k] specify that the matrix coefficient in row rowlist[k] and column collist[k] should be changed to the value vallist[k].

Return

The routine returns 0 (zero) if successful and nonzero if an error occurs.

Example


status = CPXchgcoeflist (env, lp, numcoefs, rowlist, collist, vallist);