CPXXgetslack and CPXgetslack

The routine CPXXgetslack/CPXgetslack accesses the slack values for a range of linear constraints.

int  CPXXgetslack( CPXCENVptr env, CPXCLPptr lp, double * slack, CPXDIM begin, CPXDIM end )

int  CPXgetslack( CPXCENVptr env, CPXCLPptr lp, double * slack, int begin, int end )

Description

The routine CPXXgetslack/CPXgetslack accesses the slack values for a range of linear constraints. The beginning and end of the range must be specified. Except for ranged rows, the slack values returned consist of the righthand side minus the row activity level. For ranged rows, the value returned is the row activity level minus the righthand side, or, equivalently, the value of the internal structural variable that CPLEX creates to represent ranged rows.

Note: If the solution was obtained by the dual simplex algorithm and is not dual feasible then the function returns values with respect to the dual phase I bounds. You can use CPXXsolninfo and CPXsolninfo to query primal and dual feasibility of a solution.

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.
slack
An array to receive the values of the slack or surplus variables for each of the constraints. This array must be of length at least (end-begin+1). If successful, slack[0] through slack[end-begin] contain the values of the slacks.
begin
An integer specifying the beginning of the range of slack values to be returned.
end
An integer specifying the end of the range of slack values to be returned.

Return

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

Example


status = CPXgetslack (env, lp, slack, 0, CPXgetnumrows(env,lp)-1);