com.opttek.optquest
Class COptQuestObjective

java.lang.Object
  extended bycom.opttek.optquest.COptQuestObjective
Direct Known Subclasses:
COptQuestObjectiveFunction, COptQuestPortfolioObjective, COptQuestStringObjective, COptQuestUserControlledObjective

public class COptQuestObjective
extends java.lang.Object

The COptQuestObjective class is a pure virtual class that defines the objective of the optimization. Objective values can be calculated in one of four ways: - the user supplies an objective value in the Evaluate() method of COptQuestOptimization - the user can provide an objective equation that is evaluated by the OptQuest Engine - the user can provide a COptQuestObjectiveFunction which defines a linear objective expressed as COptQuestVariables and coefficients. - the user defines a statistic and measure which is used for portfolio analysis. Evalution is performed by the OptQuest Engine.


Constructor Summary
COptQuestObjective()
           
 
Method Summary
 boolean GetBestFeasible()
          Returns true if the best solution did not violate any linear or non-linear constraints.
 double GetBestValue()
          Returns the objective value for the best solution.
 boolean GetCurrentFeasible()
          Returns true if the current solution did not violate any linear or non-linear constraints.
 boolean GetCurrentFeasible(int pID)
          Returns true if the current solution associated with the pID did not violate any linear or non-linear constraints.
 double GetCurrentValue()
          Returns the objective value for the current solution.
 double GetCurrentValue(int pID)
          Returns the objective value for the current solution when using parallel optimization.
 boolean GetNthBestFeasible()
          Returns true if the Nth best solution did not violate any linear or non-linear constraints.
 double GetNthBestValue()
          Returns the objective value for the Nth best solution where the Nth best is identified by the COptQuestOptimization.SetNthBest() method.
 boolean IsLinear()
          Returns true if the objective is a linear function.
 boolean IsMaximize()
          Returns true if the goal of the optimization is to maximize the objective value.
 boolean IsMinimize()
          Returns true if the goal of the optimization is to minimize the objective value.
 void SetCurrentValue(double val)
          Used to set the value of the objective for the current solution.
 void SetCurrentValue(int pID, double val)
          Used to set the objective value for the current solution when using parallel optimzation.
 void SetMaximize()
          Sets the goal of the optimization to maximize the objective value.
 void SetMinimize()
          Sets the goal of the optimization to minimize the objective value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

COptQuestObjective

public COptQuestObjective()
Method Detail

SetMaximize

public void SetMaximize()
Sets the goal of the optimization to maximize the objective value.


IsMaximize

public boolean IsMaximize()
Returns true if the goal of the optimization is to maximize the objective value.

Returns:
true if the objective is being maximized. False if it is being minimized.

SetMinimize

public void SetMinimize()
Sets the goal of the optimization to minimize the objective value.


IsMinimize

public boolean IsMinimize()
Returns true if the goal of the optimization is to minimize the objective value.

Returns:
true if the objective is being minimized. False if it is being maximized.

IsLinear

public boolean IsLinear()
Returns true if the objective is a linear function. This is true if the user defined the objective as a COptQuestObjectiveFunction or if the user defined the objective as a COptQuestStringObjective and the string expression is a linear expression using decision variables and coefficients.

Returns:

GetBestValue

public double GetBestValue()
Returns the objective value for the best solution.

Returns:

GetNthBestValue

public double GetNthBestValue()
Returns the objective value for the Nth best solution where the Nth best is identified by the COptQuestOptimization.SetNthBest() method.

Returns:

GetBestFeasible

public boolean GetBestFeasible()
Returns true if the best solution did not violate any linear or non-linear constraints.

Returns:

GetNthBestFeasible

public boolean GetNthBestFeasible()
Returns true if the Nth best solution did not violate any linear or non-linear constraints. The Nth best solution is identified by the COptQuestOptimization.SetNthBest() method.

Returns:

GetCurrentFeasible

public boolean GetCurrentFeasible()
Returns true if the current solution did not violate any linear or non-linear constraints.

Returns:

GetCurrentValue

public double GetCurrentValue()
                       throws COptQuestException
Returns the objective value for the current solution.

Returns:
the objective value for the current solution.
Throws:
COptQuestException

SetCurrentValue

public void SetCurrentValue(double val)
                     throws COptQuestException
Used to set the value of the objective for the current solution. This method should be called from the Evaluate() method when the user is calculating the objective value.

Parameters:
val - value of the objective
Throws:
COptQuestException

SetCurrentValue

public void SetCurrentValue(int pID,
                            double val)
                     throws COptQuestException
Used to set the objective value for the current solution when using parallel optimzation. This method should be called from the Evaluate() method when the user is calculating the objective value. The pID parameter is the value from COptQuestOptimization.Evaluate().

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

GetCurrentValue

public double GetCurrentValue(int pID)
                       throws COptQuestException
Returns the objective value for the current solution when using parallel optimization. The pID parameter is the value from COptQuestOptimization.Evaluate().

Parameters:
pID -
Returns:
Throws:
COptQuestException

GetCurrentFeasible

public boolean GetCurrentFeasible(int pID)
                           throws COptQuestException
Returns true if the current solution associated with the pID did not violate any linear or non-linear constraints. The pID parameter is the value from COptQuestOptimization.Evaluate().

Parameters:
pID -
Returns:
Throws:
COptQuestException