Previous Page: CPXgetslackFirst PageNext Page: CPXgetstat

CPXgetsos


Usage

Mixed Integer Users Only

The routine CPXgetsos() is used to access a range of Special Ordered Set (SOS) definitions stored in a CPLEX LP 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.

Return Value

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

Synopsis

int CPXgetsos (CPXENVptr env,
               CPXLPptr lp,
               int *numsosnz_p,
               char *sostype,
               int *sospri,
               int *sosbeg,
               int *sosind,
               double *sosref,
               int sosspace,
               int *surplus_p,
               int begin,
               int end);

Arguments


CPXENVptr env
The pointer to the CPLEX environment as returned by one of the CPXopenCPLEX routines.

CPXLPptr lp
A pointer to a CPLEX LP problem object as returned by CPXcreateprob().

int *numsosnz_p
A pointer to an integer that will contain the number of set members returned; i.e., the true length of the arrays sosind and sosref.

char *sostype
An array that will 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.

int *sospri
An array that will 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). sospri may be NULL.

int *sosbeg
An array that will contain indices indicating where each of the requested SOSs begins in the arrays sosind and sosref. Specifically, set k consists of the entries in sosind and sosref 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).

int *sosind
An array that will contain the variable indices of the SOS members. sosind may be NULL if sosspace is 0.

double *sosref
An array that will contain the reference values (weights) for SOS members. sosref may be NULL if sosspace is 0. Weight sosref[k] corresponds to sosind[k].

int sosspace
An integer indicating the length of the arrays sosind and sosref. sosspace may be 0.

int *surplus_p
A pointer to an integer that will contain the difference between sosspace and the number of entries in each of the arrays sosind and sosref. A non-negative 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.

If the value of sosspace is 0, then the negative of the value of *surplus_p returned indicates the length needed for the arrays sosind and sosref.

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

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

Example

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

Previous Page: CPXgetslackFirst PageNext Page: CPXgetstat