NO FRAMES

CPXcopysos

int CPXPUBLIC CPXcopysos(CPXCENVptr env, CPXLPptr lp, int numsos, int numsosnz, const char * sostype, const int * sospri, const int * sosbeg, const int * sosind, const double * soswt)
Definition file: cplex.h
Include files: cplex.h

The routine CPXcopysos is used to copy Special Ordered Set (SOS) information to a problem object of type CPXPROB_MILP, CPXPROB_MIQP, or CPXPROB_MIQCP.

Table 1: Settings for sostype
CPX_TYPE_SOS1'1'Type 1
CPX_TYPE_SOS2'2'Type 2

Example

 status = CPXcopysos (env, 
                      lp, 
                      numsos, 
                      numsosnz, 
                      sostype, 
                      sospri,
                      sosbeg, 
                      sosind, 
                      soswt);
 

See Also:

Parameters:

env

A pointer to the CPLEX environment as returned by CPXopenCPLEX.

lp

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

numsos

The number of SOS sets. If numsos is equal to zero, CPXcopysos removes all the SOSs from the LP object.

numsosnz

The total number of members in all sets. CPXcopysos with numsosnz equal to zero removes all the SOSs from the LP object.

sostype

An array containing SOS type information for the sets. sostype[i] specifies the SOS type of set i, according tot the settings in Table 1. The length of this array must be at least numsos.

sospri

An array containing priority values for each set. sospri[i] specifies the priority for set i, and may take any nonnegative value. May be NULL; otherwise, its length must be at least numsos.

soswt

Arrays describing the indices and weights for the sets. For every set, the indices and weights must be stored in sequential locations in sosind and soswt, respectively, with sosbeg[j] containing the index of the beginning of set j. The weights must be unique in their array. For j < numsos-1 the indices of set j must be stored in sosind[sosbeg[j]],..., sosind[sosbeg[j+1]-1] and the weights in soswt[sosbeg[j],..., soswt[sosbeg[j+1]-1]. For the last set, j = numsos-1, the indices must be stored in sosind[sosbeg[numsos-1]],..., sosind[numsosnz-1] and the corresponding weights in soswt[sosbeg[numsos-1]] ..., soswt[numsosnz-1]. Hence, sosbeg must be of length at least numsos, while sosind and soswt must be of length at least numsosnz.

Returns:

The routine returns zero on success and nonzero if an error occurs.