NO FRAMES

CPXgetsos

public 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)
Definition file: cplex.h

The routine 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.

Example

 status = CPXgetsos (env, lp, &numsosnz, sostype, sosbeg, sosind, 
                     soswt, sosspace, &surplus, 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; that is, 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). The entry contains either CPX_TYPE_SOS1 ('1') for type 1 or CPX_TYPE_SOS2 ('2'), for type 2.

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. May be NULL if sosspace is 0 (zero).

soswt

An array to contain the reference values (weights) for SOS members. May 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. May 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 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.

Returns:

The routine returns 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.