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.
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/CPXopenCPLEXroutine. - 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
linindandlinval. If the function returns either 0 (zero) orCPXERR_NEGATIVE_SURPLUS, then this value contains the number of elements that were stored inlinindorlinval. Otherwise, the value is either unchanged or set to 0 (zero). - rhs_p
-
A pointer to a
doublecontaining 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 beNULLifspaceis 0 (zero). - linval
-
An array to contain the coefficients of the linear portion of the specified indicator constraint. Can be
NULLifspaceis 0 (zero). - space
-
An integer specifying the length of the arrays
linindandlinval. Can be 0 (zero). - surplus_p
-
A pointer to an integer to contain the difference between
spaceand the number of entries in each of the arrayslinindandlinval. A nonnegative value ofsurplus_preports 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 routineCPXXgetindconstr/CPXgetindconstrreturns the valueCPXERR_NEGATIVE_SURPLUS, and the negative value ofsurplus_pspecifies the amount of insufficient space in the arrays. Can beNULLifspaceis 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);