XPRBsos
| XPRBsos | 
  Description
 
 
 Methods for modifying and accessing
 Special Ordered Sets and operators for constructing them. Note that all members in a SOS must belong to the same problem as the SOS itself.
 
 
  Constructors
 
  
  Methods
 
  
 Add a linear expression to a SOS.
  
 Add an element to a SOS.
  
 Delete an element from a SOS.
  
 Get the C modeling object.
  
 Get the name of a SOS.
  
 Get the type of a SOS.
  
 Test the validity of the SOS object.
  
 Print out a SOS
  
 Set a branching directive for a SOS.
 
  Operators
 
 
 Assigning and adding linear expressions to Special Ordered Sets:
 
   
 Constructor detail
 
 | 
     XPRBsos
     | |||||
| 
     Synopsis
     | 
     XPRBsos();
      XPRBsos(xbsos *s); XPRBsos(xbsos *s, XPRBexpr& l); | ||||
| 
     Arguments
     | 
 | ||||
| 
     Description
     | 
     Create a new SOS object.
     | ||||
|  | |||||
 Method detail
 | 
     add
     | |||||||||||||||||||||||||
| 
     Synopsis
     | 
     int add(const XPRBexpr& le);
     | ||||||||||||||||||||||||
| 
     Argument
     | 
 | ||||||||||||||||||||||||
| 
     Return value
     | 
      0 if method executed successfully, 1 otherwise.
      | ||||||||||||||||||||||||
| 
     Description
     | |||||||||||||||||||||||||
| 
     Example
     | 
      This example shows different ways of defining SOS and modifying their contents. The resulting SOS definitions (as obtained with
      XPRBsos.print) and the output printed by the program are displayed as comments.
       XPRBvar x,y,z;
XPRBsos SO1, SO2;
XPRBprob prob("myprob");
x = prob.newVar("x", XPRB_PL, 0, 200);
y = prob.newVar("y", XPRB_PL, 0, 200);
z = prob.newVar("z", XPRB_PL, 0, 200);
SO1 = prob.newSos("SO1", XPRB_S1);
SO1.add(x+2*y+3*z);       // SO1(1): x(+1) y(+2) z(+3)
SO1 += 2*z-x;             // SO1(1): y(+2) z(+5)
cout << SO1.getName() << " type: ";
cout << (SO1.getType()==XPRB_S1?1:2) << endl;
                          // SO1 type: 1
SO2 = prob.newSos("SO2", XPRB_S2, 10*x+20*y);
SO2.addElement(z, 5);     // SO2(2): x(+10) y(+20) z(+5)
SO2.delElement(x);        // SO2(2): y(+20) z(+5)  | ||||||||||||||||||||||||
| 
     addElement
     | |||||||||||||||||||||||||
| 
     Synopsis
     | 
     int addElement(XPRBvar& var, double val);
      int addElement(double val, XPRBvar& var); | ||||||||||||||||||||||||
| 
     Arguments
     | 
 | ||||||||||||||||||||||||
| 
     Return value
     | 
      0 if function executed successfully, 1 otherwise
      | ||||||||||||||||||||||||
| 
     Description
     | |||||||||||||||||||||||||
| 
     Example
     | 
      See
      XPRBsos.add.
       | ||||||||||||||||||||||||
| 
     Related topics
     | 
      Calls
     XPRBaddsosel
      | ||||||||||||||||||||||||
| 
     delElement
     | |||||||||||||||||||||||||
| 
     Synopsis
     | 
     int delElement(XPRBvar& var);
     | ||||||||||||||||||||||||
| 
     Argument
     | 
 | ||||||||||||||||||||||||
| 
     Return value
     | 
      0 if method executed successfully, 1 otherwise.
      | ||||||||||||||||||||||||
| 
     Description
     | |||||||||||||||||||||||||
| 
     Example
     | 
      See
      XPRBsos.add.
       | ||||||||||||||||||||||||
| 
     Related topics
     | 
      Calls
     XPRBdelsosel
      | ||||||||||||||||||||||||
| 
     getCRef
     | |||||||||||||||||||||||||
| 
     Synopsis
     | 
     xbsos *getCRef();
     | ||||||||||||||||||||||||
| 
     Return value
     | 
      The underlying modeling object in BCL C.
      | ||||||||||||||||||||||||
| 
     Description
     | 
     This method returns the SOS object in BCL C that belongs to the C++ SOS object.
     | ||||||||||||||||||||||||
| 
     getName
     | |||||||||||||||||||||||||
| 
     Synopsis
     | 
     const char *getName();
     | ||||||||||||||||||||||||
| 
     Return value
     | 
      Name of the SOS if executed successfully,
      NULL otherwise.
      | ||||||||||||||||||||||||
| 
     Description
     | |||||||||||||||||||||||||
| 
     Example
     | 
      See
      XPRBsos.add.
       | ||||||||||||||||||||||||
| 
     Related topics
     | 
      Calls
     XPRBgetsosname
      | ||||||||||||||||||||||||
| 
     getType
     | |||||||||||||||||||||||||
| 
     Synopsis
     | 
     int getType();
     | ||||||||||||||||||||||||
| 
     Return value
     | |||||||||||||||||||||||||
| 
     Description
     | |||||||||||||||||||||||||
| 
     Example
     | 
      See
      XPRBsos.add.
       | ||||||||||||||||||||||||
| 
     Related topics
     | 
      Calls
     XPRBgetsostype
      | ||||||||||||||||||||||||
| 
     isValid
     | |||||||||||||||||||||||||
| 
     Synopsis
     | 
     bool isValid();
     | ||||||||||||||||||||||||
| 
     Return value
     | 
      true if object is valid,
      false otherwise.
      | ||||||||||||||||||||||||
| 
     Description
     | 
     This method checks whether the SOS object is correctly defined. It should always be used to test the result returned by
     XPRBprob.getSosByName.
     | ||||||||||||||||||||||||
| 
     Example
     | |||||||||||||||||||||||||
| 
     print
     | |||||||||||||||||||||||||
| 
     Synopsis
     | 
     int print();
     | ||||||||||||||||||||||||
| 
     Return value
     | 
      0 if function executed successfully, 1 otherwise.
      | ||||||||||||||||||||||||
| 
     Description
     | |||||||||||||||||||||||||
| 
     Example
     | |||||||||||||||||||||||||
| 
     Related topics
     | 
      Calls
     XPRBprintsos
      | ||||||||||||||||||||||||
| 
     setDir
     | |||||||||||||||||||||||||
| 
     Synopsis
     | 
     int setDir(int type, double val);
      int setDir(int type); | ||||||||||||||||||||||||
| 
     Arguments
     | 
 | ||||||||||||||||||||||||
| 
     Return value
     | 
      0 if method executed successfully, 1 otherwise.
      | ||||||||||||||||||||||||
| 
     Description
     | 
     
     
     
     This method sets any type of branching directive available in Xpress. This may be a priority for branching on a SOS (type
     XPRB_PR), the preferred branching direction (types
     XPRB_UP,
     XPRB_DN) or the estimated cost incurred when branching on a SOS (types
     XPRB_PU,
     XPRB_PD). Several directives of different types may be set for a single set. Method
     XPRBvar.setDir may be used to set a directive for a variable.
     | ||||||||||||||||||||||||
| 
     Example
     | 
      See
      XPRBprob.clearDir.
       | ||||||||||||||||||||||||
| 
     Related topics
     | 
      Calls
     XPRBsetsosdir
      | ||||||||||||||||||||||||
|  | |||||||||||||||||||||||||
 
