Class COptQuestRequirement

java.lang.Object
com.opttek.optquest.COptQuestRequirement
Direct Known Subclasses:
COptQuestDualRequirement, COptQuestLowerRequirement, COptQuestPortfolioRequirement, COptQuestUpperRequirement

public abstract class COptQuestRequirement extends Object
The COptQuestRequirement class is a pure virtual class that allows you to define a non-linear constraint. You compute the value of the requirement and the OptQuest Engine checks for feasibility using the value you computed and the bounds you defined. The requirement is feasible if the value you computed is between the lower bound and upper bound of the requirement.

You would compute a value for the COptQuestRequirement object in the Evaluate(COptQuestSolution) method and then set the value using the SetRequirementValue(COptQuestRequirement, double) method.
  • Constructor Details

    • COptQuestRequirement

      public COptQuestRequirement(double lower, double upper)
      Constructor that sets the lower and upper bound of the requirement.
      Parameters:
      lower - a value between -pow(2,31) and +pow(2,31)-1
      upper - a value between -pow(2,31) and +pow(2,31)-1
    • COptQuestRequirement

      public COptQuestRequirement(String name, double lower, double upper)
      Constructor that assigns a name to the requirement and sets the lower and upper bound of the requirement.
      Parameters:
      name - - alphanumeric name
      lower - a value between -pow(2,31) and +pow(2,31)-1
      upper - a value between -pow(2,31) and +pow(2,31)-1
    • COptQuestRequirement

      public COptQuestRequirement()
      Default constructor
  • Method Details

    • SetName

      public void SetName(String name)
      Assigns a name to the requirement
      Parameters:
      name - alphanumeric name
    • GetName

      public String GetName()
      Returns the name of the requirement
      Returns:
      alphanumeric name assigned to the requirement
    • SetGoal

      public void SetGoal(boolean goalValue)
      Makes the requirement a goal where the solution is not marked as infeasible. A solution that satisfies the bounds of the requirement is considered better than a solution that violates the bounds.
    • IsGoal

      public boolean IsGoal()
      Returns true if the requirement has been set as a goal rather than a hard requirement.
      Returns:
      true if the requirement bound is a target goal.
    • hasUserVariables

      public boolean hasUserVariables()
    • setHasUserVariables

      public void setHasUserVariables(boolean hasUserVariables)
    • SetLowerBound

      public void SetLowerBound(double lowerBound)
      Sets the lower bound to the input value
      Parameters:
      lowerBound - a value between -pow(2,31) and +pow(2,31)-1
    • SetUpperBound

      public void SetUpperBound(double upperBound)
      Sets the upper bound to the input value
      Parameters:
      upperBound - a value between -pow(2,31) and +pow(2,31)-1
    • GetLowerBound

      public double GetLowerBound()
      Returns the value of the requirement's lower bound
      Returns:
      the value of the lower bound
    • GetUpperBound

      public double GetUpperBound()
      Returns the value of the requirement's upper bound
      Returns:
      the value of the upper bound
    • SetReplicationStatistic

      public void SetReplicationStatistic(int statistic, double statisticValue) throws COptQuestException
      When running multiple replications, you can define a statistic which is used to calculate the requirement value using the values of the replications. The statistic OCLP_PERCENTILE requires the statisticValue to be set. This value is ignored for all other statistics.
      Parameters:
      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
      statisticValue - - target value for OCLP_PERCENTILE
      Throws:
      COptQuestException - if a problem is encountered
    • 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 SetReplicationStatistic() method. The statistic OCLP_PERCENTILE requires the statisticValue to be set.
      Returns:
      the target value for OCLP_PERCENTILE. Returns 0 for all other statistics.
    • GetReplicationConfidenceLevel

      public int GetReplicationConfidenceLevel()
      Returns the confidence level set by the call to SetReplicationConfidence().
      Returns:
      1 = 80%, 2 = 90%, 3 - 95%, 4 = 98%, 5 = 99%, 6 = 99.9%
    • GetReplicationConfidenceErrorPercent

      public double GetReplicationConfidenceErrorPercent()
      Return the confidence error percent set by the call to SetReplicationConfidence()
      Returns:
      a value > 0 and < 1.
    • SetTolerance

      public void SetTolerance(double tolerance)
    • SetReplicationConfidence

      public void SetReplicationConfidence(int level, double errPercent)
      Sets the values used for confidence testing. Confidence testing is only available when the replication statistic is the mean value, COptQuestOptimization.OCLP_MEAN For a requirement, the confidence type 1 is always used (stop replications after minimum replications when confidence level or maximum replications is reached).
      Parameters:
      level -
      • 1 = 80%
      • 2 = 90%
      • 3 - 95%
      • 4 = 98%
      • 5 = 99%
      • 6 = 99.9%
      errPercent - the error percentage as a value > 0 and < 1.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object