CPXXgetsos and CPXgetsos
The routine CPXXgetsos/CPXgetsos accesses
the definitions of a range of special
ordered sets (SOS) stored in a CPLEX problem object.
int CPXXgetsos( CPXCENVptr env, CPXCLPptr lp, CPXNNZ * numsosnz_p, char * sostype, CPXNNZ * sosbeg, CPXDIM * sosind, double * soswt, CPXNNZ sosspace, CPXNNZ * surplus_p, CPXDIM begin, CPXDIM end )
int CPXgetsos( CPXCENVptr env, CPXCLPptr lp, int * numsosnz_p, char * sostype, int * sosbeg, int * sosind, double * soswt, int sosspace, int * surplus_p, int begin, int end )
Description
The routine CPXXgetsos/CPXgetsos accesses
the definitions of a range of special
ordered sets (SOS) stored in a CPLEX problem object. The
beginning and end of the range, along with the length of the array in which
the definitions are to be returned, must be provided.
sosspaceis 0 (zero),
then the negative of the value of
surplus_p returned specifies the length needed for the arrays
sosind and soswt.
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. - numsosnz_p
-
A pointer to an integer to contain the number of set members
returned; that is, the true length of the arrays
sosindandsoswt. If the function returns either 0 (zero) orCPXERR_NEGATIVE_SURPLUS, then this value contains the number of elements that were stored insosindorsoswt. Otherwise, the value is either unchanged or set to 0 (zero). - sostype
-
An array to contain the types of the requested SOSs. The type of set
kis returned insostype[k-begin]. This array must be of length at least (end-begin+1). Contains eitherCPX_TYPE_SOS1('1') orCPX_TYPE_SOS2('2'), for a type 1 or type 2 SOS respectively. - sosbeg
-
An array to contain indices specifying where each of the requested SOSs begins in the arrays
sosindandsoswt. Specifically, setkconsists of the entries insosindandsoswtin the range fromsosbeg[k-begin]tososbeg[(k+1)-begin]-1. (Setendconsists of the entries fromsosbeg[end-begin]tonumsosnz_p-1.) This array must be of length at least (end-begin+1). - sosind
-
An array to contain the variable indices of the SOS members. Can be
NULLifsosspaceis 0 (zero). - soswt
-
An array to contain the reference values (weights) for SOS members. Can be
NULLifsosspaceis 0 (zero). Weightsoswt[k]corresponds tososind[k]. - sosspace
-
An integer specifying the length of the arrays
sosindandsoswt. Can be 0 (zero). - surplus_p
-
A pointer to an integer to contain the difference between
sosspaceand the number of entries in each of the arrayssosindandsoswt. 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 routineCPXXgetsos/CPXgetsosreturns the valueCPXERR_NEGATIVE_SURPLUS, and the negative value ofsurplus_pspecifies the amount of insufficient space in the arrays. - begin
- An integer specifying the beginning of the range of SOSs to be returned.
- end
- An integer specifying the end of the range of SOSs 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 sosind
and soswt to hold the SOS definition.
Example
status = CPXgetsos (env, lp, &numsosnz, sostype, sosbeg, sosind,
soswt, sosspace, &surplus, 0, numsos-1);