Class COptQuestUserControlledVariable

java.lang.Object
com.opttek.optquest.COptQuestVariable
com.opttek.optquest.COptQuestUserControlledVariable

public class COptQuestUserControlledVariable extends COptQuestVariable
The COptQuestUserControlledVariable class allows you to define a variable where you set the value of the variable. Unlike a COptQuestVariable whose possible value is determined by the OptQuest Engine, you provide the values for COptQuestUserControlledVariable objects.

COptQuestUserControlledVariable objects can be used in the mathematical expression of COptQuestStringConstraint objects or a COptQuestStringObjective object. For example, you may define a COptQuestUserControlledVariable that represents a risk calculation and use the risk value in a COptQuestStringConstraint that says risk must be less than or equal to n. In the Evaluate(COptQuestSolution) method, you would compute the risk value and use the SetVariableValue(COptQuestVariable, double) method to set the risk value in the solution. The OptQuestEngine would use this value when checking the constraint for feasibility.
  • Constructor Details

    • COptQuestUserControlledVariable

      public COptQuestUserControlledVariable(String name)
      Constructor that assigns a name to the 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 []
    • COptQuestUserControlledVariable

      public COptQuestUserControlledVariable()
      Default constructor
  • Method Details

    • SetLowerBound

      public void SetLowerBound(double lowerBound) throws COptQuestException
      Not valid for COptQuestUserControlledVariables
      Overrides:
      SetLowerBound in class COptQuestVariable
      Parameters:
      lowerBound - a value between -pow(2,31) and +pow(2,31)-1
      Throws:
      COptQuestException - if invalid bounds provided
    • SetUpperBound

      public void SetUpperBound(double upperBound) throws COptQuestException
      Not valid for COptQuestUserControlledVariables
      Overrides:
      SetUpperBound in class COptQuestVariable
      Parameters:
      upperBound - 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
      Not valid for COptQuestUserControlledVariables
      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
    • SetReplicationStatistic

      public void SetReplicationStatistic(int statistic, double statisticValue) throws COptQuestException
      Defines the statistic for the replications of a user controlled variable. The OCLP_PERCENTILE statistic requires the statisticValue to be set. The statistic value is ignored for all other statistics.
      Parameters:
      statistic - - integer defining the statistic to be used
      • OCLP_MEAN = 1
      • OCLP_MEDIAN = 2
      • OCLP_PERCENTILE = 3
      • OCLP_STDDEV = 4
      • OCLP_VARIANCE = 6
      • OCLP_COEFFOFVAR = 8
      • OCLP_MIN = 14
      • OCLP_MAX = 15
      • OCLP_SUM = 16
      statisticValue - - target value if using OCLP_PERCENTILE
      Throws:
      COptQuestException - if the statistic or statistic value are invalid.
    • GetReplicationStatistic

      public int GetReplicationStatistic()
      Returns the statistic defined by the SetReplicationStatistic() method.
      Returns:
      statistic
      • OCLP_MEAN = 1
      • OCLP_MEDIAN = 2
      • OCLP_PERCENTILE = 3
      • OCLP_STDDEV = 4
      • OCLP_VARIANCE = 6
      • OCLP_COEFFOFVAR = 8
      • OCLP_MIN = 14
      • OCLP_MAX = 15
      • OCLP_SUM = 16
    • GetReplicationStatisticValue

      public double GetReplicationStatisticValue()
      Returns the statistic value defined by the SetStatistic() method. The statistic OCLP_PERCENTILE requires the statisticValue to be set.
      Returns:
      the target value for OCLP_PERCENTILE. Returns 0 for all other statistics.