com.opttek.optquest
Class COptQuestRequirement

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

public abstract class COptQuestRequirement
extends java.lang.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 feasiblity 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 COptQuestOptimization::Evaluate() method and then set the value using the COptQuestSolution.SetRequirementValue() or COptQuestRequirement::SetCurrentValue() method.


Constructor Summary
COptQuestRequirement()
          Default constructor
COptQuestRequirement(double lower, double upper)
          Constructor that sets the lower and upper bound of the requirement.
COptQuestRequirement(java.lang.String name, double lower, double upper)
          Constructor that assigns a name to the requirement and sets the lower and upper bound of the requirement.
 
Method Summary
 double GetBestValue()
          Deprecated. Use COptQuestOptimization::GetBestSolution().GetRequirementValue().
 double GetCurrentValue()
          Deprecated. Call COptQuestOptimization::GetCurrentSolution().GetRequirementValue()
 double GetCurrentValue(int pID)
          Deprecated. Use COptQuestSolution.GetRequirementValue()
 double GetLowerBound()
          Returns the value of the requirement's lower bound
 java.lang.String GetName()
          Returns the name of the requirement
 double GetNthBestValue()
          Deprecated. Use COptQuestOptimization::GetNthBestSolution().GetRequirementValue().
 int GetPortfolioMeasure()
          Returns the portfolio measure set by the SetPortfolioMeasure() method.
 int GetPortfolioStatistic()
          Returns the portfolio statistic defined by the SetPortfolioStatistic() method.
 double GetPortfolioStatisticValue()
          Returns the statistic value defined by the SetPortfolioStatistic() method.
 java.lang.String GetType()
           
 double GetUpperBound()
          Returns the value of the requirement's upper bound
 boolean IsGoal()
          Returns true if the requirement has been set as a goal rather than a hard requirement.
 void SetCurrentValue(double Value)
          Deprecated. Use COptQuestOptimization::GetCurrentSolution().SetRequirementValue()
 void SetCurrentValue(int pID, double Value)
          Deprecated. Use COptQuestSolution.SetRequirementValue();
 void SetGoal(boolean goalValue)
          Makes the requirement a goal where the solution is not marked as infeasible.
 void SetLowerBound(double lowerBound)
          Sets the lower bound to the input value
 void SetName(java.lang.String name)
          Assigns a name to the requirement
 void SetPortfolioMeasure(int measure)
          Defines the measure for the portfolio objective.
 void SetPortfolioStatistic(int statistic, double statisticValue)
          Used for portfolio optimizations which can define a requirement based on a measure and a statistic.
 void SetReplicationConfidence(int level, double errPercent)
           
 void SetTolerance(double tolerance)
           
 void SetUpperBound(double upperBound)
          Sets the upper bound to the input value
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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(java.lang.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 Detail

SetName

public void SetName(java.lang.String name)
Assigns a name to the requirement

Parameters:
name - alphanumeric name

GetName

public java.lang.String GetName()
Returns the name of the requirement

Returns:
alphanumeric name assigned to the requirement

GetType

public java.lang.String GetType()

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.

SetCurrentValue

public void SetCurrentValue(double Value)
                     throws COptQuestException
Deprecated. Use COptQuestOptimization::GetCurrentSolution().SetRequirementValue()

Throws:
COptQuestException

SetCurrentValue

public void SetCurrentValue(int pID,
                            double Value)
                     throws COptQuestException
Deprecated. Use COptQuestSolution.SetRequirementValue();

Throws:
COptQuestException

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

GetCurrentValue

public double GetCurrentValue()
                       throws COptQuestException
Deprecated. Call COptQuestOptimization::GetCurrentSolution().GetRequirementValue()

Throws:
COptQuestException

GetCurrentValue

public double GetCurrentValue(int pID)
                       throws COptQuestException
Deprecated. Use COptQuestSolution.GetRequirementValue()

Throws:
COptQuestException

GetBestValue

public double GetBestValue()
Deprecated. Use COptQuestOptimization::GetBestSolution().GetRequirementValue().


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

GetNthBestValue

public double GetNthBestValue()
Deprecated. Use COptQuestOptimization::GetNthBestSolution().GetRequirementValue().


SetPortfolioStatistic

public void SetPortfolioStatistic(int statistic,
                                  double statisticValue)
                           throws COptQuestException
Used for portfolio optimizations which can define a requirement based on a measure and a statistic. The statistics OCLP_PERCENTILE, OCLP_SEMI1STDDEV, OCLP_SEMI2STDDEV and OCLP_PROBABILITY require 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_SEMI1STDDEV = 5
  • OCLP_VARIANCE = 6
  • OCLP_SEMI1VARIANCE = 7
  • OCLP_COEFFOFVAR = 8
  • OCLP_COEFFOFSEMI1VAR = 9
  • OCLP_PROBABILITY = 10
  • OCLP_SEMI2STDDEV = 11
  • OCLP_SEMI2VARIANCE = 12
  • OCLP_COEFFOFSEMI2VAR = 13
statisticValue - - target value for OCLP_PERCENTILE, OCLP_SEMI1STDDEV, OCLP_SEMI2STDDEV and OCLP_PROBABILITY
Throws:
COptQuestException

GetPortfolioStatistic

public int GetPortfolioStatistic()
                          throws COptQuestException
Returns the portfolio statistic defined by the SetPortfolioStatistic() method.

Returns:
statistic
  • OCLP_MEAN = 1
  • OCLP_MEDIAN = 2
  • OCLP_PERCENTILE = 3
  • OCLP_STDDEV = 4
  • OCLP_SEMI1STDDEV = 5
  • OCLP_VARIANCE = 6
  • OCLP_SEMI1VARIANCE = 7
  • OCLP_COEFFOFVAR = 8
  • OCLP_COEFFOFSEMI1VAR = 9
  • OCLP_PROBABILITY = 10
  • OCLP_SEMI2STDDEV = 11
  • OCLP_SEMI2VARIANCE = 12
  • OCLP_COEFFOFSEMI2VAR = 13
Throws:
COptQuestException

GetPortfolioStatisticValue

public double GetPortfolioStatisticValue()
                                  throws COptQuestException
Returns the statistic value defined by the SetPortfolioStatistic() method. The statistics OCLP_PERCENTILE, OCLP_SEMI1STDDEV, OCLP_SEMI2STDDEV and OCLP_PROBABILITY require the statisticValue to be set.

Returns:
the target value for OCLP_PERCENTILE, OCLP_SEMI1STDDEV, OCLP_SEMI2STDDEV and OCLP_PROBABILITY. Returns 0 for all other statistics.
Throws:
COptQuestException

SetPortfolioMeasure

public void SetPortfolioMeasure(int measure)
                         throws COptQuestException
Defines the measure for the portfolio objective.

Parameters:
measure -
  • OCLP_NPV = 1
  • OCLP_IRR = 2
  • OCLP_PBP = 3
Throws:
COptQuestException - if the measure is invalid.

GetPortfolioMeasure

public int GetPortfolioMeasure()
                        throws COptQuestException
Returns the portfolio measure set by the SetPortfolioMeasure() method.

Returns:
the integer value that identifies the portfolio measure
  • OCLP_NPV = 1
  • OCLP_IRR = 2
  • OCLP_PBP = 3
Throws:
COptQuestException

SetTolerance

public void SetTolerance(double tolerance)

SetReplicationConfidence

public void SetReplicationConfidence(int level,
                                     double errPercent)