Description
After an LP has been solved and a basis is available, the routine CPXgetgrad() can be used 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.jth variable, the value of the ith basic variable, sometimes referred to as the variable basic in the ith row, will change 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.Return Value
The routine returns a zero on success, and a nonzero if an error occurs. This routine will fail if no basis exists.Synopsis
int CPXgetgrad (CPXENVptr env,
CPXLPptr lp,
int j,
int *head,
double *y);
CPXENVptr envThe pointer to the CPLEX environment as returned by one of the
CPXopenCPLEX routines.
CPXLPptr lpA pointer to a CPLEX LP problem object as returned by
CPXcreateprob().
int jAn 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
int *headAn array that will 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). head may be NULL.
double *yAn array that will 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). y may be NULL.
status = CPXgetgrad (env, lp, 13, head, y);