NO FRAMES

CPXgetgrad

int CPXPUBLIC CPXgetgrad(CPXCENVptr env, CPXCLPptr lp, int j, int * head, double * y)
Definition file: cplex.h
Include files: cplex.h

The routine 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. 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.

Example

 status = CPXgetgrad (env, lp, 13, head, y);

Parameters:

env

A pointer to the CPLEX environment as returned by CPXopenCPLEX.

lp

A pointer to a CPLEX problem object as returned by CPXcreateprob.

j

An integer indicating the index of the column of interest. A negative value for j indicates 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 the ith row of the basis. If the ith 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 least CPXgetnumrows(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 in y. This array should be of length at least CPXgetnumrows(env,lp). May be NULL.

Example

 status = CPXgetgrad (env, lp, 13, head, y);

Returns:

The routine returns zero on success and nonzero if an error occurs. This routine fails if no basis exists.