Class COptQuestSolutionSet

java.lang.Object
com.opttek.optquest.COptQuestSolutionSet

public class COptQuestSolutionSet extends Object
The COptQuestSolutionSet class allows you to select a set of solutions and perform statistical analysis or sensitivity analysis on the set. Solutions are selected using a filter that you implement via the ISolutionFilter interface. A COptQuestSolutionSet object is created by calling COptQuestOptimization.CreateSolutionSet(). A filter is added by the COptQuestSolutionSet.SetSolutionFilter() method. The solution set is loaded by the COptQuestSolutionSet.LoadSolutionSet() method where you specify the number of solutions you want in the set and how you want the solutions to be ordered. If not ISolutionFilter is defined, solutions are included in the set until the count requested is satisfied.
  • Field Details

    • ORDER_NTHBEST

      public static final int ORDER_NTHBEST
      Identifies how the solutions should be ordered in the set. ORDER_NTHEBEST - solutions will be ordered using the objective value starting with the solution that had the best objective value.
      See Also:
    • ORDER_ITERATION

      public static final int ORDER_ITERATION
      Identifies how the solutions should be ordered in the set. ORDER_ITERATION - solutions are ordered based on the iteration counter.
      See Also:
    • ORDER_DONTCARE

      public static final int ORDER_DONTCARE
      Identifies how the solutions should be ordered in the set. ORDER_DONTCARE - no guaranteed order.
      See Also:
  • Method Details

    • SetSolutionFilter

      public void SetSolutionFilter(ISolutionFilter userFilter)
      Defines a ISolutionFilter interface that will be used to select solutions. If no filter is specified, solutions are added to the set based on the number requested and the orderBy parameter of the LoadSolutionSet() method.
    • GetNumberOfSolutions

      public int GetNumberOfSolutions()
      Returns the actual number of solutions in the solution set.
      Returns:
      The number of solutions in the solution set
    • LoadSolutionSet

      public void LoadSolutionSet(int numSolutions, int orderBy) throws COptQuestException
      Loads the solution set with the specified number of solutions, ordered by the orderBy parameter. You determine what solutions are included in the set by implementing the IncludeInSet() method of the ISolutionFilter interface. If no filter is specified, solutions are added to the set based on the numSolutions parameter and the orderBy parameter.
      Parameters:
      numSolutions - - if -1, all solutions are examined. Otherwise the number of solutions you want in the set.
      orderBy - specifies how the solutions should be sorted. COptQuestSolutionSet.ORDER_NTHBEST - solutions are sorted by their objective value. COptQuestSolutionSet.ORDER_ITERATION - solutions are sorted by their iteration COptQuestSolutionSet.ORDER_DONTCARE - user doesn't care about ordering solutions
      Throws:
      COptQuestException - if a problem is encountered
    • GetSolutionsInSet

      public ArrayList<COptQuestSolution> GetSolutionsInSet()
      Returns the list of COptQuestSolution objects that satisfied the filter. The list is ordered based on the orderBy parameter specified in the LoadSolutionSet() method.
      Returns:
      array of solutions in the set
    • CalculateStatistic

      public double CalculateStatistic(COptQuestVariable var, int statistic, double statisticValue) throws COptQuestException
      Using the solution set values of the specified variable, calculate the specified statistic.
      Parameters:
      var - COptQuestVariable to be evaluated.
      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
      • OCLP_MIN = 14
      • OCLP_MAX = 15
      statisticValue - target values for OCLP_PERCENTILE, OCLP_SEMI1STDDEV, OCLP_SEMI2STDDEV, OCLP_PROBABILITY
      Returns:
      the result of the calculation
      Throws:
      COptQuestException - if a problem is encountered
    • CalculateStatistic

      public double CalculateStatistic(COptQuestSingleObjective obj, int statistic, double statisticValue) throws COptQuestException
      Using the solution set values for the objective, calculate the specified statistic
      Parameters:
      obj - COptQuestObjective to be evaluated.
      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
      • OCLP_MIN = 14
      • OCLP_MAX = 15
      statisticValue - target values for OCLP_PERCENTILE, OCLP_SEMI1STDDEV, OCLP_SEMI2STDDEV, OCLP_PROBABILITY
      Returns:
      the result of the calculation
      Throws:
      COptQuestException - if a problem is encountered
    • CalculateSensitivity

      public double CalculateSensitivity(COptQuestVariable var) throws COptQuestException
      Calculate a sensitivity score for the input variable. Score is calculated as (the range of values in the solution set)/(var upper bound - var lower bound) If a variable's sensitivity score is -1, the variables value is fixed. (low bound = high bound) If a variable's sensitivity score is close to 1, the variable is considered very sensitive. If a variable's sensitivity score is close to 0, it is considered insensitive.
      Returns:
      -1 or a value between 0 and 1
      Throws:
      COptQuestException - if a problem is encountered
    • CalculateSensitivity

      public double CalculateSensitivity(COptQuestSingleObjective obj) throws COptQuestException
      Returns the sensitivity score for the objective. Score is calculated as (the range of values in the solution set)/best objective - worst objective in all solutions. If the solution set includes infeasible solutions, the denominator calculation will include infeasible solution. If the solution set contains only feasible solutions, the denominator calculation will only include feasible solutions. If the objective's sensitivity score is -1, then the solutions for this problem all had the same objective value. If the objective's sensitivity score is close to 1, the objective is considered very sensitive. If the objective's sensitivity score is close to 0, it is considered insensitive.
      Returns:
      objective's sensitivity score
      Throws:
      COptQuestException - if a problem is encountered