CPXXgetindconstraints and CPXgetindconstraints
Accesses a specified range of indicator constraints in the CPLEX problem object.
int CPXXgetindconstraints ( CPXCENVptr env, CPXCLPptr lp, int * type, CPXDIM * indvar, int * complemented, CPXNNZ * nzcnt_p, double * rhs, char * sense, CPXNNZ * linbeg, CPXDIM * linind, double * linval, CPXNNZ linspace, CPXNNZ * surplus_p, CPXDIM begin, CPXDIM end )
int CPXgetindconstraints ( CPXCENVptr env, CPXCLPptr lp, int * type, int * indvar, int * complemented, int * nzcnt_p, double * rhs, char * sense, int * linbeg, int * linind, double * linval, int linspace, int * surplus_p, int begin, int end )
Description
The routine
CPXXgetindconstraints/CPXgetindconstraints
accesses a specified range of indicator constraints in the
CPLEX problem object. This routine is very similar to
CPXXgetrows and CPXgetrows
in the sense that the indicator constraints to be accessed are
those in the range [begin, end]. Likewsie, the linear
parts of the specified indicator constraints are returned as
rows in the arguments.
The arguments type, indvar,
complemented, rhs, and
sense arguments
must be either NULL (if a particular kind of
information about the indicator constraints is not needed) or
the memory they point to must be able to hold at least
end-begin+1 entries.
The arguments linind and
linval can be NULL only if the value of
linspace is 0 (zero); otherwise, the memory
that those arguments
point to must be able to hold at least
linspace entries. In either case, if the
number of nonzeroes in the linear parts of the indicator
constraints is greater than linspace then
the routine returns the error
CPXERR_NEGATIVE_SURPLUS,
and *surplus_p specifies the number of
additional entries needed in linind and
linval.
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. - type
-
An array to contain the type of each requested indicator
constraint. If NULL, this information will not be
returned. Otherwise, the array must be of length at least
(
end-begin+1). - indvar
-
An array to contain the index of the indicator variable
for each requested indicator constraint. If NULL, this
information will not be returned. Otherwise, the array must
be of length at least (
end-begin+1). - complemented
-
An array to contain the complemented status of the
indicator variable for each requested indicator
constraint. If NULL, this information will not be
returned. Otherwise, the array must be of length at least
(
end-begin+1). - nzcnt_p
-
A pointer to an integer to contain the total number of
nonzero values in the linear portions of the requested
indicator constraints; that is, the true length of the
arrays
linindandlinval. This pointer can be NULL if information about the linear portions is not needed (or if the number of nonzeros is extracted by forcing the return of the errorCPXERR_NEGATIVE_SURPLUS). If this routine returns either 0 (zero) orCPXERR_NEGATIVE_SURPLUS, then this value contains the number of elements that were stored inlinindandlinval. Otherwise, the value is either unchanged or set to 0 (zero). - rhs
-
An array to contain the righthand side value of the linear
portion of each requested indicator constraint. If NULL,
this information will not be returned. Otherwise, the array
must be of length at least (
end-begin+1). - sense
-
An array to contain the sense of the linear portion of
each requested indicator constraint. If NULL, this
information will not be returned. Otherwise, the array must
be of length at least (
end-begin+1). - linbeg
-
An array to contain positions specifying where the
lefthand side of the linear portion of each requested
indicator constraint begins in the arrays
rmatvalandrmatind. Specifically, the lefthand side of the linear portion of thei-th requested indicator constraint consists of the entries inrmatvalandrmatindin the range fromrmatbeg[i-begin]tormatbeg[i-begin+1]-1. (For theend-th indicator constraint, this range is fromrmatbeg[end-begin]to(*nzcnt_p)-1.) This array must be of length at leastend-begin+1. - linind
-
An array to contain the indices in the lefthand side of
the linear portion of each requested indicator constraint.
This argument can be NULL if
linspaceis 0 (zero). - linval
-
An array to contain the values in the lefthand side of
the linear portion of each requested indicator constraint.
This argument can be NULL if
linspaceis 0 (zero). - linspace
-
An integer specifying the length of the arrays
linindandlinval. This argument can be 0 (zero). - surplus_p
-
A pointer to an integer to contain the difference between
linspaceand the number of entries in each of the arrayslinindandlinval. A nonnegative value of*surplus_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 routineCPXXgetindconstraints/CPXgetindconstraintsreturnsCPXERR_NEGATIVE_SURPLUS, and the negative of the value*surplus_pspecifies the amount of insufficient space in the arrays. This argument can beNULLiflinspaceis 0 (zero). - begin
- An integer specifying the beginning of the range of the indicator constraints to be returned.
- end
- An integer specifying the end of the range of the indicator constraints to be returned.
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 the arrays
linind and linval to hold
the nonzero coefficients.
Example
status = CPXgetindconstraints (env, lp, type, indvar, complemented,
&linnzcnt, rhs, sense, linbeg, linind, linval,
linspace, &surplus, 0, 0);