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
    • solutions

      public List<OptQuestSolution> solutions
  • 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 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 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 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 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 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 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 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 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.
    • 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.
      The following mathematical functions are supported and can be used in the mathematical expression:
      • min(x,y) Returns the smaller value of x and y
      • max(x,y) Returns the larger value of x and y
      • clamp(x,y,z) Returns y if y < x, z if x %gt z, otherwise x
      • sqrt(x) Returns the square root of x
      • log(x) Returns the logarithm of x
      • log10(x) Returns the base 10 logarithm of x
      • pow(x,y) Returns x raise to the power y
      • exp(x) Returns e raised to the power x
      • abs(x) Returns the absolute value of x
      • pi The mathematical constant pi (3.141159)
      • e The mathematical constant e (2.718)
      • rand() Returns a random number between 0 and 1
      • fmod(x,y) Returns the remainder of x/y
      • floor(x) Returns the largest whole number less than or equal to x
      • ceil(x) Return the smallest whole number greater than or equal to x
      • sin(x) Returns the sine of x where x is an angle in radians
      • cos(x) Returns the cosine of x where x is an angle in radians
      • tan(x) Returns the tangent of x where x is an angle in radians
      • sinh(x) Returns the hyperbolic sine of x where x is an angle in radians
      • cosh(x) Returns the hyperbolic cosine of x where x is an angle in radians
      • tanh(x) Returns the hyperbolic tangent of x where x is an angle in radians
      • asin(x) Returns the arcsine of x in the range -n/2 to n/2 radians. x is between -1 and 1.
      • asin(x) Returns the arcsine of x in the range -n/2 to n/2 radians. x is between -1 and 1.
      • acos(x) Returns the arccosine of x in the range 0 to n radians. x is between -1 and 1.
      • atan(x) Returns the arcstangent of x in the range -pi/2 to pi/2 radians. if x is 0, atan returns 0.
      • atan2(x,y) Returns the arctangent of y/x in the range -pi to pi radians. If both x and y are 0, the function returns 0.
      • DtoR(x) Converts degrees to radians.
      • RtoD(x) Converts radians to degrees.
      • signum(x) Returns 1 if x is positive, 0 if x is 0, -1 if x is negative (not NaN or Inf)
      • finite(x) Returns 1 if x is finite (not NaN or Inf)
      • eq(x,y) Returns 1 if x equals y
      • ne(x,y) Returns 1 if x is not equal to y
      • lt(x,y) Returns 1 if x is less than y
      • le(x,y) Returns 1 if x is less than or equal to y
      • gt(x,y) Returns 1 if x is greater than y
      • ge(x,y) Returns 1 if x is greater than or equal to y
      • if(x,y,z) Returns y if x is non-zero, otherwise z (like, the "if" function in Excel)
      • finite(x) Returns 1 if x is a finite value
      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)
    • 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.
      The following mathematical functions are supported and can be used in the mathematical expression:
      • min(x,y) Returns the smaller value of x and y
      • max(x,y) Returns the larger value of x and y
      • clamp(x,y,z) Returns y if y < x, z if x %gt z, othwerize x
      • sqrt(x) Returns the square root of x
      • log(x) Returns the logarithm of x
      • log10(x) Returns the base 10 logarithm of x
      • pow(x,y) Returns x raise to the power y
      • exp(x) Returns e raised to the power x
      • abs(x) Returns the absolute value of x
      • pi The mathematical constant pi (3.141159)
      • e The mathematical constant e (2.718)
      • rand() Returns a random number between 0 and 1
      • fmod(x,y) Returns the remainder of x/y
      • floor(x) Returns the largest whole number less than or equal to x
      • ceil(x) Return the smallest whole number greater than or equal to x
      • sin(x) Returns the sine of x where x is an angle in radians
      • cos(x) Returns the cosine of x where x is an angle in radians
      • tan(x) Returns the tangent of x where x is an angle in radians
      • sinh(x) Returns the hyperbolic sine of x where x is an angle in radians
      • cosh(x) Returns the hyperbolic cosine of x where x is an angle in radians
      • tanh(x) Returns the hyperbolic tangent of x where x is an angle in radians
      • asin(x) Returns the arcsine of x in the range -n/2 to n/2 radians. x is between -1 and 1.
      • asin(x) Returns the arcsine of x in the range -n/2 to n/2 radians. x is between -1 and 1.
      • acos(x) Returns the arccosine of x in the range 0 to n radians. x is between -1 and 1.
      • atan(x) Returns the arcstangent of x in the range -pi/2 to pi/2 radians. if x is 0, atan returns 0.
      • atan2(x,y) Returns the arctangent of y/x in the range -pi to pi radians. If both x and y are 0, the function returns 0.
      • DtoR(x) Converts degrees to radians.
      • RtoD(x) Converts radians to degrees.
      • signum(x) Returns 1 if x is positive, 0 if x is 0, -1 if x is negative (not NaN or Inf)
      • finite(x) Returns 1 if x is finite (not NaN or Inf)
      • eq(x,y) Returns 1 if x equals y
      • ne(x,y) Returns 1 if x is not equal to y
      • lt(x,y) Returns 1 if x is less than y
      • le(x,y) Returns 1 if x is less than or equal to y
      • gt(x,y) Returns 1 if x is greater than y
      • ge(x,y) Returns 1 if x is greater than or equal to y
      • if(x,y,z) Returns y if x is non-zero, otherwise z (like, the "if" function in Excel)
      • finite(x) Returns 1 if x is a finite value
      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.
      The following mathematical functions are supported and can be used in the mathematical expression:
      • min(x,y) Returns the smaller value of x and y
      • max(x,y) Returns the larger value of x and y
      • clamp(x,y,z) Returns y if y < x, z if x %gt z, othwerize x
      • sqrt(x) Returns the square root of x
      • log(x) Returns the logarithm of x
      • log10(x) Returns the base 10 logarithm of x
      • pow(x,y) Returns x raise to the power y
      • exp(x) Returns e raised to the power x
      • abs(x) Returns the absolute value of x
      • pi The mathematical constant pi (3.141159)
      • e The mathematical constant e (2.718)
      • rand() Returns a random number between 0 and 1
      • fmod(x,y) Returns the remainder of x/y
      • floor(x) Returns the largest whole number less than or equal to x
      • ceil(x) Return the smallest whole number greater than or equal to x
      • sin(x) Returns the sine of x where x is an angle in radians
      • cos(x) Returns the cosine of x where x is an angle in radians
      • tan(x) Returns the tangent of x where x is an angle in radians
      • sinh(x) Returns the hyperbolic sine of x where x is an angle in radians
      • cosh(x) Returns the hyperbolic cosine of x where x is an angle in radians
      • tanh(x) Returns the hyperbolic tangent of x where x is an angle in radians
      • asin(x) Returns the arcsine of x in the range -n/2 to n/2 radians. x is between -1 and 1.
      • asin(x) Returns the arcsine of x in the range -n/2 to n/2 radians. x is between -1 and 1.
      • acos(x) Returns the arccosine of x in the range 0 to n radians. x is between -1 and 1.
      • atan(x) Returns the arcstangent of x in the range -pi/2 to pi/2 radians. if x is 0, atan returns 0.
      • atan2(x,y) Returns the arctangent of y/x in the range -pi to pi radians. If both x and y are 0, the function returns 0.
      • DtoR(x) Converts degrees to radians.
      • RtoD(x) Converts radians to degrees.
      • signum(x) Returns 1 if x is positive, 0 if x is 0, -1 if x is negative (not NaN or Inf)
      • finite(x) Returns 1 if x is finite (not NaN or Inf)
      • eq(x,y) Returns 1 if x equals y
      • ne(x,y) Returns 1 if x is not equal to y
      • lt(x,y) Returns 1 if x is less than y
      • le(x,y) Returns 1 if x is less than or equal to y
      • gt(x,y) Returns 1 if x is greater than y
      • ge(x,y) Returns 1 if x is greater than or equal to y
      • if(x,y,z) Returns y if x is non-zero, otherwise z (like, the "if" function in Excel)
      • finite(x) Returns 1 if x is a finite value
      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.
      name - - name of the objective
      ctype - - Confidence.Type1 or Confidence.Type2
      clevel - - Confidence level
      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.
    • 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.
      The following mathematical functions are supported and can be used in the mathematical expression:
      • min(x,y) Returns the smaller value of x and y
      • max(x,y) Returns the larger value of x and y
      • clamp(x,y,z) Returns y if y < x, z if x %gt z, otherwise x
      • sqrt(x) Returns the square root of x
      • log(x) Returns the logarithm of x
      • log10(x) Returns the base 10 logarithm of x
      • pow(x,y) Returns x raise to the power y
      • exp(x) Returns e raised to the power x
      • abs(x) Returns the absolute value of x
      • pi The mathematical constant pi (3.141159)
      • e The mathematical constant e (2.718)
      • rand() Returns a random number between 0 and 1
      • fmod(x,y) Returns the remainder of x/y
      • floor(x) Returns the largest whole number less than or equal to x
      • ceil(x) Return the smallest whole number greater than or equal to x
      • sin(x) Returns the sine of x where x is an angle in radians
      • cos(x) Returns the cosine of x where x is an angle in radians
      • tan(x) Returns the tangent of x where x is an angle in radians
      • sinh(x) Returns the hyperbolic sine of x where x is an angle in radians
      • cosh(x) Returns the hyperbolic cosine of x where x is an angle in radians
      • tanh(x) Returns the hyperbolic tangent of x where x is an angle in radians
      • asin(x) Returns the arcsine of x in the range -n/2 to n/2 radians. x is between -1 and 1.
      • asin(x) Returns the arcsine of x in the range -n/2 to n/2 radians. x is between -1 and 1.
      • acos(x) Returns the arccosine of x in the range 0 to n radians. x is between -1 and 1.
      • atan(x) Returns the arcstangent of x in the range -pi/2 to pi/2 radians. if x is 0, atan returns 0.
      • atan2(x,y) Returns the arctangent of y/x in the range -pi to pi radians. If both x and y are 0, the function returns 0.
      • DtoR(x) Converts degrees to radians.
      • RtoD(x) Converts radians to degrees.
      • signum(x) Returns 1 if x is positive, 0 if x is 0, -1 if x is negative (not NaN or Inf)
      • finite(x) Returns 1 if x is finite (not NaN or Inf)
      • eq(x,y) Returns 1 if x equals y
      • ne(x,y) Returns 1 if x is not equal to y
      • lt(x,y) Returns 1 if x is less than y
      • le(x,y) Returns 1 if x is less than or equal to y
      • gt(x,y) Returns 1 if x is greater than y
      • ge(x,y) Returns 1 if x is greater than or equal to y
      • if(x,y,z) Returns y if x is non-zero, otherwise z (like, the "if" function in Excel)
      • finite(x) Returns 1 if x is a finite value
      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.
    • Describe

      public String Describe()
    • 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
    • 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
    • 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
    • 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
    • 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:
      Throws:
      com.opttek.optquest.COptQuestException
    • Optimize

      public boolean Optimize(OptQuestModelChannel ipc, int nsol) throws com.opttek.optquest.COptQuestException
      Throws:
      com.opttek.optquest.COptQuestException
    • Optimize

      public boolean Optimize(OptQuestModelChannel ipc, int nsol, IOptQuestEvaluator eval) throws com.opttek.optquest.COptQuestException
      Throws:
      com.opttek.optquest.COptQuestException
    • Optimize

      public boolean Optimize(OptQuestModelChannel ipc, int nsol, IOptQuestEvaluator eval, IOptQuestMonitor monitor) throws com.opttek.optquest.COptQuestException
      Throws:
      com.opttek.optquest.COptQuestException
    • Sample

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

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

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

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

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

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

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

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

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

      public List<OptQuestSolution> GetBestSolutions() throws com.opttek.optquest.COptQuestException
      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) throws com.opttek.optquest.COptQuestException
      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.
      Throws:
      com.opttek.optquest.COptQuestException
    • GetAllSolutions

      public List<OptQuestSolution> GetAllSolutions() throws com.opttek.optquest.COptQuestException
      Returns all evaluated solutions.
      Returns:
      list of evaluated solutions.
      Throws:
      com.opttek.optquest.COptQuestException
    • 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()
    • GetTerminationReason

      public int GetTerminationReason()
      Returns the reason the optimization terminated.
      TERM_NOTSTARTED=0
      The optimization has not been started.
      TERM_RUNNING=1
      The optimization is still running.
      TERM_LP=3
      The optimization was solved using an Linear/Integer/Mixed Integer Program.
      TERM_AUTOSTOP=4
      The optimization stopped due to the Auto Stop feature
      TERM_OPTIMALFOUND=5
      The optimal solution was found.
      TERM_MAXITERATIONS=6
      The optimization stopped when the maximum number of iterations was reached.
      TERM_MAXTIME=7
      The optimization stopped when the maximum time was reached.
      TERM_USERSTOPPED=8
      The optimization was stopped by the user.
      TERM_EXCEPTION=10
      The optimization stopped due to an exception.
      TERM_INFEASIBLE=12
      There are no solutions that satisfy the constraints.
      TERM_CANNOTGENERATE=13
      New (different) solutions cannot be generated.
      Returns:
      termination reason
    • SetTerminationReason

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