com.opttek.optquest
Class COptQuestVariable

java.lang.Object
  extended by com.opttek.optquest.COptQuestVariable
Direct Known Subclasses:
COptQuestContinuousVariable, COptQuestDiscountRateVariable, COptQuestDiscreteVariable, COptQuestPermutationVariable, COptQuestUserControlledVariable

public abstract class COptQuestVariable
extends java.lang.Object

COptQuestVariable is a pure virtual class that defines a decision variable.


Constructor Summary
COptQuestVariable()
          Default constructor
COptQuestVariable(double lowerBound, double upperBound)
          Constructor that sets the lower bound and upper bound.
COptQuestVariable(java.lang.String name)
          Constructor that assigns a name to the variable.
COptQuestVariable(java.lang.String name, double lowerBound, double upperBound)
          Constructor that assigns a name to the variable and sets the lower bound and upper bound.
 
Method Summary
 double GetBestValue()
          Deprecated. Use COptQuestOptimization::GetBestSolution().GetVariableValue()
 double GetCurrentValue()
          Deprecated. Use COptQuestOptimization::GetCurrentSolution().GetVariableValue().
 double GetCurrentValue(int pID)
          Deprecated. Use COptQuestSolution.GetVariableValue().
 double GetDOELowerBound()
           
 double GetDOEUpperBound()
           
 double GetExclusiveLowerBoundAt(int index)
          Returns the lower bound of the exclusive range identified by the index
 double GetExclusiveUpperBoundAt(int index)
          Returns the upper bound of the exclusive range identified by the index
 double GetLowerBound()
           
 java.lang.String GetName()
           
 double GetNthBestValue()
          Deprecated. Use COptQuestOptimization::GetNthBestSolution().GetVariableValue()
 int GetNumberOfExclusiveRanges()
          Returns the number of exclusive ranges defined for this variable.
 int GetNumberOfObservations()
          Returns the number of elements in the observations array.
 int GetNumberOfPeriods()
          Returns the number of periods for project.
 double GetObservationAt(int index)
          Returns the value of the observation at the specified index.
 double[] GetObservations()
          Returns the array of observations set in the SetObservations() method
 double GetPeriodObservationAt(int periodNum, int index)
          Returns the value of the observations for the specified period and index
 double[] GetPeriodObservations(int periodNum)
          Returns the array of observations for the requested period.
 double GetQuality(int qualityNum)
          For internal use
 double GetResource(int resourceNum, int periodNum)
          For internal use
 double GetStepSize()
           
 double GetSuggestedValue()
           
 java.lang.String GetType()
           
 double GetUpperBound()
           
 void SetCurrentValue(double Value)
          Deprecated. Use COptQuestSolution.SetVariableValue() Method that sets the current value of the variable. The user can call this method to modifiy a solution suggested by the OptQuest Engine or to set the value of a COptQuestUserControlledVariable whose value is always set by the user.
 void SetCurrentValue(int pID, double Value)
          Deprecated. Use COptQuestSolution.SetVariableValue() Method that sets the current value of the variable when using parallel optimization. The user can call this method to modifiy a solution suggested by the OptQuest Engine or to set the value of a COptQuestUserControlledVariable whose value is always set by the user.
 void SetExclusiveRange(double low, double high)
          Defines a range of values that will be excluded as possible solutions.
 void SetLowerBound(double lowerBound)
          Sets the lower bound of the decision variable
 void SetName(java.lang.String name)
          Assigns a name to the variable.
 void SetNumberOfPeriods(int numPeriods)
          Sets the number of periods in the project.
 void SetNumberOfQualityMeasures(int numQualityMeasures)
          For internal use
 void SetNumberOfResources(int numResources)
          For internal use
 void SetObservations(int numObservations, double[] observations)
          Sets the observations for the project.
 void SetPeriodObservations(int numObservations, int periodNum, double[] observations)
          Sets the observations by period for a portfolio optimization.
 void SetQuality(int qualityNum, double amount)
          For internal use
 void SetResource(int resourceNum, int periodNum, double amount)
          For internal use
 void SetStepSize(double value)
           
 void SetSuggestedValue(double Value)
          Deprecated. Use COptQuestOptimization::CreateSolution() to create an empty solution. Use the COptQuestSolution::SetVariableValue() method to set the variable's value for the solution. Call COptQuestOptimization::AddSuggestedSolution() to add the completed soluition to the optmization problem.
 void SetUpperBound(double upperBound)
          Sets the upper bound of the decision variable
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

COptQuestVariable

public COptQuestVariable(java.lang.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 COptQuestStringConstraint equation, the name should be enclosed in square brackets [] in the COptQuestStringConstraint string equation.

COptQuestVariable

public COptQuestVariable()
Default constructor


COptQuestVariable

public COptQuestVariable(java.lang.String name,
                         double lowerBound,
                         double upperBound)
Constructor that assigns a name to the variable and sets the lower bound and upper bound.

Parameters:
name - alphanumeric name. Note: the name can contain blanks or special characters. If the variable name is used in a COptQuestStringConstraint equation, the name should be enclosed in square brackets [] in the COptQuestStringConstraint string equation.
lowerBound - a value between -pow(2,31) and +pow(2,31)-1
upperBound - a value between -pow(2,31) and +pow(2,31)-1

COptQuestVariable

public COptQuestVariable(double lowerBound,
                         double upperBound)
Constructor that sets the lower bound and upper bound.

Parameters:
lowerBound - a value between -pow(2,31) and +pow(2,31)-1
upperBound - a value between -pow(2,31) and +pow(2,31)-1
Method Detail

SetCurrentValue

public void SetCurrentValue(double Value)
                     throws COptQuestException
Deprecated. Use COptQuestSolution.SetVariableValue() Method that sets the current value of the variable. The user can call this method to modifiy a solution suggested by the OptQuest Engine or to set the value of a COptQuestUserControlledVariable whose value is always set by the user.

Parameters:
Value - - value of the variable
Throws:
COptQuestException

SetCurrentValue

public void SetCurrentValue(int pID,
                            double Value)
                     throws COptQuestException
Deprecated. Use COptQuestSolution.SetVariableValue() Method that sets the current value of the variable when using parallel optimization. The user can call this method to modifiy a solution suggested by the OptQuest Engine or to set the value of a COptQuestUserControlledVariable whose value is always set by the user.

Parameters:
pID - parallel ID from COptQuestOptimization::Evaluate()
Value - - value of the variable
Throws:
COptQuestException

SetLowerBound

public void SetLowerBound(double lowerBound)
                   throws COptQuestException
Sets the lower bound of the decision variable

Parameters:
lowerBound - a value between -pow(2,31) and +pow(2,31)-1
Throws:
COptQuestException

SetUpperBound

public void SetUpperBound(double upperBound)
                   throws COptQuestException
Sets the upper bound of the decision variable

Parameters:
upperBound - a value between -pow(2,31) and +pow(2,31)-1
Throws:
COptQuestException

SetExclusiveRange

public void SetExclusiveRange(double low,
                              double high)
                       throws COptQuestException
Defines a range of values that will be excluded as possible solutions. Any value > low and < high will be excluded. Multiple ranges can be defined on one variable.

Parameters:
low - - any value > low will be excluded
high - - any value < high will be exluded
Throws:
COptQuestException

SetSuggestedValue

public void SetSuggestedValue(double Value)
Deprecated. Use COptQuestOptimization::CreateSolution() to create an empty solution. Use the COptQuestSolution::SetVariableValue() method to set the variable's value for the solution. Call COptQuestOptimization::AddSuggestedSolution() to add the completed soluition to the optmization problem.


SetName

public void SetName(java.lang.String name)
Assigns a name to the variable. Names must be alphanumeric and cannot be a function name recognized by the COptQuestEquationSolver.

Parameters:
name - = name of the variable.

GetCurrentValue

public double GetCurrentValue()
                       throws COptQuestException
Deprecated. Use COptQuestOptimization::GetCurrentSolution().GetVariableValue().

Throws:
COptQuestException

GetCurrentValue

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

Throws:
COptQuestException

GetBestValue

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


GetLowerBound

public double GetLowerBound()

GetUpperBound

public double GetUpperBound()

GetDOEUpperBound

public double GetDOEUpperBound()

GetDOELowerBound

public double GetDOELowerBound()

GetSuggestedValue

public double GetSuggestedValue()

GetName

public java.lang.String GetName()

GetType

public java.lang.String GetType()

GetStepSize

public double GetStepSize()

GetNumberOfExclusiveRanges

public int GetNumberOfExclusiveRanges()
Returns the number of exclusive ranges defined for this variable. Each call to COptQuestVariable.SetExclusiveRange() defines one range.

Returns:
- the number of exclusive ranges defined for this variable.

GetExclusiveLowerBoundAt

public double GetExclusiveLowerBoundAt(int index)
Returns the lower bound of the exclusive range identified by the index

Parameters:
index - 0 based index
Returns:
lower bound of the exclusive range identified by the index

GetExclusiveUpperBoundAt

public double GetExclusiveUpperBoundAt(int index)
Returns the upper bound of the exclusive range identified by the index

Parameters:
index - 0 based index
Returns:
upper bound of the exclusive range identified by the index

GetNthBestValue

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


SetObservations

public void SetObservations(int numObservations,
                            double[] observations)
Sets the observations for the project.

Parameters:
numObservations - - number of entries in the observations array
observations - - array representing the observations for the project.

GetNumberOfObservations

public int GetNumberOfObservations()
Returns the number of elements in the observations array.

Returns:
- number of observations. Value was set by the SetObservations() method.

GetObservations

public double[] GetObservations()
Returns the array of observations set in the SetObservations() method

Returns:
array of doubles representing the obeservations for this project.

GetObservationAt

public double GetObservationAt(int index)
                        throws COptQuestException
Returns the value of the observation at the specified index.

Parameters:
index - - value between 0 and the number of observations -1
Returns:
the value of the observation at the specified index.
Throws:
COptQuestException

GetPeriodObservationAt

public double GetPeriodObservationAt(int periodNum,
                                     int index)
                              throws COptQuestException
Returns the value of the observations for the specified period and index

Parameters:
periodNum - - value between 1 and the total number of periods.
index - - value between 0 and the number of observations -1
Returns:
the value of the observation at the specified period and index
Throws:
COptQuestException

SetNumberOfPeriods

public void SetNumberOfPeriods(int numPeriods)
                        throws COptQuestException
Sets the number of periods in the project.

Parameters:
numPeriods - - value > 0
Throws:
COptQuestException

GetNumberOfPeriods

public int GetNumberOfPeriods()
Returns the number of periods for project. Value was set by the SetNumberOfPeriods() method.

Returns:
the number of periods.

SetPeriodObservations

public void SetPeriodObservations(int numObservations,
                                  int periodNum,
                                  double[] observations)
                           throws COptQuestException
Sets the observations by period for a portfolio optimization.

Parameters:
numObservations - - number of elements in the observations array
periodNum - - identifies the period number. The value must be between 1 and the value set by the SetNumberOfPeriods() method.
observations - - array representing the observations for the project.
Throws:
COptQuestException - if the number of observations for this period differs from the setting for another period.

GetPeriodObservations

public double[] GetPeriodObservations(int periodNum)
                               throws COptQuestException
Returns the array of observations for the requested period. The observations for the period were set by the SetPeriodObservations() method. Returns null if no observations were defined for this period.

Parameters:
periodNum - - Number from 1 to number of periods set by SetNumberOfPeriods();
Returns:
array of observations
Throws:
COptQuestException

SetNumberOfResources

public void SetNumberOfResources(int numResources)
For internal use


SetResource

public void SetResource(int resourceNum,
                        int periodNum,
                        double amount)
For internal use


GetResource

public double GetResource(int resourceNum,
                          int periodNum)
For internal use


SetNumberOfQualityMeasures

public void SetNumberOfQualityMeasures(int numQualityMeasures)
For internal use


SetQuality

public void SetQuality(int qualityNum,
                       double amount)
For internal use


GetQuality

public double GetQuality(int qualityNum)
For internal use


SetStepSize

public void SetStepSize(double value)
                 throws COptQuestException
Throws:
COptQuestException