CPXXchgcoef and CPXchgcoef

The routine CPXXchgcoef/CPXchgcoef changes a single coefficient in the constraint matrix, linear objective coefficients, righthand side, or ranges of a CPLEX problem object.

int  CPXXchgcoef( CPXCENVptr env, CPXLPptr lp, CPXDIM i, CPXDIM j, double newvalue )

int  CPXchgcoef( CPXCENVptr env, CPXLPptr lp, int i, int j, double newvalue )

Description

The routine CPXXchgcoef/CPXchgcoef changes a single coefficient in the constraint matrix, linear objective coefficients, righthand side, or ranges of a CPLEX problem object. The coefficient is specified by its coordinates in the constraint matrix. When you change matrix coefficients from zero to nonzero values, be sure that the corresponding row and column indices exist in the problem, so that -1 <= i < CPXgetnumrows(env, lp) and -2 <= j < CPXgetnumcols(env, lp).

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.
i
An integer that specifies the numeric index of the row in which the coefficient is located. The linear objective row is referenced with i = -1.
j
An integer that specifies the numeric index of the column in which the coefficient is located. The RHS column is referenced with j = -1. The range value column is referenced with j = -2. If a range value is being changed, (that is, j = -2), then the specified row does not automatically become a range, so you must explicitly change its sense as well.
newvalue
The new value for the coefficient being changed.

Return

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

Example


status = CPXchgcoef (env, lp, 10, 15, 23.2);