CPXXgetindconstr and CPXgetindconstr

The routine CPXXgetindconstr/CPXgetindconstr accesses a specified indicator constraint on the variables of a CPLEX problem object.

int  CPXXgetindconstr( CPXCENVptr env, CPXCLPptr lp, CPXDIM * indvar_p, int * complemented_p, CPXDIM * nzcnt_p, double * rhs_p, char * sense_p, CPXDIM * linind, double * linval, CPXDIM space, CPXDIM * surplus_p, CPXDIM which )

int  CPXgetindconstr( CPXCENVptr env, CPXCLPptr lp, int * indvar_p, int * complemented_p, int * nzcnt_p, double * rhs_p, char * sense_p, int * linind, double * linval, int space, int * surplus_p, int which )

Description

The routine CPXXgetindconstr/CPXgetindconstr accesses a specified indicator constraint on the variables of a CPLEX problem object. The length of the arrays in which the nonzero coefficients of the constraint are to be returned must be specified.

Note: If the value of space is 0 (zero), then the negative of the value of *surplus_p returned specifies the length needed for the arrays linind and linval.

Arguments

env
A pointer to the CPLEX environment as returned by the CPXXopenCPLEX/CPXopenCPLEX routine.
lp
A pointer to a CPLEX problem object as returned by CPXXcreateprob/CPXcreateprob.
indvar_p
A pointer to an integer to contain the index of the binary indicator variable. Can be NULL.
complemented_p
A pointer to a Boolean value that specifies whether the indicator variable is complemented. Can be NULL.
nzcnt_p
A pointer to an integer to contain the number of nonzero values in the linear portion of the indicator constraint; that is, the true length of the arrays linind and linval. If the function returns either 0 (zero) or CPXERR_NEGATIVE_SURPLUS, then this value contains the number of elements that were stored in linind or linval. Otherwise, the value is either unchanged or set to 0 (zero).
rhs_p
A pointer to a double containing the righthand side value of the linear portion of the indicator constraint.
sense_p
A pointer to a character specifying the sense of the linear portion of the constraint. Possible values are L for a <= constraint, E for an = constraint, or G for a >= constraint.
linind
An array to contain the variable indices of the entries of linval. Can be NULL if space is 0 (zero).
linval
An array to contain the coefficients of the linear portion of the specified indicator constraint. Can be NULL if space is 0 (zero).
space
An integer specifying the length of the arrays linind and linval. Can be 0 (zero).
surplus_p
A pointer to an integer to contain the difference between space and the number of entries in each of the arrays linind and linval. A nonnegative value of surplus_p reports that the length of the arrays was sufficient. A negative value reports that the length was insufficient and that the routine could not complete its task. In this case, the routine CPXXgetindconstr/CPXgetindconstr returns the value CPXERR_NEGATIVE_SURPLUS, and the negative value of surplus_p specifies the amount of insufficient space in the arrays. Can be NULL if space is 0 (zero).
which
An integer specifying which indicator constraint to return.

Return

The routine returns 0 (zero) if successful and nonzero if an error occurs. The value CPXERR_NEGATIVE_SURPLUS reports that insufficient space was available in either of the arrays linind and linval to hold the nonzero coefficients.

Example


 status = CPXgetindconstr (env, lp, &indvar, &complemented,
                           &linnzcnt, &rhs, &sense, linind, linval,
                           space, &surplus, 0);