XPRBnewsosrc
XPRBnewsosrc |
Purpose
Synopsis
XPRBsos XPRBnewsosrc(XPRBprob prob, const char *name, int type, XPRBarrvar av, XPRBctr ctr);
Arguments
prob
|
Reference to a problem.
|
||||
name
|
Name of the set.
|
||||
type
|
The set type, which must be one of:
|
||||
av
|
Array of variables. May be
NULL if not required.
|
||||
ctr
|
Reference to a constraint which has been previously defined. May be
NULL of not required.
|
Return value
Reference to the new SOS if function executed successfully,
NULL otherwise.
Example
The following creates an SOS of type 2 with variables from the array
ty1, and their coefficients in the constraint
ctr4.
XPRBprob prob; XPRBsos set2; XPRBctr ctr4; XPRBarrvar ty1; double c[] = {2.5, 4.0, 7.2, 3.0, 1.8}; ... ty1 = XPRBnewarrvar(prob, 5, XPRB_PL, "arry1", 0, 500); ctr4 = XPRBnewarrsum(prob, "r4", ty1, c, XPRB_G, 7.0); set2 = XPRBnewsosrc(prob, "sos2", XPRB_S2, ty1, ctr4);
Further information
This function can be used instead of a stepwise SOS definition if the variables are available in the form of a single array and the model contains a constraint with nonzero coefficients for all variables which can serve as a reference constraint. If no reference constraint is indicated all weights are initialized to
1. If the indicated name is already in use, BCL adds an index to it. If no name is given for the set, BCL generates a default name starting with
SOS. (The generation of unique names will only take place if the names dictionary is enabled, see
XPRBsetdictionarysize.)
- Note:
- all members that are added to a SOS must belong to the same problem as the SOS itself.
Related topics