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.

Note: If the value of 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 sosind and soswt. If the function returns either 0 (zero) or CPXERR_NEGATIVE_SURPLUS, then this value contains the number of elements that were stored in sosind or soswt. 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 k is returned in sostype[k-begin]. This array must be of length at least (end-begin+1). Contains either CPX_TYPE_SOS1 ('1') or CPX_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 sosind and soswt. Specifically, set k consists of the entries in sosind and soswt in the range from sosbeg[k-begin] to sosbeg[(k+1)-begin]-1. (Set end consists of the entries from sosbeg[end-begin]to numsosnz_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 NULL if sosspace is 0 (zero).
soswt
An array to contain the reference values (weights) for SOS members. Can be NULL if sosspace is 0 (zero). Weight soswt[k] corresponds to sosind[k].
sosspace
An integer specifying the length of the arrays sosind and soswt. Can be 0 (zero).
surplus_p
A pointer to an integer to contain the difference between sosspace and the number of entries in each of the arrays sosind and soswt. 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 CPXXgetsos/CPXgetsos returns the value CPXERR_NEGATIVE_SURPLUS, and the negative value of surplus_p specifies 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);