Package com.opttek.optquest
Class OptQuestModel
java.lang.Object
com.opttek.optquest.OptQuestModel
The main class that defines an optimization model and creates and manages solutions
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intfinal Map<com.opttek.optquest.COptQuestSingleObjective, double[]> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCopies all solutions from the input OptQuestModel to the the current OptQuestModel.booleanAddBinaryVariable(String name) Adds a binary variable with the given name.booleanAddConstraint(String name, String expression) Defines a linear or non-linear constraint where the expression may include variables and outputs.booleanAddContinuousVariable(String name, double min, double max) Adds a continuous variable with the given name, minimum value and maximum value.booleanAddDesignVariable(String name, int num) Design variables are used when the value of the decision variable represents an alternative, and not a quantity.booleanAddDiscreteVariable(String name, double min, double max, double step) Adds a discrete variable with the given name, minimum value, maximum value and step size.booleanAddEnumerationVariable(String name, double[] items) Enumeration variables define a decision variable that has an enumerated set of values such as 5,7 and 25.booleanAddEvaluatedSolution(com.opttek.optquest.COptQuestSolution csol) Internal OptTek use only.booleanAddExchangeableGroup(String name, String[] variables) Exchangable Variables in the group are identical if they have the same value and can be swapped.booleanAddExchangeableGroup(String name, String[][] variables) Exchangable Variables in the group are identical if they have the same value and can be swapped.booleanAddExpressionVariable(String name, String expression) Defines a variable that is evaluated as an expression of other variables in the model.booleanAddGeolocationVariable(String name, double[][] locations) A geolocation variable defines a decision variable whose values are lists of latitude and longitude.booleanAddIntegerVariable(String name, double min, double max) Adds an integer variable with the given name, minimum value and maximum value.booleanAddMaximizeObjective(String name, String expression) Defines an objective where the optimization will work to maximize the objective value.booleanAddMinimizeObjective(String name, String expression) Defines an objective where the optimization will work to minimize the objective value.booleanAddObjective(String name, String dir, String expression) Defines an objective where the optimization will work to minimize or maximize the objective value.booleanAddOutputVariable(String name) An output variable allows you to set the value of the variable.booleanAddPermutationVariable(String group, String[] names) Permutation variables are used to solve sequencing problems.booleanAddRequiredSolution(com.opttek.optquest.COptQuestSolution csol) Internal OptTek use only.booleanAddSampleMetric(String name, String responseExpression, String errorExpression) Defines an a response and error metric for adaptive sampling to track.booleanAddSelectionVariable(String name, String[] selVars) Selection variables are used to add or remove other variables from the optimization.booleanAddSuggestSolution(com.opttek.optquest.COptQuestSolution csol) Internal OptTek use only.booleanAddTupleVariable(String name, double[][] tuples) A tuple defines a decision variable whose values are lists of tuples.booleanAddVariableExclusiveRange(String name, double min, double max) Defines a range of values that will be excluded as possible solutions for the variable identified by the name.voidCleanUp()Internal OptTek use only.voidContinue()Only used for manual optimizations.Make a copy of the input OptQuestSolution.CreateAsyncChannel(int npar) Creates an asynchronous communication channel to send signals to the model during a optimizationOnly used for manual optimizations.Describe()Generates a string describing the model parameters.Returns all evaluated solutions.If the OptQuestModel has a single objective, this method returns the best solution.GetBestSolutions(int limit) If the OptQuestModel has a single objective, this method returns the best n solutions where n is the limit parameter.Creates an empty OptQuestSolution.intReturns the max rep value.intReturns the number of solutions that have been evaluated.intReturns the reason the optimization terminated.booleanInternal OptTek use only.voidOnly used for manual optimizations.booleanLogSetup() logs the OptQuestModel setup in an xml formatted file.booleanLogSolutions(String filespec) LogSolutions() logs all solutions in a csv formatted file.booleanOptimize(int nsol) Starts the optimization and stops when nsol solutions have been evaluated.booleanOptimize(int npar, int nsol) Starts the optimization and stops when nsol solutions have been evaluated.booleanOptimize(int npar, int nsol, IOptQuestEvaluator eval) Starts the optimization and stops when nsol solutions have been evaluated.booleanOptimize(int npar, int nsol, IOptQuestEvaluator eval, IOptQuestMonitor monitor) Starts the optimization and stops when nsol solutions have been evaluated.booleanOptimize(int nsol, IOptQuestEvaluator eval) Starts the optimization and stops when nsol solutions have been evaluated.booleanOptimize(int nsol, IOptQuestEvaluator eval, IOptQuestMonitor monitor) Starts the optimization and stops when nsol solutions have been evaluated.booleanOptimize(OptQuestModelChannel ipc, int nsol) Starts the optimization and stops when nsol solutions have been evaluated.booleanOptimize(OptQuestModelChannel ipc, int nsol, IOptQuestEvaluator eval) Starts the optimization and stops when nsol solutions have been evaluated.booleanOptimize(OptQuestModelChannel ipc, int nsol, IOptQuestEvaluator eval, IOptQuestMonitor monitor) Starts the optimization and stops when nsol solutions have been evaluated.booleanPredictSolution(com.opttek.optquest.COptQuestSolution csol) Internal OptTek use only.com.opttek.optquest.COptQuestSolutionRejectSolution(com.opttek.optquest.COptQuestSolution csol) Internal OptTek use only.booleanSample(int nsol) Internal OptTek use only.booleanSample(int npar, int nsol) Internal OptTek use only.booleanSample(int npar, int nsol, IOptQuestEvaluator eval) Internal OptTek use only.booleanSample(int npar, int nsol, IOptQuestEvaluator eval, IOptQuestMonitor monitor) Internal OptTek use only.booleanSample(int nsol, IOptQuestEvaluator eval) Internal OptTek use only.booleanSample(int nsol, IOptQuestEvaluator eval, IOptQuestMonitor monitor) Internal OptTek use only.booleanSample(OptQuestModelChannel ipc, int nsol) Internal OptTek use only.booleanSample(OptQuestModelChannel ipc, int nsol, IOptQuestEvaluator eval) Internal OptTek use only.booleanSample(OptQuestModelChannel ipc, int nsol, IOptQuestEvaluator eval, IOptQuestMonitor monitor) Internal OptTek use only.booleanSetLicense(String license) License IDs are assigned by OptTek Systems, Inc.booleanSetObjectiveConfidence(String name, int ctype, int clevel, double epct) Sets the values used for replication confidence testing on the specified objective.booleanSetObjectiveGoal(String name, double min, double max) This method is only valid for multi objecitve problems.booleanSetObjectiveStatistic(String name, int statistic) Defines the statistic for the replications of an objective.booleanSetObjectiveStatistic(String name, int statistic, double statisticValue) Defines the percentile statistic for the replications of an objective.booleanSetOutputStatistic(String name, int statistic) Defines the statistic for the replications of an output variable.booleanSetOutputStatistic(String name, int statistic, double statisticValue) Defines the percentile statistic for the replications of an output variable.booleanSetParallelHint(int npar) The input parameter identifies the number of parallel evaluations that are expeted to happen.booleanSetRandomSeed(int seed) Allows the random seed to be modified.booleanSetReplications(int reps) Sets the number of fixed replications to be run for each solution.booleanSetReplications(int min, int max) Sets the number of variable replications to be run for each solution.booleanSetSampleMethod(int flags) Sets the sample method to be used when using sample metrics.booleanSetSampleRDSBeta(String name, int nBins, double alpha, double beta) Sets the bins to use if response distribution sampling is enabled.booleanSetSampleRDSCauchy(String name, int nBins, double location, double scale) Sets the bins to use if response distribution sampling is enabled.booleanSetSampleRDSChiSquare(String name, int nBins, double nu) Sets the bins to use if response distribution sampling is enabled.booleanSetSampleRDSDiscrete(String name, double[] binEdges) Sets the bins to use if response distribution sampling is enabled.booleanSetSampleRDSExponential(String name, int nBins, double scale) Sets the bins to use if response distribution sampling is enabled.booleanSetSampleRDSGamma(String name, int nBins, double a, double scale) Sets the bins to use if response distribution sampling is enabled.booleanSetSampleRDSLogNormal(String name, int nBins, double s, double scale) Sets the bins to use if response distribution sampling is enabled.booleanSetSampleRDSNormal(String name, int nBins, double mu, double sigma) Sets the bins to use if response distribution sampling is enabled.booleanSetSampleRDSParams(String name, String distribution, double[] params) Sets the bins to use if response distribution sampling is enabled.booleanSetSampleRDSPareto(String name, int nBins, double gamma, double a, double location, double scale) Sets the bins to use if response distribution sampling is enabled.booleanSetSampleRDSPoisson(String name, int nBins, double lambda) Sets the bins to use if response distribution sampling is enabled.booleanSetSampleRDST(String name, int nBins, double nu) Sets the bins to use if response distribution sampling is enabled.booleanSetSampleRDSUniform(String name, int nBins, double a, double b) Sets the bins to use if response distribution sampling is enabled.booleanSetSampleRDSWeibull(String name, int nBins, double c, double scale) Sets the bins to use if response distribution sampling is enabled.booleanSetSampleVariogram(String variogram) Sets the sample variogram to be used when using building the surrogate model.booleanIf you are running replications and using multiple evaluators, the replication solutions can be run in parallel, or they can be run serially.booleanSetStopCycles(int cycles) OptQuest works through a combination of techniques to find the best solution.booleanSetStopImprovement(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.booleanSetStopTime(int seconds) Sets the number of seconds the optimization should run before stopping.voidSetTerminationReason(int reason) Internal OptTek use only.booleanSets 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).com.opttek.optquest.COptQuestSolutionSubmitSolution(com.opttek.optquest.COptQuestSolution csol) Internal OptTek use only.
-
Field Details
-
inputs
-
outputs
-
constraints
-
objectives
-
RDSBins
-
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
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
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
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 variablemax- - 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 variablemax- - 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 variablemax- - maximum value for the variablestep- - 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
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 excludedmax- - 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
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 variablestatistic- - 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.PercentilestatisticValue- - 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
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
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
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
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 objectivemin- - 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
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 objectivectype-- 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 variablestatistic- - 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.PercentilestatisticValue- - 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.2iterations- - 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
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
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
Sets the bins to use if response distribution sampling is enabled.- Parameters:
name- - metric namedistribution- - name of the distributionparams- - parameters for the distribution- Returns:
- true if the sampling method was set successfully.
-
SetSampleRDSUniform
Sets the bins to use if response distribution sampling is enabled.- Parameters:
name- - metric namenBins- - number of binsa- Lower boundb- Upper bound- Returns:
- true if the sampling method was set successfully.
-
SetSampleRDSNormal
Sets the bins to use if response distribution sampling is enabled.- Parameters:
name- - metric namenBins- - number of binsmu- Meansigma- Standard deviation- Returns:
- true if the sampling method was set successfully.
-
SetSampleRDSLogNormal
Sets the bins to use if response distribution sampling is enabled.- Parameters:
name- - metric namenBins- - number of binss- Shape parameterscale- Scale parameter- Returns:
- true if the sampling method was set successfully.
-
SetSampleRDSBeta
Sets the bins to use if response distribution sampling is enabled.- Parameters:
name- - metric namenBins- - number of binsalpha- Shape parameterbeta- : Shape parameter- Returns:
- true if the sampling method was set successfully.
-
SetSampleRDSPoisson
Sets the bins to use if response distribution sampling is enabled.- Parameters:
name- - metric namenBins- - number of binslambda- Rate parameter- Returns:
- true if the sampling method was set successfully.
-
SetSampleRDSExponential
Sets the bins to use if response distribution sampling is enabled.- Parameters:
name- - metric namenBins- - number of binsscale- Scale parameter.- Returns:
- true if the sampling method was set successfully.
-
SetSampleRDSCauchy
Sets the bins to use if response distribution sampling is enabled.- Parameters:
name- - metric namenBins- - number of binslocation- Location parameter.scale- Scale parameter.- Returns:
- true if the sampling method was set successfully.
-
SetSampleRDSGamma
Sets the bins to use if response distribution sampling is enabled.- Parameters:
name- - metric namenBins- - number of binsa- Shape parameterscale- Scale parameter.- Returns:
- true if the sampling method was set successfully.
-
SetSampleRDSChiSquare
Sets the bins to use if response distribution sampling is enabled.- Parameters:
name- - metric namenBins- - number of binsnu- 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 namenBins- - number of binsgamma- Shape parameter.a- Location parameter.location- Additional shift.scale- Scale parameter.- Returns:
- true if the sampling method was set successfully.
-
SetSampleRDST
Sets the bins to use if response distribution sampling is enabled.- Parameters:
name- - metric namenBins- - number of binsnu- Degrees of freedom- Returns:
- true if the sampling method was set successfully.
-
SetSampleRDSWeibull
Sets the bins to use if response distribution sampling is enabled.- Parameters:
name- - metric namenBins- - number of binsc- Shape parameterscale- Scale parameter- Returns:
- true if the sampling method was set successfully.
-
SetSampleRDSDiscrete
Sets the bins to use if response distribution sampling is enabled.- Parameters:
name- - metric namebinEdges- list of binEdges to use for an arbitrary response distribution- Returns:
- true if the sampling method was set successfully.
-
Describe
Generates a string describing the model parameters.- Returns:
- string that describes the model setup
-
Initialize
public boolean Initialize() throws com.opttek.optquest.COptQuestExceptionInternal 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
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
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
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
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 generateeval- - 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 generateeval- - 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 usensol- - 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 usensol- - number of solutions to generateeval- - 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 usensol- - number of solutions to generateeval- - 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 generateeval- - 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 generateeval- - 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
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
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
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.
-