Class OptQuestModel

java.lang.Object
com.opttek.optquest.OptQuestModel

public class OptQuestModel extends Object
The main class that defines an optimization model and creates and manages solutions
  • Field Details

    • inputs

      public final Map<String,com.opttek.optquest.COptQuestVariable> inputs
    • outputs

      public final Map<String,com.opttek.optquest.COptQuestUserControlledVariable> outputs
    • constraints

      public final Map<String,com.opttek.optquest.COptQuestStringConstraint> constraints
    • objectives

      public final Map<String,com.opttek.optquest.COptQuestStringObjective> objectives
    • RDSBins

      public final Map<com.opttek.optquest.COptQuestSingleObjective,double[]> RDSBins
    • solutions

      public List<OptQuestSolution> solutions
    • BestFound

      public static final int BestFound
      See Also:
    • Infeasible

      public static final int Infeasible
      See Also:
  • Constructor Details

    • OptQuestModel

      public OptQuestModel()
  • Method Details

    • SetLicense

      public boolean SetLicense(String license)
      License IDs are assigned by OptTek Systems, Inc. Call this method with the license assigned to you by OptTek. If no license is set, the demo license is used which limits the number of iterations to 50.
      Parameters:
      license - - license ID
      Returns:
      true if the method was successful.
    • LogSetup

      public boolean LogSetup(String filespec)
      LogSetup() logs the OptQuestModel setup in an xml formatted file. This is used for debugging optimization setup problems.
      Parameters:
      filespec - path to a file that will contain the logging info
      Returns:
      true if the method was successful.
    • LogSolutions

      public boolean LogSolutions(String filespec)
      LogSolutions() logs all solutions in a csv formatted file.
      Parameters:
      filespec - path to a file that will contain the solution log
      Returns:
      true if the method was successful.
    • AddContinuousVariable

      public boolean AddContinuousVariable(String name, double min, double max) throws com.opttek.optquest.COptQuestException
      Adds a continuous variable with the given name, minimum value and maximum value. A continuous variable can have any value between the minimum bound and the maximum bound.
      Parameters:
      name - - name of the variable. The name must be unique to the model and must not contain whitespace or semicolons.
      min - - minimum value for the continuous variable
      max - - maximum value for the continuous variable
      Returns:
      - true if the variable was added successfully; false if name is not unique in the model or contains whitespace or semicolons.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • AddIntegerVariable

      public boolean AddIntegerVariable(String name, double min, double max) throws com.opttek.optquest.COptQuestException
      Adds an integer variable with the given name, minimum value and maximum value. A integer variable can have any value between the minimum bound and the maximum bound.
      Parameters:
      name - - name of the variable. The name must be unique to the model and must not contain whitespace or semicolons.
      min - - minimum value for the integer variable
      max - - maximum value for the integer variable
      Returns:
      - true if the variable was added successfully; false if name is not unique in the model or contains whitespace or semicolons.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • AddDiscreteVariable

      public boolean AddDiscreteVariable(String name, double min, double max, double step) throws com.opttek.optquest.COptQuestException
      Adds a discrete variable with the given name, minimum value, maximum value and step size. Valid values are a multiple of the step size and between the minimum and maximum values. If the range of the variable is not divisible by the step size, the range is extended by extending the upper bound.
      Parameters:
      name - - name of the variable. The name must be unique to the model and must not contain whitespace or semicolons.
      min - - minimum value for the variable
      max - - maximum value for the variable
      step - - valid values are a multiple of the step size
      Returns:
      - true if the variable was added successfully; false if name is not unique in the model or contains whitespace or semicolons.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • AddBinaryVariable

      public boolean AddBinaryVariable(String name) throws com.opttek.optquest.COptQuestException
      Adds a binary variable with the given name.
      Parameters:
      name - - name of the variable. The name must be unique to the model and must not contain whitespace or semicolons.
      Returns:
      - true if the variable was added successfully; false if name is not unique in the model or contains whitespace or semicolons.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • AddDesignVariable

      public boolean AddDesignVariable(String name, int num) throws com.opttek.optquest.COptQuestException
      Design variables are used when the value of the decision variable represents an alternative, and not a quantity. For example, the variable may take on the values red, green or blue. Design variables are useful in optimization problems where the decision variables consist of choosing the best alternative from a catalog, and a larger number may not imply the commitment of more resources. Therefore, choice #10 may not be a more costly or a better choice than choice #1. Adds a design variable with the given name and the number of possible choices.
      Parameters:
      name - - name of the variable. The name must be unique to the model and must not contain whitespace or semicolons.
      num - - number of possible choices.
      Returns:
      - true if the variable was added successfully; false if name is not unique in the model or contains whitespace or semicolons.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • AddEnumerationVariable

      public boolean AddEnumerationVariable(String name, double[] items) throws com.opttek.optquest.COptQuestException
      Enumeration variables define a decision variable that has an enumerated set of values such as 5,7 and 25.
      Parameters:
      name - - name of the variable. The name must be unique to the model and must not contain whitespace or semicolons.
      items - - the array of valid values
      Returns:
      - true if the variable was added successfully; false if name is not unique in the model or contains whitespace or semicolons.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • AddPermutationVariable

      public boolean AddPermutationVariable(String group, String[] names) throws com.opttek.optquest.COptQuestException
      Permutation variables are used to solve sequencing problems. For example, you could use permutation variables to determine the order in which paint should be mixed to minimize cleanup time between color changes. The value of a permutation variable represents it's position within the sequence. A decision variable will be created for each entry in the names[] array. They will be named with a the prefix group signifying their membership in the group
      Parameters:
      group - - Group identifier.
      names - - the list of the names in the sequence.
      Returns:
      - true if the variable was added successfully; false if name is not unique in the model or contains whitespace or semicolons.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • AddTupleVariable

      public boolean AddTupleVariable(String name, double[][] tuples) throws com.opttek.optquest.COptQuestException
      A tuple defines a decision variable whose values are lists of tuples. Tuples variables are used for discrete choices in multiple dimensions, and are intended to be used when a Euclidean distance between values is meaningful. For example, consider three options (a1,b1), (a2,b2), and (a3,b3). The 2D Euclidean distance between the options will be used to determine closeness when searching for good solutions.
      Parameters:
      name - - name of the variable. The name must be unique to the model and must not contain whitespace or semicolons.
      tuples - - the list of discrete choices
      Returns:
      - true if the variable was added successfully; false if name is not unique in the model or contains whitespace or semicolons.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • AddGeolocationVariable

      public boolean AddGeolocationVariable(String name, double[][] locations) throws com.opttek.optquest.COptQuestException
      A geolocation variable defines a decision variable whose values are lists of latitude and longitude. This is a specialization of the tuple with extra restrictions on the size of the tuple (2) and distance is on a sphere rather than Euclidean distance.
      Parameters:
      name - - name of the variable. The name must be unique to the model and must not contain whitespace or semicolons.
      locations - - list of latitude and longitude for the geolocation.
      Returns:
      - true if the variable was added successfully; false if name is not unique in the model or contains whitespace or semicolons.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • AddSelectionVariable

      public boolean AddSelectionVariable(String name, String[] selVars) throws com.opttek.optquest.COptQuestException
      Selection variables are used to add or remove other variables from the optimization. COptQuestSelectionGroup allows the user to have a binary variable who value indicates an on/off state, where the off state indicates that other variables are not used in the evaluation. The OptQuest Engine maps the dependent variables to their lower bounds when the variable indicating the state is set to the off state.
      Parameters:
      name - - The name of the newly created binary variable to signify selection.
      selVars - - the list of the names of other variables to be included when the name binary variable is true.
      Returns:
      - true if the variable was added successfully; false if name is not unique in the model or contains whitespace or semicolons.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • AddExchangeableGroup

      public boolean AddExchangeableGroup(String name, String[] variables) throws com.opttek.optquest.COptQuestException
      Exchangable Variables in the group are identical if they have the same value and can be swapped.
      Parameters:
      name - - The name of the newly created binary variable to signify selection.
      variables - - the list of the names of other variables to be included when the name binary variable is true.
      Returns:
      - true if the variable was added successfully; false if name is not unique in the model or contains whitespace or semicolons.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • AddExchangeableGroup

      public boolean AddExchangeableGroup(String name, String[][] variables) throws com.opttek.optquest.COptQuestException
      Exchangable Variables in the group are identical if they have the same value and can be swapped.
      Parameters:
      name - - The name of the newly created binary variable to signify selection.
      variables - - the list of the names of other variables to be included when the name binary variable is true.
      Returns:
      - true if the variable was added successfully; false if name is not unique in the model or contains whitespace or semicolons.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • AddVariableExclusiveRange

      public boolean AddVariableExclusiveRange(String name, double min, double max) throws com.opttek.optquest.COptQuestException
      Defines a range of values that will be excluded as possible solutions for the variable identified by the name. Any value > min and < max will be excluded. Multiple ranges can be defined on one variable.
      Parameters:
      name - - name of the variable that will have the exclusive range.
      min - - any value > min will be excluded
      max - - any value < max will be excluded
      Returns:
      - true if the variable was added successfully; false if an input with the name does not exist.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • AddOutputVariable

      public boolean AddOutputVariable(String name) throws com.opttek.optquest.COptQuestException
      An output variable allows you to set the value of the variable. They may represent an output of a simulation or they are a value calculated based on the values of decision variables. Output variables can be used in the mathematical expression of constraints and objectives.
      Parameters:
      name - - name of the variable. The name must be unique to the model and must not contain whitespace or semicolons.
      Returns:
      - true if the variable was added successfully; false if name is not unique in the model or contains whitespace or semicolons.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • SetOutputStatistic

      public boolean SetOutputStatistic(String name, int statistic) throws com.opttek.optquest.COptQuestException
      Defines the statistic for the replications of an output variable. Available statistics include:
      • Statistic.None = 0
      • Statistic.Mean = 1
      • Statistic.Median = 2
      • Statistic.StdDev = 4
      • Statistic.Variance = 6
      • Statistic.CoeffOfVar = 8
      • Statistic.Min = 14
      • Statistic.Max = 15
      • Statistic.Sum = 16
      Parameters:
      name - - name of the output variable
      statistic - - the statistic to be applied to the output
      Returns:
      - true if the statistic was added successfully; false if an output with the name does not exist.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • SetOutputStatistic

      public boolean SetOutputStatistic(String name, int statistic, double statisticValue) throws com.opttek.optquest.COptQuestException
      Defines the percentile statistic for the replications of an output variable.
      Parameters:
      name - - name of the output variable.
      statistic - - Statistic.Percentile
      statisticValue - - target value
      Returns:
      - true if the statistic was added successfully; false if an output with the name does not exist.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • AddExpressionVariable

      public boolean AddExpressionVariable(String name, String expression) throws com.opttek.optquest.COptQuestException
      Defines a variable that is evaluated as an expression of other variables in the model. The expression may include variables and outputs. For example, the objective may be to minimize "2*Var1 + 3*Var2 + 1.5*Var3". "Var1", "Var2" and "Var3" must be names that were assigned to variables. A list of the supported mathematical functions can be found in the "Functions Available In Expressions" section in the Help.
      Parameters:
      name - - name of the variable. The name must be unique to the model and must not contain whitespace or semicolons.
      expression - - the string expression.
      Returns:
      - true if the objective was added successfully; false if objective name is not unique or contains whitespace or semicolons.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the expression variable.
    • AddConstraint

      public boolean AddConstraint(String name, String expression) throws com.opttek.optquest.COptQuestException
      Defines a linear or non-linear constraint where the expression may include variables and outputs. "2*Var1 + 3*Var2 + 1.5*Var3 ≤ 100" could be used to define a budget constraint. "Var1", "Var2" and "Var3" must be names that were assigned to variables. A list of the supported mathematical functions can be found in the "Functions Available In Expressions" section in the Help.
      Parameters:
      name - - name of the constraint. The name must be unique to the model and must not contain whitespace or semicolons.
      expression - - the string expression.
      Returns:
      - true if the constraint was added successfully; false if the name was not unique to the model or contained whitespace or semicolons.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the constraint.
    • AddObjective

      public boolean AddObjective(String name, String dir, String expression)
      Defines an objective where the optimization will work to minimize or maximize the objective value. The expression may include variables and outputs. For example, the objective may be to minimize "2*Var1 + 3*Var2 + 1.5*Var3". "Var1", "Var2" and "Var3" must be names that were assigned to variables. A list of the supported mathematical functions can be found in the "Functions Available In Expressions" section in the Help.
      Parameters:
      name - - name of the objective. The name must be unique to the model and must not contain whitespace or semicolons.
      dir - - "MIN" or "MAX"
      expression - - the string expression.
      Returns:
      - true if the objective was added successfully; false if objective name is not unique or contains whitespace or semicolons.
    • AddMinimizeObjective

      public boolean AddMinimizeObjective(String name, String expression)
      Defines an objective where the optimization will work to minimize the objective value. The expression may include variables and outputs. For example, the objective may be to minimize "2*Var1 + 3*Var2 + 1.5*Var3". "Var1", "Var2" and "Var3" must be names that were assigned to variables. A list of the supported mathematical functions can be found in the "Functions Available In Expressions" section in the Help.
      Parameters:
      name - - name of the objective. The name must be unique to the model and must not contain whitespace or semicolons.
      expression - - the string expression.
      Returns:
      - true if the objective was added successfully; false if objective name is not unique or contains whitespace or semicolons.
    • AddMaximizeObjective

      public boolean AddMaximizeObjective(String name, String expression)
      Defines an objective where the optimization will work to maximize the objective value. The expression may include variables and outputs. For example, the objective may be to minimize "2*Var1 + 3*Var2 + 1.5*Var3". "Var1", "Var2" and "Var3" must be names that were assigned to variables. A list of the supported mathematical functions can be found in the "Functions Available In Expressions" section in the Help.
      Parameters:
      name - - name of the objective. The name must be unique to the model and must not contain whitespace or semicolons.
      expression - - the string expression.
      Returns:
      - true if the objective was added successfully; false if the objective name is not unique to the model or contains whitespace or semicolons.
    • SetObjectiveGoal

      public boolean SetObjectiveGoal(String name, double min, double max)
      This method is only valid for multi objecitve problems. It is ignored if the model has a single objective. Setting a goal focuses the frontier search on objective values between min and max values. If you are interested in a particular range for a given objective, set the min and max values.
      Parameters:
      name - - name of the objective
      min - - minimum value of the goal range.
      max - - maximum value of the goal range.
      Returns:
      - true if the goal range was successively added; false if an objective with the specified name does not exist in the model.
    • SetObjectiveConfidence

      public boolean SetObjectiveConfidence(String name, int ctype, int clevel, double epct)
      Sets the values used for replication confidence testing on the specified objective. Confidence testing is only available when the replication statistic is the mean value, OptQuestModel.Statistic.Mean
      Parameters:
      name - - name of the objective
      ctype -
      OptQuestModel.Confidence.Type1 = indicates the replications should stop after the minimum replications have been run and when the confidence level is reached or the maximum number of replications is run.
      OptQuestModel.Confidence.Type2 = indicates the replications should stop after the minimum replications are run and the confidence level is reached, or the maximum number of replications is run, or when the best solution does not fall within current solutions confidence level. Type 2 is not available for COptQuestMultiObjective.
      clevel -
      • OptQuestModel.Confidence.Level80 = 80%
      • OptQuestModel.Confidence.Level90 = 90%
      • OptQuestModel.Confidence.Level95 - 95%
      • OptQuestModel.Confidence.Level98 = 98%
      • OptQuestModel.Confidence.Level99 = 99%
      • OptQuestModel.Confidence.Level999 = 99.9%
      epct - - error percent. Value between 0 and 1.
      Returns:
      - true if the objective confidence was set successfully. false if it failed.
    • SetObjectiveStatistic

      public boolean SetObjectiveStatistic(String name, int statistic) throws com.opttek.optquest.COptQuestException
      Defines the statistic for the replications of an objective. Available statistics include:
      • Statistic.None = 0
      • Statistic.Mean = 1
      • Statistic.Median = 2
      • Statistic.StdDev = 4
      • Statistic.Variance = 6
      • Statistic.CoeffOfVar = 8
      • Statistic.Min = 14
      • Statistic.Max = 15
      • Statistic.Sum = 16
      Parameters:
      name - - name of the objective variable
      statistic - - the statistic to be applied to the objective
      Returns:
      - true if the statistic was added successfully; false if the add failed.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred setting the statistic
    • SetObjectiveStatistic

      public boolean SetObjectiveStatistic(String name, int statistic, double statisticValue) throws com.opttek.optquest.COptQuestException
      Defines the percentile statistic for the replications of an objective.
      Parameters:
      name - - name of the objective variable.
      statistic - - Statistic.Percentile
      statisticValue - - target value
      Returns:
      - true if the statistic was added successfully; false if the add failed.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the variable.
    • SetReplications

      public boolean SetReplications(int reps)
      Sets the number of fixed replications to be run for each solution. The minimum value is 2.
      Parameters:
      reps - - number of replications to be run on each solution.
      Returns:
      - true if replications were set successfully.
    • SetReplications

      public boolean SetReplications(int min, int max)
      Sets the number of variable replications to be run for each solution. The minimum value is 2. Variable replications are used with confidence settings to control when replication processing is complete.
      Parameters:
      min - - minimum number of replications to be run on each solution.
      max - - maximum number of replications to be run on each solution.
      Returns:
      - true if replications were set successfully.
    • SetSerialReplications

      public boolean SetSerialReplications()
      If you are running replications and using multiple evaluators, the replication solutions can be run in parallel, or they can be run serially. If they are run in parallel, solution n, replication 1 can be evaluated at the same time as solution n, replication 2. If you run the replications serially, solution n, replication 1 must finish before solution n, replication 2 can be run, and they could both run on the same evaluator. Running serially may be beneficial if your simulation requires a warm-up period.
      Returns:
      true if the serial replication management was set successfully.
    • SetParallelHint

      public boolean SetParallelHint(int npar)
      The input parameter identifies the number of parallel evaluations that are expeted to happen. This should correspond to the number of processors/computer available for evaluation. OptQuest defaults to a single evaluator, so this method is only needed if more than one evaluator is desired. This value is a hint to how many solutions are expected to be evaluted in parallel. It is used to configure the internal metaheuristics. During evaluation any number (up to 5000) solutions may be evaluated in parallel. Optimization will be most efficient when the number matches this hint.
      Parameters:
      npar - number of parallel evaluators
    • SetRandomSeed

      public boolean SetRandomSeed(int seed)
      Allows the random seed to be modified. The random seed is used in solution generation so modifying the seed can change the set of solutions.
      Parameters:
      seed - value to be used as the random seed.
      Returns:
      true if the random seed was set.
    • StopOnSuccessfulMILP

      public boolean StopOnSuccessfulMILP()
      Sets a flag to tell the optimization stops as soon as it finds an optimal solution in the case that the optimization is a mixed integer linear program (MILP).
      Returns:
      true if the flag was set.
    • SetStopCycles

      public boolean SetStopCycles(int cycles)
      OptQuest works through a combination of techniques to find the best solution. It will cycle through these techniques repeatedly as the search continues. When SetStopCycles is set, the optimization will stop when the number of specified cycles is reached.
      Parameters:
      cycles - - the number of cycles to try before stopping.
      Returns:
      true if the cycles were set successfully.
    • SetStopImprovement

      public boolean SetStopImprovement(double improvement, int iterations)
      When SetStopImprovement is set, the optimization will stop when iterations are explored without a cumulative fractional improvement of improvement during that time.
      Parameters:
      improvement - - allowed values are 0.0 through 0.2
      iterations - - number of iterations
    • SetStopTime

      public boolean SetStopTime(int seconds)
      Sets the number of seconds the optimization should run before stopping. The current iteration will complete before the optimization stops. If the evaluation is long (such as running a simulation) the actual time the optimization runs may be longer than specified.
      Parameters:
      seconds - maximum number of seconds
      Returns:
      true if the stop time was set successfully.
    • AddSampleMetric

      public boolean AddSampleMetric(String name, String responseExpression, String errorExpression)
      Defines an a response and error metric for adaptive sampling to track. The expressions may include variables and outputs. For example, the objective may be to minimize "2*Var1 + 3*Var2 + 1.5*Var3". "Var1", "Var2" and "Var3" must be names that were assigned to variables. A list of the supported mathematical functions can be found in the "Functions Available In Expressions" section in the Help.
      Parameters:
      name - - name of the objective. The name must be unique to the model.
      responseExpression - - the string expression for the response value to track.
      errorExpression - - the string expression for the error in the response value.
      Returns:
      - true if the objective was added successfully; false if the add failed.
    • SetSampleMethod

      public boolean SetSampleMethod(int flags)
      Sets the sample method to be used when using sample metrics. Available sampling methods include:
      • SampleMethod.Stochastic
      • SampleMethod.Dynamic
      • SampleMethod.Async
      • SampleMethod.Variance
      • SampleMethod.Uniform
      • SampleMethod.Zero
      • SampleMethod.Gradient
      • SampleMethod.Min
      • SampleMethod.Max
      Parameters:
      flags - - bitwise or'd values to turn on one or more of the sampling methods
      Returns:
      true if the sampling method was set successfully.
    • SetSampleVariogram

      public boolean SetSampleVariogram(String variogram)
      Sets the sample variogram to be used when using building the surrogate model. Available sampling methods include:
      • SampleVariogram.Spherical
      • SampleVariogram.Pow
      • SampleVariogram.Exp
      • SampleVariogram.Gaussian
      • SampleVariogram.Tanh
      • SampleVariogram.Sech
      • SampleVariogram.Linear
      • SampleVariogram.Quadratic
      • SampleVariogram.Partition
      Parameters:
      variogram - - name of the sampling method to use
      Returns:
      true if the sampling variogram was set successfully.
    • SetSampleRDSParams

      public boolean SetSampleRDSParams(String name, String distribution, double[] params)
      Sets the bins to use if response distribution sampling is enabled.
      Parameters:
      name - - metric name
      distribution - - name of the distribution
      params - - parameters for the distribution
      Returns:
      true if the sampling method was set successfully.
    • SetSampleRDSUniform

      public boolean SetSampleRDSUniform(String name, int nBins, double a, double b)
      Sets the bins to use if response distribution sampling is enabled.
      Parameters:
      name - - metric name
      nBins - - number of bins
      a - Lower bound
      b - Upper bound
      Returns:
      true if the sampling method was set successfully.
    • SetSampleRDSNormal

      public boolean SetSampleRDSNormal(String name, int nBins, double mu, double sigma)
      Sets the bins to use if response distribution sampling is enabled.
      Parameters:
      name - - metric name
      nBins - - number of bins
      mu - Mean
      sigma - Standard deviation
      Returns:
      true if the sampling method was set successfully.
    • SetSampleRDSLogNormal

      public boolean SetSampleRDSLogNormal(String name, int nBins, double s, double scale)
      Sets the bins to use if response distribution sampling is enabled.
      Parameters:
      name - - metric name
      nBins - - number of bins
      s - Shape parameter
      scale - Scale parameter
      Returns:
      true if the sampling method was set successfully.
    • SetSampleRDSBeta

      public boolean SetSampleRDSBeta(String name, int nBins, double alpha, double beta)
      Sets the bins to use if response distribution sampling is enabled.
      Parameters:
      name - - metric name
      nBins - - number of bins
      alpha - Shape parameter
      beta - : Shape parameter
      Returns:
      true if the sampling method was set successfully.
    • SetSampleRDSPoisson

      public boolean SetSampleRDSPoisson(String name, int nBins, double lambda)
      Sets the bins to use if response distribution sampling is enabled.
      Parameters:
      name - - metric name
      nBins - - number of bins
      lambda - Rate parameter
      Returns:
      true if the sampling method was set successfully.
    • SetSampleRDSExponential

      public boolean SetSampleRDSExponential(String name, int nBins, double scale)
      Sets the bins to use if response distribution sampling is enabled.
      Parameters:
      name - - metric name
      nBins - - number of bins
      scale - Scale parameter.
      Returns:
      true if the sampling method was set successfully.
    • SetSampleRDSCauchy

      public boolean SetSampleRDSCauchy(String name, int nBins, double location, double scale)
      Sets the bins to use if response distribution sampling is enabled.
      Parameters:
      name - - metric name
      nBins - - number of bins
      location - Location parameter.
      scale - Scale parameter.
      Returns:
      true if the sampling method was set successfully.
    • SetSampleRDSGamma

      public boolean SetSampleRDSGamma(String name, int nBins, double a, double scale)
      Sets the bins to use if response distribution sampling is enabled.
      Parameters:
      name - - metric name
      nBins - - number of bins
      a - Shape parameter
      scale - Scale parameter.
      Returns:
      true if the sampling method was set successfully.
    • SetSampleRDSChiSquare

      public boolean SetSampleRDSChiSquare(String name, int nBins, double nu)
      Sets the bins to use if response distribution sampling is enabled.
      Parameters:
      name - - metric name
      nBins - - number of bins
      nu - Degrees of freedom
      Returns:
      true if the sampling method was set successfully.
    • SetSampleRDSPareto

      public boolean SetSampleRDSPareto(String name, int nBins, double gamma, double a, double location, double scale)
      Sets the bins to use if response distribution sampling is enabled.
      Parameters:
      name - - metric name
      nBins - - number of bins
      gamma - Shape parameter.
      a - Location parameter.
      location - Additional shift.
      scale - Scale parameter.
      Returns:
      true if the sampling method was set successfully.
    • SetSampleRDST

      public boolean SetSampleRDST(String name, int nBins, double nu)
      Sets the bins to use if response distribution sampling is enabled.
      Parameters:
      name - - metric name
      nBins - - number of bins
      nu - Degrees of freedom
      Returns:
      true if the sampling method was set successfully.
    • SetSampleRDSWeibull

      public boolean SetSampleRDSWeibull(String name, int nBins, double c, double scale)
      Sets the bins to use if response distribution sampling is enabled.
      Parameters:
      name - - metric name
      nBins - - number of bins
      c - Shape parameter
      scale - Scale parameter
      Returns:
      true if the sampling method was set successfully.
    • SetSampleRDSDiscrete

      public boolean SetSampleRDSDiscrete(String name, double[] binEdges)
      Sets the bins to use if response distribution sampling is enabled.
      Parameters:
      name - - metric name
      binEdges - list of binEdges to use for an arbitrary response distribution
      Returns:
      true if the sampling method was set successfully.
    • Describe

      public String Describe()
      Generates a string describing the model parameters.
      Returns:
      string that describes the model setup
    • Initialize

      public boolean Initialize() throws com.opttek.optquest.COptQuestException
      Internal OptTek use only.
      Throws:
      com.opttek.optquest.COptQuestException
    • Interrupt

      public void Interrupt()
      Only used for manual optimizations. Signals the OptQuestModel to stop generating new solutions during manual optimization loops.
    • Continue

      public void Continue()
      Only used for manual optimizations. If an optimization is interrupted with a call to Interrupt(), no new solutions will be generated unless Continue() is called. Use this to restart an interrupted optimization.
    • CleanUp

      public void CleanUp()
      Internal OptTek use only.
    • CreateSolution

      public OptQuestSolution CreateSolution() throws com.opttek.optquest.COptQuestException
      Only used for manual optimizations. Requests the OptQuestModel to generate a new trial solution for evaluation. OptQuest populates the solution with values for each input variable.
      Returns:
      - Returns an OptQuestSolution
      Throws:
      com.opttek.optquest.COptQuestException - if an error occurred
    • GetEmptySolution

      public OptQuestSolution GetEmptySolution() throws com.opttek.optquest.COptQuestException
      Creates an empty OptQuestSolution. This method can be used to create a suggested solution by setting values for each of the variables in the model. Call OptQuestSolution.Suggest() to add the solution to the model.
      Returns:
      - returns an empty OptQuestSolution
      Throws:
      com.opttek.optquest.COptQuestException - An exception is thrown if an error occurred creating an empty solution.
    • CopySolution

      public OptQuestSolution CopySolution(OptQuestSolution src) throws com.opttek.optquest.COptQuestException
      Make a copy of the input OptQuestSolution. This can be used to populate a new OptQuestModel instance with solutions from a previously run OptQuestModel. After calling CopySolution(), call AddEvaluated() for the copied solution.
      Parameters:
      src - - the solution to be copied
      Returns:
      - true if the src solution was successfully copied
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred copying the solution.
    • AddAllSolutions

      public boolean AddAllSolutions(OptQuestModel src) throws com.opttek.optquest.COptQuestException
      Copies all solutions from the input OptQuestModel to the the current OptQuestModel.
      Parameters:
      src - - OptQuestModel with evaluated solutions.
      Returns:
      - true if the solution was successfully copied
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if an error occurred adding the solutions.
    • SubmitSolution

      public com.opttek.optquest.COptQuestSolution SubmitSolution(com.opttek.optquest.COptQuestSolution csol) throws com.opttek.optquest.COptQuestException
      Internal OptTek use only.
      Throws:
      com.opttek.optquest.COptQuestException
    • RejectSolution

      public com.opttek.optquest.COptQuestSolution RejectSolution(com.opttek.optquest.COptQuestSolution csol) throws com.opttek.optquest.COptQuestException
      Internal OptTek use only.
      Throws:
      com.opttek.optquest.COptQuestException
    • PredictSolution

      public boolean PredictSolution(com.opttek.optquest.COptQuestSolution csol) throws com.opttek.optquest.COptQuestException
      Internal OptTek use only.
      Throws:
      com.opttek.optquest.COptQuestException
    • AddSuggestSolution

      public boolean AddSuggestSolution(com.opttek.optquest.COptQuestSolution csol) throws com.opttek.optquest.COptQuestException
      Internal OptTek use only.
      Throws:
      com.opttek.optquest.COptQuestException
    • AddEvaluatedSolution

      public boolean AddEvaluatedSolution(com.opttek.optquest.COptQuestSolution csol) throws com.opttek.optquest.COptQuestException
      Internal OptTek use only.
      Throws:
      com.opttek.optquest.COptQuestException
    • AddRequiredSolution

      public boolean AddRequiredSolution(com.opttek.optquest.COptQuestSolution csol) throws com.opttek.optquest.COptQuestException
      Internal OptTek use only.
      Throws:
      com.opttek.optquest.COptQuestException
    • CreateAsyncChannel

      public OptQuestModelChannel CreateAsyncChannel(int npar)
      Creates an asynchronous communication channel to send signals to the model during a optimization
      Parameters:
      npar - - number of concurrent threads to support in Optimize call().
      Returns:
      - OptQuestModelChannel object tied to this model.
    • Optimize

      public boolean Optimize(int nsol) throws com.opttek.optquest.COptQuestException
      Starts the optimization and stops when nsol solutions have been evaluated.
      Parameters:
      nsol - - number of solutions to generate before stopping.
      Returns:
      - true if the optimization completed successfully. Return false if there were any errors. Error details can be retrieved using GetLastError(.
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if there were any errors in the model setup or during the optimization.
    • Optimize

      public boolean Optimize(int nsol, IOptQuestEvaluator eval) throws com.opttek.optquest.COptQuestException
      Starts the optimization and stops when nsol solutions have been evaluated. The custom evaluator eval will be called to evaluate each solution.
      Parameters:
      nsol - - number of solutions to generate
      eval - - custom evaluator used to evaluate each solution.
      Returns:
      - true if the optimization completed successfully. Return false if there were any errors. Error details can be retrieved using GetLastError().
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if there were any errors in the model setup or during the optimization.
    • Optimize

      public boolean Optimize(int nsol, IOptQuestEvaluator eval, IOptQuestMonitor monitor) throws com.opttek.optquest.COptQuestException
      Starts the optimization and stops when nsol solutions have been evaluated. The custom evaluator eval.Evaluate() will be called to evaluate each solution. When a solution has completed evaluation and OptQuest has updated the best solution or frontier solutions, the custom monitor.MonitorStatus() is called.
      Parameters:
      nsol - - number of solutions to generate
      eval - - custom class used to evaluate each solution.
      monitor - - custom class to monitor optimization progress.
      Returns:
      - true if the optimization completed successfully. Return false if there were any errors. Error details can be retrieved using GetLastError().
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if there were any errors in the model setup or during the optimization.
    • Optimize

      public boolean Optimize(int npar, int nsol) throws com.opttek.optquest.COptQuestException
      Starts the optimization and stops when nsol solutions have been evaluated. The optimization is run with npar number of parallel evaluators meaning npar evaluations will be done in parallel.
      Parameters:
      npar - - number of parallel evaluators to use
      nsol - - number of solutions to generate
      Returns:
      - true if the optimization completed successfully. Return false if there were any errors. Error details can be retrieved using GetLastError().
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if there were any errors in the model setup or during the optimization.
    • Optimize

      public boolean Optimize(int npar, int nsol, IOptQuestEvaluator eval) throws com.opttek.optquest.COptQuestException
      Starts the optimization and stops when nsol solutions have been evaluated. The optimization is run with npar number of parallel evaluators meaning npar evaluations will be done in parallel. The custom evaluator eval.Evaluate() will be called to evaluate each solution.
      Parameters:
      npar - - number of parallel evaluators to use
      nsol - - number of solutions to generate
      eval - - custom class used to evaluate each solution.
      Returns:
      - true if the optimization completed successfully. Return false if there were any errors. Error details can be retrieved using GetLastError().
      Throws:
      com.opttek.optquest.COptQuestException - - An exception is thrown if there were any errors in the model setup or during the optimization.
    • Optimize

      public boolean Optimize(int npar, int nsol, IOptQuestEvaluator eval, IOptQuestMonitor monitor) throws com.opttek.optquest.COptQuestException
      Starts the optimization and stops when nsol solutions have been evaluated. The optimization is run with npar number of parallel evaluators meaning npar evaluations will be done in parallel. The custom evaluator eval.Evaluate() will be called to evaluate each solution. When a solution has completed evaluation and OptQuest has updated the best solution or frontier solutions, the custom monitor.MonitorStatus() is called.
      Parameters:
      npar - - number of parallel evaluators to use
      nsol - - number of solutions to generate
      eval - - custom evaluator used to evaluate each solution.
      monitor - - custom class to monitor optimization progress.
      Returns:
      - true if the optimization completed successfully. Return false if there were any errors. Error details can be retrieved using GetLastError().
      Throws:
      com.opttek.optquest.COptQuestException - throws a COptQuestException if an error occurred during the optimization.
    • Optimize

      public boolean Optimize(OptQuestModelChannel ipc, int nsol) throws com.opttek.optquest.COptQuestException
      Starts the optimization and stops when nsol solutions have been evaluated. Signals are sent to the OptQuestModelChannel as the optimization progresses.
      Parameters:
      ipc - - an asynchronous communication channel.
      nsol - - number of solutions to generate
      Returns:
      - true if the optimization completed successfully. Return false if there were any errors. Error details can be retrieved using GetLastError().
      Throws:
      com.opttek.optquest.COptQuestException - throws a COptQuestException if an error occurred during the optimization.
    • Optimize

      public boolean Optimize(OptQuestModelChannel ipc, int nsol, IOptQuestEvaluator eval) throws com.opttek.optquest.COptQuestException
      Starts the optimization and stops when nsol solutions have been evaluated. Signals are sent to the OptQuestModelChannel as the optimization progresses. The custom evaluator eval.Evaluate() will be called to evaluate each solution.
      Parameters:
      ipc - - an asynchronous communication channel.
      nsol - - number of solutions to generate
      eval - - custom evaluator used to evaluate each solution.
      Returns:
      - true if the optimization completed successfully. Return false if there were any errors. Error details can be retrieved using GetLastError().
      Throws:
      com.opttek.optquest.COptQuestException - throws a COptQuestException if an error occurred during the optimization.
    • Optimize

      public boolean Optimize(OptQuestModelChannel ipc, int nsol, IOptQuestEvaluator eval, IOptQuestMonitor monitor) throws com.opttek.optquest.COptQuestException
      Starts the optimization and stops when nsol solutions have been evaluated. Signals are sent to the OptQuestModelChannel as the optimization progresses. The custom evaluator eval.Evaluate() will be called to evaluate each solution. When a solution has completed evaluation and OptQuest has updated the best solution or frontier solutions, the custom monitor.MonitorStatus() is called.
      Parameters:
      ipc - - an asynchronous communication channel.
      nsol - - number of solutions to generate
      eval - - custom evaluator used to evaluate each solution.
      monitor - - custom class to monitor optimization progress.
      Returns:
      - true if the optimization completed successfully. Return false if there were any errors. Error details can be retrieved using GetLastError().
      Throws:
      com.opttek.optquest.COptQuestException - throws a COptQuestException if an error occurred during the optimization.
    • Sample

      public boolean Sample(int nsol) throws com.opttek.optquest.COptQuestException
      Internal OptTek use only.
      Throws:
      com.opttek.optquest.COptQuestException
    • Sample

      public boolean Sample(int nsol, IOptQuestEvaluator eval) throws com.opttek.optquest.COptQuestException
      Internal OptTek use only.
      Throws:
      com.opttek.optquest.COptQuestException
    • Sample

      public boolean Sample(int nsol, IOptQuestEvaluator eval, IOptQuestMonitor monitor) throws com.opttek.optquest.COptQuestException
      Internal OptTek use only.
      Throws:
      com.opttek.optquest.COptQuestException
    • Sample

      public boolean Sample(int npar, int nsol) throws com.opttek.optquest.COptQuestException
      Internal OptTek use only.
      Throws:
      com.opttek.optquest.COptQuestException
    • Sample

      public boolean Sample(int npar, int nsol, IOptQuestEvaluator eval) throws com.opttek.optquest.COptQuestException
      Internal OptTek use only.
      Throws:
      com.opttek.optquest.COptQuestException
    • Sample

      public boolean Sample(int npar, int nsol, IOptQuestEvaluator eval, IOptQuestMonitor monitor) throws com.opttek.optquest.COptQuestException
      Internal OptTek use only.
      Throws:
      com.opttek.optquest.COptQuestException
    • Sample

      public boolean Sample(OptQuestModelChannel ipc, int nsol) throws com.opttek.optquest.COptQuestException
      Internal OptTek use only.
      Throws:
      com.opttek.optquest.COptQuestException
    • Sample

      public boolean Sample(OptQuestModelChannel ipc, int nsol, IOptQuestEvaluator eval) throws com.opttek.optquest.COptQuestException
      Internal OptTek use only.
      Throws:
      com.opttek.optquest.COptQuestException
    • Sample

      public boolean Sample(OptQuestModelChannel ipc, int nsol, IOptQuestEvaluator eval, IOptQuestMonitor monitor) throws com.opttek.optquest.COptQuestException
      Internal OptTek use only.
      Throws:
      com.opttek.optquest.COptQuestException
    • GetBestSolutions

      public List<OptQuestSolution> GetBestSolutions()
      If the OptQuestModel has a single objective, this method returns the best solution. If the model has multiple objectives, this method returns the points on the frontier.
      Returns:
      - The best solution for a single objective model. The points on the frontier for a multi-objective model.
      Throws:
      com.opttek.optquest.COptQuestException
    • GetBestSolutions

      public List<OptQuestSolution> GetBestSolutions(int limit)
      If the OptQuestModel has a single objective, this method returns the best n solutions where n is the limit parameter. If limit equals 0, all solutions are returned, ordered from best to worst. If the model has multiple objectives, this method returns the points on the frontier.
      Parameters:
      limit - - for a single objective OptQuestModel, the top n solutions are returned where n = limit.
      Returns:
      - the points on the frontier for a multi objective model. For a single objective model, the top n solutions.
    • GetAllSolutions

      public List<OptQuestSolution> GetAllSolutions() throws com.opttek.optquest.COptQuestException
      Returns all evaluated solutions.
      Returns:
      list of evaluated solutions.
      Throws:
      com.opttek.optquest.COptQuestException - if an error occurred
    • GetNumberOfCompletedIterations

      public int GetNumberOfCompletedIterations()
      Returns the number of solutions that have been evaluated. The count includes feasible solutions, infeasible solutions and rejected solutions.
      Returns:
      - the number of solutions.
    • GetMaxReplications

      public int GetMaxReplications()
      Returns the max rep value.
      Returns:
      Returns the max rep value set by the method SetReplication()
    • GetTerminationReason

      public int GetTerminationReason()
      Returns the reason the optimization terminated.
      NotStarted = 0
      The optimization has not been started.
      Running = 1
      The optimization is still running.
      LP = 3
      The optimization was solved using an Linear/Integer/Mixed Integer Program.
      AutoStop =4
      The optimization stopped due to the Auto Stop feature
      OptimalFound = 5
      The optimal solution was found.
      MaxIterations = 6
      The optimization stopped when the maximum number of iterations was reached.
      MaxTime = 7
      The optimization stopped when the maximum time was reached.
      UserStopped = 8
      The optimization was stopped by the user.
      Exception = 10
      The optimization stopped due to an exception.
      FactoriesDone = 11
      The Meta-Heuristic factories have completed.
      Infeasible = 12
      There are no solutions that satisfy the constraints.
      CannotGenerate = 13
      New (different) solutions cannot be generated.
      MaxDemoIterations = 14
      The optimization stopped because the maximum number of iterations allowed in the demo version was reached.
      Returns:
      termination reason
    • SetTerminationReason

      public void SetTerminationReason(int reason)
      Internal OptTek use only.