CPXcopysos


Description

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

Return Value

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

Synopsis

  int CPXcopysos (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 SOS sets. If numsos is equal to zero, CPXcopysos() removes all the SOSs from the LP object.

int numsosnz

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

const char *sostype

An array containing SOS type information for the sets. 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. 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.

const int *sosbeg

const int *sosind

const double *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.

Example

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

See Also

CPXreadcopysos()
Example mipex3.c in the CPLEX User's Manual.

Previous Page: CPXcopyquad Return to Top Next Page: CPXcopystart