CPXXaddsos and CPXaddsos
The routine CPXXaddsos/CPXaddsos adds information about
a special ordered set (SOS)
to a problem object of type CPXPROB_MILP,
CPXPROB_MIQP, or
CPXPROB_MIQCP.
int CPXXaddsos( CPXCENVptr env, CPXLPptr lp, CPXDIM numsos, CPXNNZ numsosnz, char const * sostype, CPXNNZ const * sosbeg, CPXDIM const * sosind, double const * soswt, char const *const * sosname )
int CPXaddsos( CPXCENVptr env, CPXLPptr lp, int numsos, int numsosnz, char const * sostype, int const * sosbeg, int const * sosind, double const * soswt, char ** sosname )
Description
The routine CPXXaddsos/CPXaddsos adds information about
a special ordered set (SOS)
to a problem object of type CPXPROB_MILP,
CPXPROB_MIQP, or
CPXPROB_MIQCP.
The problem may already contain SOS information.
CPX_TYPE_SOS1 |
'1' |
Type 1 |
CPX_TYPE_SOS2 |
'2' |
Type 2 |
The arrays sosbeg, sosind, and soswt
follow the same conventions as similar arrays in other routines of the
Callable Library.
For j < numsos-1, the indices of
the 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.
Arguments
- env
-
A pointer to the CPLEX environment as returned by
CPXXopenCPLEX/CPXopenCPLEX. - lp
-
A pointer to a CPLEX problem object as returned by
CPXXcreateprob/CPXcreateprob. - numsos
- The number of sets to be added to existing SOS sets, if any.
- numsosnz
- The total number of members in all of the sets to be added to existing SOS sets, if any.
- sostype
-
An array containing SOS type information for the sets to be added. According to Table 1,
sostype[i]specifies the SOS type of seti. The length of this array must be at leastnumsos. - sosbeg
-
An array that with
sosindandsoswtdefines the weights for the sets to be added. - sosind
-
An array that with
sosbegandsoswtdefines the weights of the sets to be added. - soswt
-
An array that with
sosbegandsosinddefines the indices and weights for the sets to be added. The indices of each set must be stored in sequential locations insosind. The weights of each set must be stored in sequential locations insoswt. The arraysosbeg[j]containing the index of the beginning of setj. The weights must be unique within each set. - sosname
-
An array containing pointers to character strings that represent the names of the new SOSs. Can be
NULL, in which case the new SOSs are assigned default names if the SOSs already resident in the CPLEX problem object have names; otherwise, no names are associated with the sets. If SOS names are passed toCPXXaddsos/CPXaddsosbut existing SOSs have no names assigned, default names are created for them.
Return
The routine returns 0 (zero) if successful and nonzero if an error occurs.Example
status = CPXaddsos (env, lp, numsos, numsosnz, sostype,
sosbeg, sosind, soswt, NULL);