Class COptQuestBinaryVariable


public class COptQuestBinaryVariable extends COptQuestDiscreteVariable
The COptQuestBinaryVariable class defines a binary decision variable which is a discrete variable that can have a value of 0 or 1.
  • Constructor Details

    • COptQuestBinaryVariable

      public COptQuestBinaryVariable(String name)
      Constructor that assigns a name to the binary variable.
      Parameters:
      name - alphanumeric name. Note: The name can contain blanks or special characters. If the variable name is used in a COptQuestConstraintString equation, and it contains non-alphanumeric characters, the name should be enclosed in square brackets []
    • COptQuestBinaryVariable

      public COptQuestBinaryVariable()
      Default constructor.
  • Method Details

    • SetLowerBound

      public void SetLowerBound(double val) throws COptQuestException
      Illegal method for binary variables.
      Overrides:
      SetLowerBound in class COptQuestVariable
      Parameters:
      val - a value between -pow(2,31) and +pow(2,31)-1
      Throws:
      COptQuestException - if invalid bounds provided
    • SetUpperBound

      public void SetUpperBound(double val) throws COptQuestException
      Illegal method for binary variables.
      Overrides:
      SetUpperBound in class COptQuestVariable
      Parameters:
      val - a value between -pow(2,31) and +pow(2,31)-1
      Throws:
      COptQuestException - if invalid bounds provided
    • SetExclusiveRange

      public void SetExclusiveRange(double low, double high) throws COptQuestException
      Illegal method for binary variables.
      Overrides:
      SetExclusiveRange in class COptQuestVariable
      Parameters:
      low - - any value > low will be excluded
      high - - any value < high will be excluded
      Throws:
      COptQuestException - if invalid range provided
    • SetStepSize

      public void SetStepSize(double stepSize) throws COptQuestException
      Illegal method for binary variables, step size is always 1
      Overrides:
      SetStepSize in class COptQuestDiscreteVariable
      Parameters:
      stepSize - the step size which can be any value that is less than or equal to the difference between the upper bound and the lower bound. If the range is not divisible by the step size, the range is extended by extending the upper bound.
      Throws:
      COptQuestException - if step size is not valid for variable type
    • isZeroOne

      public boolean isZeroOne()
      Overrides:
      isZeroOne in class COptQuestDiscreteVariable