CPXaddsos


Description

The routine CPXaddsos() is used to add Special Ordered Set (SOS) information to a problem object of type CPXPROB_MILP or CPXPROB_MIQP. The problem may already contain SOS information.

Return Value

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

Synopsis

  int CPXaddsos (CPXCENVptr env,
                 CPXLPptr lp,
                 int numsos,
                 int numsosnz,
                 const char *sostype,
                 const int *sospri,
                 const int *sosbeg,
                 const int *sosind,
                 const double *soswt);

Arguments

CPXCENVptr env

The pointer to the CPLEX environment as returned by CPXopenCPLEX().

CPXLPptr lp

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

int numsos

The number of sets to be added to existing SOS sets, if any.

int numsosnz

The total number of members in all of the sets to be added to existing SOS sets, if any.

const char *sostype

An array containing SOS type information for the sets to be added. sostype[i] specifies the SOS type of set i:

CPX_TYPE_SOS1 
`1' 
Type 1 
CPX_TYPE_SOS2 
`2' 
Type 2 

The length of this array must be at least numsos.

const int *sospri

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

const int *sosbeg

const int *sosind

const double *soswt

Arrays describing the indices and weights for the sets to be added. The indices and weights of each set 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 within each set.

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, the length of sosbeg must be at least numsos, while the lengths of sosind and soswt must must be at least numsosnz.

Example

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


Previous Page: CPXaddrows Return to Top Next Page: CPXbaropt