Initializing help system before first use

XPRBsos

  • java.lang.Object
    • com.dashoptimization.XPRBsos


  • public class XPRBsos
    extends java.lang.Object
    This class represents a Special Ordered Set (SOS) definition in BCL. All members in SOS must belong to the same problem as the SOS itself.
    • Method Summary

      Modifier and Type Method and Description
      void add(XPRBexpr l)
      Add a linear expression to a SOS.
      void addElement(double val, XPRBvar var) 
      void addElement(XPRBvar var, double val)
      Add an element to a SOS.
      void assign(XPRBexpr l)
      Assign a linear expression to a SOS.
      void delElement(XPRBvar var)
      Delete an element from a SOS.
      java.lang.String getName()
      Get the name of a SOS.
      int getType()
      Get the type of a SOS.
      boolean isValid()
      Test whether a SOS is correctly defined.
      void print()
      Print out a Special Ordered Set.
      void setDir(int type) 
      void setDir(int type, double val)
      Set a branching directive for a SOS.
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • isValid

        public boolean isValid()
        Test whether a SOS is correctly defined.
             XPRBsos set1;
             if(set1.isValid() == false)
                System.out.println("Error in SOS definition.");
         
      • assign

        public void assign(XPRBexpr l)
                    throws java.lang.ArithmeticException
        Assign a linear expression to a SOS.
             XPRBprob expl2;
             XPRBvar[] x;
             int i;
             XPRBexpr l;
             XPRBsos set3;
             expl2 = new XPRBprob("example2");
             for(i=0;i<5;i++) x[i] = expl2.newVar("x");
             l = new XPRBexpr();
             for(i=1;i<4;i++) l.add(x[i].mul(i));
             set3.assign(l);
         
        Parameters:
        l - linear expression
        Throws:
        java.lang.ArithmeticException
      • getName

        public java.lang.String getName()
        Get the name of a SOS. If the user has not defined a name the default name generated by BCL is returned.
             XPRBprob expl2;
             XPRBsos set1;
             expl2 = new XPRBprob("example2");
             set1 = expl2.newSos("sos1", XPRB.S1);
             System.out.println("SOS name:" + set1.getName());
         
        Returns:
        Name of the SOS if method executed successfully, null otherwise
      • getType

        public int getType()
        Get the type of a SOS.
             XPRBprob expl2;
             XPRBsos set1;
             int stype;
             expl2 = new XPRBprob("example2");
             set1 = expl2.newSos("sos1", XPRB.S1);
             stype = set1.getType();
         
        Returns:
        Type of the SOS. Possible values:
        • XPRB.S1 Special Ordered Set of type 1
        • XPRB.S2 Special Ordered Set of type 2
        • -1 an error has occurred
      • setDir

        public void setDir(int type,
                           double val)
        Set a branching directive for a SOS. 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.PU). Several directives of different types may be set for a single set. Method XPRBvar.setDir(int, double) may be used to set a branching directive for a variable.
             XPRBprob expl2;
             XPRBsos set1;
             expl2 = new XPRBprob("example2");
             set1 = expl2.newSos("sos1", XPRB.S1);
             set1.setDir(XPRB.PR, 5);
             set1.setDir(XPRB.DN);
         
        Parameters:
        type - directive type. Possible values:
        • XPRB.PR priority
        • XPRB.UP first branch upwards
        • XPRB.DN first branch downwards
        • XPRB.PU pseudocost on branching upwards
        • XPRB.PD pseudocost on branching downwards
        val - the value of this argument depends on the type of directive to be defined. Possible values:
        • XPRB.PR: priority value, integer between 1 (highest) and 1000 (least priority, default value)
        • XPRB.UP,XPRB.DN: no input required, choose any dummy value (e.g. 0)
        • XPRB.PU,XPRB.PD: value of pseudocost for the corresponding branch
      • addElement

        public void addElement(XPRBvar var,
                               double val)
        Add an element to a SOS. This method adds a variable and its weight coefficient to a Special Ordered Set. If the variable is already contained in the set, the indicated value is added to its weight. Note that weight coefficients must be different from 0.
             XPRBprob expl2;
             XPRBsos set1;
             XPRBvar x2;
             expl2 = new XPRBprob("example2");
             x2 = expl2.newvar("abc1", XPRB.PL, 0, INFINITY);
             set1 = expl2.newSos("sos1", XPRB.S1);
             set1.addElement(x2, 9);
         
        Parameters:
        var - a variable of type XPRBvar
        val - the corresponding weight or reference value
      • delElement

        public void delElement(XPRBvar var)
        Delete an element from a SOS.
             XPRBprob expl2;
             XPRBsos set1;
             XPRBvar x2;
             expl2 = new XPRBprob("example2");
             x2 = expl2.newvar("abc1", XPRB.PL, 0, INFINITY);
             set1 = expl2.newSos("sos1", XPRB.S1);
             set1.addElement(x2, 9);
             set1.delElement(x2);
         
        Parameters:
        var - a variable of type XPRBvar
      • add

        public void add(XPRBexpr l)
                 throws java.lang.ArithmeticException
        Add a linear expression to a SOS. If a variable in the linear expression is already contained in the set, the indicated value is added to its weight. Constant terms in the linear expression are ignored.
             XPRBprob expl2;
             XPRBvar[] x;
             int i;
             XPRBexpr l;
             XPRBsos set3;
             expl2 = new XPRBprob("example2");
             for(i=0;i<5;i++) x[i] = expl2.newVar("x");
             l = new XPRBexpr();
             for(i=1;i<4;i++) l.add(x[i].mul(i));
             set3 = expl2.newSos("sos2", XPRB.S2);
             set3.add(l);
         
        Parameters:
        l - linear expression
        Throws:
        java.lang.ArithmeticException
      • print

        public void print()
        Print out a Special Ordered Set. This method is not available in the Student Edition.
             XPRBprob expl2;
             XPRBsos set1;
             expl2 = new XPRBprob("example2");
             set1 = expl2.newSos("sos1", XPRB.S1);
             set1.print();
         
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class  java.lang.Object
        See Also:
        getName()

© 2001-2024 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.