com.opttek.optquest
Class COptQuestRequirement

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

public 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 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()
          Returns the value of the requirement for the best solution
 double GetCurrentValue()
          Returns the value set by the SetCurrentValue() method
 double GetCurrentValue(int pID)
          Returns the current value in a parallel optimization.
 double GetLowerBound()
          Returns the value of the requirement's lower bound
 java.lang.String GetName()
          Returns the name of the requirement
 double GetNthBestValue()
          Returns the value of the requirement for the Nth best solution.
 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
 void SetCurrentValue(double Value)
          Sets the current value of the requirement
 void SetCurrentValue(int pID, double Value)
          Sets the current value of the requirement in a parallel optimization.
 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 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


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()

SetCurrentValue

public void SetCurrentValue(double Value)
                     throws COptQuestException
Sets the current value of the requirement

Parameters:
Value - value computed by the user in the COptQuestOptimization::Evaluate() method
Throws:
COptQuestException

SetCurrentValue

public void SetCurrentValue(int pID,
                            double Value)
                     throws COptQuestException
Sets the current value of the requirement in a parallel optimization.

Parameters:
pID - parrallel ID from the COptQuestOptimization::Evaluate() method
Value - value computed by the user in the COptQuestOptimization::Evaluate() method
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
Returns the value set by the SetCurrentValue() method

Returns:
the value set by the SetCurrentValue() method
Throws:
COptQuestException

GetCurrentValue

public double GetCurrentValue(int pID)
                       throws COptQuestException
Returns the current value in a parallel optimization. The value was set by the SetCurrentValue() method

Parameters:
pID - the parallel ID from the COptQuestOptimization::Evaluate() method
Returns:
the current value for the pID
Throws:
COptQuestException

GetBestValue

public double GetBestValue()
Returns the value of the requirement for the best solution

Returns:
the value of the requirement for the best solution

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()
Returns the value of the requirement for the Nth best solution. The Nth best solution is identified by the COptQuestOptimization::SetNthBest() method.

Returns:
the value of the requirement for the Nth best solution

SetPortfolioStatistic

public void SetPortfolioStatistic(int statistic,
                                  double statisticValue)
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

GetPortfolioStatistic

public int GetPortfolioStatistic()
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

GetPortfolioStatisticValue

public double GetPortfolioStatisticValue()
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.

SetPortfolioMeasure

public void SetPortfolioMeasure(int measure)
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()
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