NO FRAMES

CPXgetsos

int CPXPUBLIC CPXgetsos(CPXCENVptr env, CPXCLPptr lp, int * numsosnz_p, char * sostype, int * sospri, int * sosbeg, int * sosind, double * soswt, int sosspace, int * surplus_p, int begin, int end)
Definition file: cplex.h
Include files: cplex.h

The routine CPXgetsos is used to access a range of Special Ordered Set (SOS) definitions 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 indicates the length needed for the arrays sosind and soswt.

Example

 status = CPXgetsos (env, lp, &numsosnz, sostype, sospri, sosbeg,
                     sosind, soswt, sosspace, 0, numsos-1);

Parameters:

env

A pointer to the CPLEX environment as returned by CPXopenCPLEX.

lp

A pointer to a CPLEX problem object as returned by CPXcreateprob.

numsosnz_p

A pointer to an integer to contain the number of set members returned; i.e., the true length of the arrays sosind and soswt.

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.

sospri

An array to contain the priorities of the SOSs. The priority of set i is returned in sospri[i-begin]. This array must be of length at least (end - begin+ 1). May be NULL.

sosbeg

An array to contain indices indicating 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. May be NULL if sosspace is 0.

soswt

An array to contain the reference values (weights) for SOS members. May be NULL if sosspace is 0. Weight soswt[k] corresponds to sosind[k].

sosspace

An integer indicating the length of the arrays sosind and soswt. May be 0.

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 indicates that the length of the arrays was sufficient. A negative value indicates that the length was insufficient and that the routine could not complete its task. In this case, the routine CPXgetsos returns the value CPXERR_NEGATIVE_SURPLUS, and the negative value of *surplus_p indicates the amount of insufficient space in the arrays.

begin

An integer indicating the beginning of the range of SOSs to be returned.

end

An integer indicating the end of the range of SOSs to be returned.

Returns:

The routine returns zero on success and nonzero if an error occurs. The value CPXERR_NEGATIVE_SURPLUS indicates that insufficient space was available in the arrays sosind and soswt to hold the SOS definition.