CPXXgetgrad and CPXgetgrad
The routine CPXXgetgrad/CPXgetgrad can be used, after an LP has been
solved and a basis is available, to access information useful for different
types of post-solution analysis.
int CPXXgetgrad( CPXCENVptr env, CPXCLPptr lp, CPXDIM j, CPXDIM * head, double * y )
int CPXgetgrad( CPXCENVptr env, CPXCLPptr lp, int j, int * head, double * y )
Description
The routine CPXXgetgrad/CPXgetgrad can be used, after an LP has been
solved and a basis is available, to access information useful for different
types of post-solution analysis. CPXXgetgrad/CPXgetgrad provides two
arrays that can be used to project the impact of making changes to optimal
variable values or objective function coefficients.
For a unit change in the value of the jth variable, the
value of the ith basic variable, sometimes referred to as the
variable basic in the ith row, changes by the amount
y[i]. Also, for a unit change of the objective function
coefficient of the ith basic variable, the reduced-cost of the
jth variable changes by the amount y[i]. The
vector y is equal to the product of the inverse of the basis
matrix and the column j of the constraint matrix. Thus,
y can be thought of as the representation of the
jth column in terms of the basis.
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. - j
-
An integer specifying the index of the column of interest. A negative value for
jspecifies a column representing the slack or artificial variable for row -j-1 - head
-
An array to contain a listing of the indices of the basic variables in the order in which they appear in the basis. This listing is sometimes called the basis header. The
ith entry in this list is also sometimes viewed as the variable in theith row of the basis. If theith basic variable is a structural variable,head[i]simply contains the column index of that variable. If it is a slack variable,head[i]contains one less than the negative of the row index of that slack variable. This array should be of length at leastCPXgetnumrows(env,lp). May be NULL. - y
-
An array to contain the coefficients of the
jth column relative to the current basis. See the discussion above on how to interpret the entries iny. This array should be of length at leastCPXgetnumrows(env,lp). May be NULL.
Return
The routine returns 0 (zero) if successful and nonzero if an error occurs. This routine fails if no basis exists.Example
status = CPXgetgrad (env, lp, 13, head, y);