Package com.opttek.optquest
Class COptQuestOptimization
java.lang.Object
com.opttek.optquest.COptQuestOptimization
- Direct Known Subclasses:
COptQuestPythonOptimization
The COptQuestOptimization class searches for solutions to problems using a
'black box' approach. It incorporates metaheuristics to guide its search
algorithms toward better solutions. This approach remembers which solutions
worked well and recombines them into new, better solutions.
The simplest optimization problem contains decision variables, an objective
function and the goal of the optimization (to either minimize or maximize).
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
ConstructorDescriptionThe default constructor.COptQuestOptimization
(int license) Constructor that accepts the license ID as input.Constructor that uses your customized search parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoid
AddConstraint
(COptQuestCompoundConstraint constraint) Adds the constraint defined by the input parameter to the optimization.void
AddConstraint
(COptQuestConstraint constraint) Adds the constraint defined by the input parameter to the optimization.void
AddConstraint
(COptQuestStringConstraint constraint) Adds the string constraint defined by the input parameter to the optimization.void
AddDiscountRate
(COptQuestVariable discountRate) Adds the discount rate variable to the optimization.void
AddObjective
(COptQuestObjective objective) Adds the objective defined by the input parameter to the optimization problem.void
AddObjectiveFunction
(COptQuestObjectiveFunction objectiveFunction) Adds the linear objective function defined by the input parameter to the optimization.void
Adds the permutation group defined by the input parameter to the optimization problem.void
AddRequirement
(COptQuestOrRequirement requirement) Adds the "Or" requirement defined by the input parameter to the optimization.void
AddRequirement
(COptQuestRequirement requirement) Adds the requirement defined by the input parameter to the optimization.void
Adds a Selection Group to the optimization.void
AddSuggestedSolution
(COptQuestSolution suggSol) The input solution is added to the set of suggested solutions.void
AddVariable
(COptQuestVariable variable) Adds the variable defined by the input parameter to the optimization.void
Directs the OptQuest Engine to advance to the next bound when the optimization problems contain aCOptQuestStringConstraint
with variable bounds.void
Use this method to check an optimization for errors.void
Closes the xml nodes in the log setup file and then closes the file.void
void
This method allows the user to continue an optimization that was stopped while iterations or time remained.Creates a new solution that can be used to create a suggested solution.Creates an empty COptQuestSolutionSet object.void
A method that may be overwritten for problems that contain a COptQuestStringConstraint object with variable bounds.void
Evaluate
(COptQuestSolution solution) Virtual method where you provide code to evaluate the solution.void
EvaluateComplete
(COptQuestSolution solution) Use when using parallel evaluators.
Call EvaluateComplete(COptQuestSolution) fromEvaluate(COptQuestSolution)
to indicate the evaluation of the solution is complete.int
Returns the approximate size (in bytes) of a solution (COptQuestSolution).int
Returns the number of cycles specified for automatic stopping by cycles.int
Returns the number of solutions to check without improvement for automatic stopping by percent improvement.double
Returns the percent improvement to check for automatic stopping by percent improvement.Returns the solution that has the best objective value.boolean
Returns the value for duplicate solution checking.int
Returns the number of seconds the optimization has been running.double
Returns the ending variable precision.Returns a lower and upper estimate on the number of iterations to run.Returns an estimate on the maximum number of parallel evaluators that can be used with this problem.int
Returns the value for COptQuestException.EXCEPT_EVALUATE.int
boolean
For advanced users only.boolean
Returns the value for handling non-linear constraints of input values.int
Returns the maximum number of replications set by the call to SetMaximumReplications().int
Returns the minimum number of replications set by the call to SetHeatMapMinimumReplications().GetIterationSolution
(int iteration) Returns the solution that was generated at the iteration specified by the input parameter.int
Returns the maximum number of iterations to run.int
Returns the maximum number of replications set by the call to SetMaximumReplications().int
Returns the number of seconds set by the methodSetMaximumTime(int)
int
Returns the minimum number of replications set by the call to SetMinimumReplications().GetName()
Returns the name assigned to the optimization objectGetNthBestSolution
(int nth) Returns the nth best solution where solutions are ordered from best to worst based on the objective value.GetNthEfficientFrontier
(int n) Returns the solution associated with the nth point of the Efficient Frontier.int
Returns the number of points on the efficient frontier that have been evaluated.int
Returns the number of solutions that have been evaluated.int
Returns the number of solutions that satisfied all linear and non-linear constraints.int
Returns the number of solutions that violated a non-linear constraint.int
Returns the number of solutions that were rejected by callingCOptQuestSolution.RejectSolution()
int
Returns the number of COptQuestStringConstraint objects added to the optimization.Returns the COptQuestObjective object added by the AddObjective() methoddouble
Returns the objective precision.Provides all solutions in the current pattern frontier in no particular order.Provides all solutions in the current pattern frontier sorted by the specified objective.boolean
For advanced users only.GetRequirement
(String Name) Given a requirement name, return the COptQuestRequirement object.double
Returns the starting variable precision.GetStringConstraint
(int index) Returns the string constraint at the index specified by the input parameter.int
Returns the reason the optimization terminated.Returns the reason the optimization terminated as a string.boolean
For advanced users only.boolean
Returns true if infeasible solutions are sorted based on an infeasibility index.boolean
Returns true if the user will stop the optimization using theStopOptimization()
method.boolean
Returns true if the user has called SetUserControlledVariableConstraint(true).boolean
Returns true if general replication processing is turned on.GetVariable
(String Name) Given a variable name, return the COptQuestVariable object.Returns an array of all variables that have been added to the optimization using the AddVariable()method.static String
Returns the version number of the OptQuest Engine.boolean
Returns true if solution evaluation is running additional replications of previously evaluated solutions.Simulations usually need special setup to run an additional replication of a previously run solution.boolean
Returns the value for automatic stopping by optimization cycles.boolean
Returns the value for automatic stopping by percent improvement.boolean
Returns true if all variables in the optimization problem can be enumerated.boolean
Returns true if the solution for the nth point of an Efficient Frontier is feasible.boolean
Returns true if you have called RunRepeatableEvaluations(true).boolean
Returns the current state of the optimization.void
LogSetup() logs calls to the COptQuestOptimization class in an xml formatted file.void
LogSolutions
(String logFilePath) LogSolutions() logs all solutions in a csv formatted file.void
Override this method to monitor the progress of an optimization.void
Optimize()
Method that optimizes the problem.void
This method allows the user to run additional iterations after an optimization has stopped.void
Recalculate() rechecks all evaluated solutions against the current optimization definition.void
RemoveConstraint
(COptQuestConstraint constraint) Removes the constraint from the optimizationvoid
RemoveConstraint
(COptQuestStringConstraint constraint) Removes the constraint from the optimizationvoid
RemoveRequirement
(COptQuestRequirement requirement) Removes a requirement from the optimization.void
RunRepeatableEvaluations
(boolean onOff) If you are running OptQuest with multiple evaluators (you have called SetEvaluate()) the optimization results may vary across multiple runs of the same optimization.void
RunSerialReplications
(boolean onOff) If you are running replications and using multiple evaluators, the replication solutions can be run in parallel, or they can be run serially.void
For use by advanced users who want the search for solutions to be restarted.void
SetAdditionalIterations
(int MoreIterations) Sets the number of additional iterations to be run after an optimization has stopped.void
SetAdditionalReplications
(int MoreReplications) Sets the number of additional replications to be run on the top n solutions.void
SetAdditionalReplicationsSolutions
(int Value) Identifies the top n solutions that will have additional replications run.void
SetAdditionalTime
(int NumberOfSeconds) Sets the number of seconds the additional optimization should run before stopping.void
SetAutoStopByCycles
(boolean stop) Sets the auto stop by optimization cycles option.void
SetAutoStopByPercentImprovement
(boolean stop) Sets the auto stop by percent improvement option.void
SetAutoStopCycles
(int frequency) Sets the autoStopFrequency - defaults to 2, OptQuest works through a combination of techniques at finer levels of numerical precision to find the best solution.void
SetAutoStopNumberSolutions
(int numberSolutions) Sets the autoStopNumberSolutions - defaults to 500 If autoStop is turned on, autoStopNumberSolutions and autoStopPercentImprovement work together to stop the OptQuest search if autoStopNumberSolutions are explored without a cumulative improvement of autoStopPercentImprovement during that time.void
SetAutoStopPercentImprove
(double percentImprove) Sets the autoStopPercentImprovement - defaults to 0.01 If autoStop is turned on, autoStopNumberSolutions and autoStopPercentImprovement work together to stop the OptQuest search if autoStopNumberSolutions are explored without a cumulative improvement of greater than autoStopPercentImprovement during that time.void
SetCannotGenerateAsTermReason
(boolean set) When OptQuest cannot generate any new (different) solutions, OptQuest throws an exception.void
SetCheckDup
(boolean checkDup) Controls duplicate solution checking.void
SetCustomMetadata
(String key, Object value) For advanced users only.void
SetDOEType
(int type) For advanced users only.void
SetEndingVarPrecision
(double precision) The variable precision value is used to compare the values for decision variables and determine duplicate solutions.void
SetEvaluate
(int numberOfParallelEvaluators) The input parameter identifies the number of parallel evaluations that will be performed by the user.void
SetGenerateNewSolutions
(boolean onOff) If you only want OptQuest to call Evaluate() with suggested solutions, call SetGenerateNewSolutions(false).void
SetGradientAnalysis
(boolean Value) For advanced users only.void
SetHandleNonLinear
(boolean onOff) Turn on or off a flag that directs the OptQuest Engine to attempt to solve non-linear constraints that contain only COptQuestVariable objects (i.e.void
SetHeatMapMaximumReplications
(int maximum) Sets the maximum number of replications to be run when running a HeatMap optimization.void
SetHeatMapMinimumReplications
(int minimum) Sets the minimum number of replications to be run when running a HeatMap optimization.void
SetLicenseID
(int license) Used to set the license ID.void
SetMaximumIterations
(int numberOfIterations) Sets the number of iterations the optimization should perform before stopping.void
SetMaximumReplications
(int maximum) Sets the maximum number of replications to be run when running general replication.void
SetMaximumTime
(int NumberOfSeconds) Sets the number of seconds the optimization should run before stopping.void
SetMetaHeuristic
(int meta) For advanced users only.void
SetMinimumReplications
(int minimum) Sets the minimum number of replications to be run when running general replication.void
Assigns a name to the optimization problem.void
SetObjPrecision
(double precision) The objective precision value is used to compare the objective value of solutions and determine if one solution is superior to another.void
SetRandomSeed
(int seed) Allows the random seed to be modified.void
SetRegressionAnalysis
(boolean Value) For advanced users only.void
SetReplicationBatchSize
(int batchSize) Some simulations can run multiple replication in a single simulation run and allow the replication data to be retrieved by replication.When running with confidence settings and a batchSize setting, all replication data will be used to calculate the confidence width.void
SetStartingVarPrecision
(double precision) The variable precision value is used to compare the values for decision variables and determine duplicate solutions.void
SetUseCrossEntropy
(boolean useCrossEntropy) For advanced users only.void
SetUseDOE
(boolean useDOE) For advanced users only.void
SetUseInfeasibilityIndex
(boolean use) Allows infeasible solutions to be ranked according to their proximity to feasibility which affects the order solutions are returned when GetNthBestSolution() is called.void
SetUseKrigSolutionGenerator
(boolean onOff) If enabled, the Krig solution generator periodically creates a metamodel of the response surface and uses it to accelerate the optimization search.void
SetUseMinimizeError
(boolean use) If this feature is turned on, tolerances are set to 0 for constraint and variable checkingvoid
SetUsePortfolioAlgorithms
(boolean Value) If the input parameter is true, the OptQuest Engine will use portfolio algorithms to find a good starting solution for portfolio optimizations.void
SetUserControlledStop
(boolean stop) Indicates the user will stop the optimization by calling theStopOptimization()
method.void
SetUserControlledVariableConstraint
(boolean Value) This method is used when the optimization contains a constraint with variable bounds.void
SetUseReplications
(boolean Value) Use to turn on the general replication algorithm.void
StopOnSuccessfulMILP
(boolean stop) When this is set to true, the optimization stops as soon as it finds an optimal solution in the case that the optimization is a mixed integer linear program (MILP).void
When this method is called, OptQuest will stop immediately.void
When this method is called, OptQuest will not generate any new solutions.void
UseEnglishOnly
(boolean onOff) Used to force string parsing to treat all strings as english format regardless of the current culture.
-
Field Details
-
TERM_NOTSTARTED
public static final int TERM_NOTSTARTED- See Also:
-
TERM_RUNNING
public static final int TERM_RUNNING- See Also:
-
TERM_LP
public static final int TERM_LP- See Also:
-
TERM_AUTOSTOP
public static final int TERM_AUTOSTOP- See Also:
-
TERM_OPTIMALFOUND
public static final int TERM_OPTIMALFOUND- See Also:
-
TERM_MAXITERATIONS
public static final int TERM_MAXITERATIONS- See Also:
-
TERM_MAXTIME
public static final int TERM_MAXTIME- See Also:
-
TERM_USERSTOPPED
public static final int TERM_USERSTOPPED- See Also:
-
TERM_BESTFOUND
public static final int TERM_BESTFOUND- See Also:
-
TERM_EXCEPTION
public static final int TERM_EXCEPTION- See Also:
-
TERM_FACTORIESDONE
public static final int TERM_FACTORIESDONE- See Also:
-
TERM_INFEASIBLE
public static final int TERM_INFEASIBLE- See Also:
-
TERM_CANNOTGENERATE
public static final int TERM_CANNOTGENERATE- See Also:
-
TERM_MAXDEMOITERATIONS
public static final int TERM_MAXDEMOITERATIONS- See Also:
-
REPLTERM_NEEDMORE
public static final int REPLTERM_NEEDMORE- See Also:
-
REPLTERM_MAXREPLICATIONS
public static final int REPLTERM_MAXREPLICATIONS- See Also:
-
REPLTERM_METCONFIDENCE
public static final int REPLTERM_METCONFIDENCE- See Also:
-
REPLTERM_NOTNEARBEST
public static final int REPLTERM_NOTNEARBEST- See Also:
-
REPLTERM_REMOVEBYRAS
public static final int REPLTERM_REMOVEBYRAS- See Also:
-
REPLTERM_STILLINRAS
public static final int REPLTERM_STILLINRAS- See Also:
-
DEMOLICENSE
public static final int DEMOLICENSE- See Also:
-
OCLP_NONE
public static final int OCLP_NONE- See Also:
-
OCLP_MEAN
public static final int OCLP_MEAN- See Also:
-
OCLP_MEDIAN
public static final int OCLP_MEDIAN- See Also:
-
OCLP_PERCENTILE
public static final int OCLP_PERCENTILE- See Also:
-
OCLP_STDDEV
public static final int OCLP_STDDEV- See Also:
-
OCLP_SEMI1STDDEV
public static final int OCLP_SEMI1STDDEV- See Also:
-
OCLP_VARIANCE
public static final int OCLP_VARIANCE- See Also:
-
OCLP_SEMI1VARIANCE
public static final int OCLP_SEMI1VARIANCE- See Also:
-
OCLP_COEFFOFVAR
public static final int OCLP_COEFFOFVAR- See Also:
-
OCLP_COEFFOFSEMI1VAR
public static final int OCLP_COEFFOFSEMI1VAR- See Also:
-
OCLP_PROBABILITY
public static final int OCLP_PROBABILITY- See Also:
-
OCLP_SEMI2STDDEV
public static final int OCLP_SEMI2STDDEV- See Also:
-
OCLP_SEMI2VARIANCE
public static final int OCLP_SEMI2VARIANCE- See Also:
-
OCLP_COEFFOFSEMI2VAR
public static final int OCLP_COEFFOFSEMI2VAR- See Also:
-
OCLP_MIN
public static final int OCLP_MIN- See Also:
-
OCLP_MAX
public static final int OCLP_MAX- See Also:
-
OCLP_SUM
public static final int OCLP_SUM- See Also:
-
OCLP_NPV
public static final int OCLP_NPV- See Also:
-
OCLP_IRR
public static final int OCLP_IRR- See Also:
-
OCLP_PBP
public static final int OCLP_PBP- See Also:
-
-
Constructor Details
-
COptQuestOptimization
public COptQuestOptimization()The default constructor. The license ID must be set by theSetLicenseID(int)
method. -
COptQuestOptimization
public COptQuestOptimization(int license) Constructor that accepts the license ID as input.- Parameters:
license
- the license ID assigned by OptTek Systems, Inc.
-
COptQuestOptimization
Constructor that uses your customized search parameters. Users should not modify the search parameters unless they have been directed to make changes by OptTek Systems, Inc.
-
-
Method Details
-
RunRepeatableEvaluations
public void RunRepeatableEvaluations(boolean onOff) If you are running OptQuest with multiple evaluators (you have called SetEvaluate()) the optimization results may vary across multiple runs of the same optimization. The generation of new solutions is dependent on the solutions available to OptQuest. In the default case, OptQuest generates new solutions as evaluations complete. If you require repeatable results, OptQuest will wait for all evaluators to complete and then process the solutions in iteration order. If the number of solutions is not a multiple of the number of evaluators, the last solutions may not be repeatable. For example, if the number of evaluators is 7 and you run 55 iterations, iterations 1 - 49 will be repeatable. Solutions 50 - 55 may not be. By default, OptQuest does not guarantee repeatable results with multiple evaluators.- Parameters:
onOff
- - true if you want OptQuest to produce repeatable results across each run of the optimization, false if it is OK for results to vary across each run.
-
IsRunRepeatableEvaluation
public boolean IsRunRepeatableEvaluation()Returns true if you have called RunRepeatableEvaluations(true).- Returns:
- - Returns true if you have called RunRepeatableEvaluations(true). Otherwise, returns false;
-
RunSerialReplications
public void RunSerialReplications(boolean onOff) 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.- Parameters:
onOff
- - if true, replications of a solution are run serially. If false, replications of a solution are run in parallel. The default value is to run replications in parallel.
-
GetVersion
Returns the version number of the OptQuest Engine. -
Recalculate
Recalculate() rechecks all evaluated solutions against the current optimization definition. It should be called after an optimization has completed or has been stopped and the optimization problem has been modified. If you callOptimizeAdditional()
after modifying the optimization problem, all evaluated solutions are automatically rechecked.- Throws:
COptQuestException
- if a problem is encountered
-
SetName
Assigns a name to the optimization problem. -
GetName
Returns the name assigned to the optimization object -
SetUseCrossEntropy
public void SetUseCrossEntropy(boolean useCrossEntropy) For advanced users only. Contact OptTek Systems, Inc. -
GetUseCrossEntropy
public boolean GetUseCrossEntropy()For advanced users only. Contact OptTek Systems, Inc. -
SetUseDOE
public void SetUseDOE(boolean useDOE) For advanced users only. Contact OptTek Systems, Inc. -
GetNumberofCompletedIterations
public int GetNumberofCompletedIterations()Returns the number of solutions that have been evaluated. The count includes feasible solutions, infeasible solutions and rejected solutions. -
Evaluate
Virtual method where you provide code to evaluate the solution. The Evaluate(COptQuestSolution) method is called to calculate the value of the objective function, requirements and user controlled variables. Use theGetVariableValue(COptQuestVariable)
method to retrieve the value of each decision variable. Use the COptQuestSolution.Set methods to set the calculated value for the objective function, user controlled variables and requirements. Parallel Optimization Note: The solution parameter will be null if all parallel solutions are being evaluated. You should not return from the Evaluate(COptQuestSolution) method until at least one solution has completed evaluation as the Evaluate(COptQuestSolution) method will immediately return with a null solution. Note: Use theMonitorStatus(COptQuestSolution)
method to plot the progress of the best solution. The best solution is updated after the Evaluate() method has completed.- Parameters:
solution
- solution to be evaluated- Throws:
COptQuestException
- if a problem is encountered
-
GetNumberEfficientFrontier
public int GetNumberEfficientFrontier()Returns the number of points on the efficient frontier that have been evaluated.- Returns:
- the number of points on the efficient frontier that have been evaluated.
-
GetNthEfficientFrontier
Returns the solution associated with the nth point of the Efficient Frontier. While the optimization is running, the solution for a point on the efficient frontier will be updated if a better solution is found. If you are updating an Efficient Frontier chart while the optimization is running, you should call GetNthEfficientFrontier() for each previously evaluated point. For example, if the EfficientFrontier() method is called for the 3rd point, you should call GetNthEfficientFrontier() for the first two points. The methodGetNumberEfficientFrontier()
will tell you how many points have been evaluated.- Parameters:
n
- 1 based index identifying the Efficient Frontier point- Returns:
- COptQuestSolution associated with the specified bound. Return null if no solution exists for the specified point.
-
IsNthEfficientFrontierFeasible
public boolean IsNthEfficientFrontierFeasible(int n) Returns true if the solution for the nth point of an Efficient Frontier is feasible. While the optimization is running, the solution for a point on the efficient frontier will be updated if a better solution is found. If you are updating an Efficient Frontier chart while the optimization is running, you should callGetNthEfficientFrontier(int)
for each previously evaluated point. This method will tell you if the solution for the point is feasible or infeasible.- Parameters:
n
- 1 based index identifying the Efficient Frontier point- Returns:
- true if the solution is feasible. Returns false if the solution is infeasible or if no solution exists for the specified point.
-
EfficientFrontier
A method that may be overwritten for problems that contain a COptQuestStringConstraint object with variable bounds. This method is called when the evaluations for a bound are complete. The best solution at that point is recorded.- Throws:
COptQuestException
- if a problem is encountered
-
MonitorStatus
Override this method to monitor the progress of an optimization. The MonitorStatus(COptQuestSolution) method is called when a solution has completed evaluation. When MonitorStatus(COptQuestSolution) is called, the solution has been checked for feasibility and the best solution has been identified.- Parameters:
sol
- - the solution that has completed evaluation- Throws:
COptQuestException
- if a problem is encountered
-
EvaluateComplete
Use when using parallel evaluators.
Call EvaluateComplete(COptQuestSolution) fromEvaluate(COptQuestSolution)
to indicate the evaluation of the solution is complete. The input parameter is the solution that has completed evaluation.- Parameters:
solution
- completed solution- Throws:
COptQuestException
- if a problem is encountered
-
SetMaximumIterations
public void SetMaximumIterations(int numberOfIterations) Sets the number of iterations the optimization should perform before stopping. If multiple stop options are set, the optimization will stop at the first option that is satisfied.- Parameters:
numberOfIterations
- number of optimization iterations to be performed.
-
GetMaximumIterations
public int GetMaximumIterations()Returns the maximum number of iterations to run.- Returns:
- - the maximum number of iterations to run
-
SetMaximumTime
public void SetMaximumTime(int NumberOfSeconds) 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 NumberOfSeconds.- Parameters:
NumberOfSeconds
- maximum number of seconds
-
GetMaximumTime
public int GetMaximumTime()Returns the number of seconds set by the methodSetMaximumTime(int)
- Returns:
- the number of seconds the optimization should run.
-
GetElapsedTime
public int GetElapsedTime()Returns the number of seconds the optimization has been running.- Returns:
- number of seconds since the optimization started
-
SetUserControlledStop
public void SetUserControlledStop(boolean stop) Indicates the user will stop the optimization by calling theStopOptimization()
method.- Parameters:
stop
- true if the user will stop the optimization. False if the optimization will be stopped by setting the number of iterations or the maximum time.
-
GetUserControlledStop
public boolean GetUserControlledStop()Returns true if the user will stop the optimization using theStopOptimization()
method. Returns false if the optimization will stop after a number of iterations or a maximum time is reached.- Returns:
- true if the user will stop the optimization. Otherwise, return false.
-
AddVariable
Adds the variable defined by the input parameter to the optimization. If the user is naming variables, the name must be unique and cannot be an OptQuest keyword such as a math function name.- Throws:
COptQuestException
- if a problem is encountered
-
AddSelectionGroup
Adds a Selection Group to the optimization. Selection groups allow a variable that can be turned "off" which indicates that other variables will not be used in the evaluation. -
AddObjective
Adds the objective defined by the input parameter to the optimization problem.- Throws:
COptQuestException
- if an objective already exists
-
GetObjective
Returns the COptQuestObjective object added by the AddObjective() method -
AddDiscountRate
Adds the discount rate variable to the optimization. Only one discount rate variable can be added to an optimization.- Parameters:
discountRate
- the discount rate- Throws:
COptQuestException
- if discount rate is already set
-
AddConstraint
Adds the constraint defined by the input parameter to the optimization. If an optimization problem contains multiple constraints, the constraints are ANDed together. If a solution is feasible, it satisfies every constraint in the optimization.- Parameters:
constraint
- the constraint to add
-
AddConstraint
Adds the string constraint defined by the input parameter to the optimization. If an optimization problem contains multiple constraints, the constraints are ANDed together. If a solution is feasible, it satisfies every constraint in the optimization.- Parameters:
constraint
- the constraint to add- Throws:
COptQuestException
- if the string expression is empty.
-
AddConstraint
Adds the constraint defined by the input parameter to the optimization. SeeCOptQuestOrConstraint
for further documentation on a compound constraint. If an optimization problem contains multiple constraints, the constraints are ANDed together. If a solution is feasible, it satisfies every constraint in the optimization.- Parameters:
constraint
- - the constraint to add
-
RemoveConstraint
Removes the constraint from the optimization- Parameters:
constraint
- - the constraint to remove- Throws:
COptQuestException
- if the constraint cannot be found in the optimization problem
-
RemoveConstraint
Removes the constraint from the optimization- Parameters:
constraint
- - the constraint to remove- Throws:
COptQuestException
- if the constraint cannot be found in the optimization problem
-
AddRequirement
Adds the requirement defined by the input parameter to the optimization.- Parameters:
requirement
- the requirement to add- Throws:
COptQuestException
- if an optimization is running
-
AddRequirement
Adds the "Or" requirement defined by the input parameter to the optimization.- Parameters:
requirement
- the requirement to add- Throws:
COptQuestException
- if an optimization is running
-
RemoveRequirement
Removes a requirement from the optimization. If an optimization is in progress, all evaluated solutions are recalculated without the requirement. If the optimization has completed, evaluated solutions are recalculated when you callOptimizeAdditional()
to generate more solutions, or you can force the evaluated solutions to be recalculated by callingRecalculate()
. The requirement parameter must be the exact same requirement object that was previously added to the optimization.- Parameters:
requirement
- - the requirement to remove
-
ChangeVariableConstraint
Directs the OptQuest Engine to advance to the next bound when the optimization problems contain aCOptQuestStringConstraint
with variable bounds. The user must callSetUserControlledVariableConstraint(boolean)
before the optimization starts. Example: x1 + x2 + x3 ≤ 100,200,300.- Throws:
COptQuestException
- if not using a user controlled variable constraint
-
AddSuggestedSolution
The input solution is added to the set of suggested solutions. If the optimization has not started, the suggested solution will be evaluated first If the optimization is running, the suggested solution will be one of the next solutions to be evaluated. To create a suggested solution, callCreateSolution()
. Use theSetVariableValue(COptQuestVariable, double)
method to set a value for each decision variable. Note: All decision variables must be added to the optimization problem before adding a suggested solution. Note: If multiple suggested solutions are added they will be returned for evaluation in reverse order (last in, first out). Note: If multiple suggested solutions are added, OptQuest may return additional solutions for evaluation between the suggested solutions specified.- Parameters:
suggSol
- the suggested solution to add
-
StopOptimization
public void StopOptimization()When this method is called, OptQuest will stop immediately. No new solutions will be sent for evaluation. Solutions returned after this method is called are ignored. -
AddPermutationGroup
Adds the permutation group defined by the input parameter to the optimization problem. -
SetCannotGenerateAsTermReason
public void SetCannotGenerateAsTermReason(boolean set) When OptQuest cannot generate any new (different) solutions, OptQuest throws an exception. This method allows you to specify that you want this condition handled as a termination reason rather than an exception.- Parameters:
set
- false will throw an exception when new solutions cannot be generated. true will set the termination reason to TERM_CANNOTGENERATE.
-
SetMetaHeuristic
public void SetMetaHeuristic(int meta) For advanced users only. Contact OptTek Systems, Inc. -
SetGenerateNewSolutions
public void SetGenerateNewSolutions(boolean onOff) If you only want OptQuest to call Evaluate() with suggested solutions, call SetGenerateNewSolutions(false). The default condition is to call Evaluate() with all suggested solutions and then with OptQuest generated solutions. -
SetCustomMetadata
For advanced users only. Contact OptTek Systems, Inc. -
SetDOEType
public void SetDOEType(int type) For advanced users only. Contact OptTek Systems, Inc.- Parameters:
type
- DOE type
-
CheckOptimization
Use this method to check an optimization for errors. A COptQuestException is thrown if an error is found. The exception identifies the type of error.- Throws:
COptQuestException
- if a problem is encountered
-
Optimize
Method that optimizes the problem. The optimize method first validates the problem. If there is an error in the optimization definition, an exception is thrown. It then begins the iterative process of finding a solution, evaluating the solution (Evaluate(COptQuestSolution)
), analyzing the solution to see if it is feasible and determining if it is a better solution than the current best solution. Optimization stops based on the criteria set by the user.- Throws:
COptQuestException
- if a problem is encountered
-
SetEvaluate
The input parameter identifies the number of parallel evaluations that will be performed by the user. This should correspond to the number of processors/computer available for evaluation. During optimization, OptQuest will provide this manyCOptQuestSolutions
at a time through calls toEvaluate(COptQuestSolution)
.
OptQuest defaults to a single evaluator, so this method is only needed if more than one evaluator is desired. In most cases with parallel evaluators, this method is called once before the call toOptimize()
. In an environment with a dynamic number of available evaluators, the SetEvaluate(int) method may be called more than once during the optimization process to add additional evaluators. Evaluators cannot be removed once they have been added.- Parameters:
numberOfParallelEvaluators
- number of parallel evaluators- Throws:
COptQuestException
- if you call this method with less than one or greater than 5000 evaluators or if you attempt to remove evaluators
-
GetEvaluatorCount
public int GetEvaluatorCount() -
GetEvaluateException
public int GetEvaluateException()Returns the value for COptQuestException.EXCEPT_EVALUATE. You can create a COptQuestException in the virtual Evaluate() method to report exceptions during evaluation.- Returns:
- the integer value associated with COptQuestException.EXCEPT_EVALUATE
-
SetLicenseID
public void SetLicenseID(int license) Used to set the license ID. License IDs are assigned by OptTek Systems, Inc.- Parameters:
license
- license id
-
SetRegressionAnalysis
public void SetRegressionAnalysis(boolean Value) For advanced users only. Contact OptTek Systems, Inc. -
SetGradientAnalysis
public void SetGradientAnalysis(boolean Value) For advanced users only. Contact OptTek Systems, Inc. -
SetObjPrecision
public void SetObjPrecision(double precision) The objective precision value is used to compare the objective value of solutions and determine if one solution is superior to another. The default starting value for the objective precision is .01. As the optimization progresses, the value is decreased. This method must be called before the Optimize() method is called to start the optimization.- Parameters:
precision
- to be used for the starting objective precision.
-
SetStartingVarPrecision
public void SetStartingVarPrecision(double precision) The variable precision value is used to compare the values for decision variables and determine duplicate solutions. Two decision variables are considered to have the same value if their difference is ≤ the variable precision * the range of the variable. The default starting value for the variable precision is .01. As the optimization progresses, the value is decreased. This method must be called before the Optimize() method is called to start the optimization.- Parameters:
precision
- to be used for the starting variable precision
-
SetEndingVarPrecision
public void SetEndingVarPrecision(double precision) The variable precision value is used to compare the values for decision variables and determine duplicate solutions. Two decision variables are considered to have the same value if their difference is ≤ the variable precision * the range of the variable. The default ending value for the variable precision is .00000001. As the optimization progresses, the value is decreased. This method must be called before the Optimize() method is called to start the optimization.- Parameters:
precision
- to be used for the ending variable precision
-
SetCheckDup
public void SetCheckDup(boolean checkDup) Controls duplicate solution checking. By default, each solution is checked against the internal database of solution to see if it has already been tried. If it is a unique solution, it is passed to you for evaluation. If it is not unique, it is discarded. You can turn off duplicate solution checking by setting the input parameter to false.- Parameters:
checkDup
- true if a check should be made for duplicate solutions. False if solutions should not be checked.
-
SetAutoStopByCycles
public void SetAutoStopByCycles(boolean stop) Sets the auto stop by optimization cycles option. If the input parameter is true, auto stop by optimization cycles is turned on. The default is auto stop by optimization cycles is turned off. Auto stop is not available if running additional optimizations. AUTOSTOPCYCLES - defaults to 2 When automatic stop by optimization cycles is set, the optimization will stop when the number of specified auto stop cycles is reached. OptQuest works through a combination of techniques at finer levels of numerical precision to find the best solution. It will cycle through these techniques repeatedly as the search continues. This parameter limits the number of times OptQuest cycles through these techniques.- Parameters:
stop
- true if auto stop by optimization cycles is to be used. False if it is not to be used.
-
SetAutoStopByPercentImprovement
public void SetAutoStopByPercentImprovement(boolean stop) Sets the auto stop by percent improvement option. If the input parameter is true, auto stop by percent improvement is turned on. The default is auto stop by percent improvement is turned off. This auto stop option is only applicable to single objective problems. Auto stop is not available if running additional optimizations. AUTOSTOPNUMSOLUTIONS - defaults to 500 AUTOSTOPPERCENTIMPROVE - defaults to 0.01 When automatic stop by percent improvement is set, the optimization will stop when AUTOSTOPNUMSOLUTIONS are explored without a cumulative improvement of AUTOSTOPPERCENTIMPROVE during that time. Improvement is relative percent improvement based on the best and worst feasible objective values encountered.- Parameters:
stop
- true if auto stop by percent improvement is to be used. False if it is not to be used.
-
SetAutoStopCycles
public void SetAutoStopCycles(int frequency) Sets the autoStopFrequency - defaults to 2, OptQuest works through a combination of techniques at finer levels of numerical precision to find the best solution. It will cycle through these techniques repeatedly as the search continues. This parameter limits the number of times OptQuest cycles through these techniques if autoStop is turned on.- Parameters:
frequency
- the number of times OptQuest cycles through its search techniques
-
SetAutoStopNumberSolutions
public void SetAutoStopNumberSolutions(int numberSolutions) Sets the autoStopNumberSolutions - defaults to 500 If autoStop is turned on, autoStopNumberSolutions and autoStopPercentImprovement work together to stop the OptQuest search if autoStopNumberSolutions are explored without a cumulative improvement of autoStopPercentImprovement during that time.- Parameters:
numberSolutions
- stop if this number of solutions is explored without making the specified improvement
-
SetAutoStopPercentImprove
public void SetAutoStopPercentImprove(double percentImprove) Sets the autoStopPercentImprovement - defaults to 0.01 If autoStop is turned on, autoStopNumberSolutions and autoStopPercentImprovement work together to stop the OptQuest search if autoStopNumberSolutions are explored without a cumulative improvement of greater than autoStopPercentImprovement during that time.- Parameters:
percentImprove
- stop if the autoStopNumberSolutions is explored without making more than this amount of improvement, allowed values are 0.0 through 0.2
-
SetHandleNonLinear
public void SetHandleNonLinear(boolean onOff) Turn on or off a flag that directs the OptQuest Engine to attempt to solve non-linear constraints that contain only COptQuestVariable objects (i.e. they do not contain a COptQuestUserControlledVariable). The default value is True. Note: If OptQuest cannot find any feasible solutions then an COptQuestException.EXCEPT_NONLINEAR_CONSTRAINTINFEASIBLE exception will be thrown. This decision applies to user added suggested solutions as well internally generated solutions.- Parameters:
onOff
- true - OptQuest will attempt to solve non-linear constraint of inputs false - OptQuest will send potentially infeasible solutions for evaluation
-
SetUserControlledVariableConstraint
public void SetUserControlledVariableConstraint(boolean Value) This method is used when the optimization contains a constraint with variable bounds. If the input value is true, it indicates the user will control when the next bound should be used by calling theChangeVariableConstraint()
method.- Parameters:
Value
- true indicates the user will control changing the bounds of a variable constraint. If false, the OptQuest Engine will determine when to advance to the next bound.
-
SetRandomSeed
public void 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.
-
GetRegressionAnalysis
public boolean GetRegressionAnalysis()For advanced users only. Contact OptTek Systems, Inc. -
GetGradientAnalysis
public boolean GetGradientAnalysis()For advanced users only. Contact OptTek Systems, Inc. -
GetObjPrecision
public double GetObjPrecision()Returns the objective precision. -
GetStartingVarPrecision
public double GetStartingVarPrecision()Returns the starting variable precision. -
GetEndingVarPrecision
public double GetEndingVarPrecision()Returns the ending variable precision. -
GetCheckDup
public boolean GetCheckDup()Returns the value for duplicate solution checking.- Returns:
- true if duplicate solution checking is turned on. Returns false if it is turned off.
-
IsAutoStopByCycles
public boolean IsAutoStopByCycles()Returns the value for automatic stopping by optimization cycles.- Returns:
- true if automatic stopping by optimization cycles is turned on. Returns false if it is turned off.
-
GetAutoStopCycles
public int GetAutoStopCycles()Returns the number of cycles specified for automatic stopping by cycles.- Returns:
- the number of autostop cycles.
-
IsAutoStopByPercentImprovement
public boolean IsAutoStopByPercentImprovement()Returns the value for automatic stopping by percent improvement.- Returns:
- true if automatic stopping by percent improvement is turned on. Returns false if it is turned off.
-
GetAutoStopPercentImprove
public double GetAutoStopPercentImprove()Returns the percent improvement to check for automatic stopping by percent improvement.- Returns:
- the percent improvement to check for
-
GetAutoStopNumberSolutions
public int GetAutoStopNumberSolutions()Returns the number of solutions to check without improvement for automatic stopping by percent improvement.- Returns:
- the number of solutions to check without improvement
-
GetHandleNonLinear
public boolean GetHandleNonLinear()Returns the value for handling non-linear constraints of input values.- Returns:
- true if OptQuest is attempting to create solutions that are feasible for non-linear constraints of input variables. false otherwise.
-
GetUserControlledVariableConstraint
public boolean GetUserControlledVariableConstraint()Returns true if the user has called SetUserControlledVariableConstraint(true). Otherwise, returns false. These methods are used when an optimization problem has a constraint with varying bounds and the user will tell OptQuest when to advance to the next bound.- Returns:
- true if the user is controlling advancing to the next bound of a constraint with varying bounds.
-
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
-
GetTerminationReasonString
Returns the reason the optimization terminated as a string.- Returns:
- A string explaining why the optimization stopped.
-
SetUseReplications
public void SetUseReplications(boolean Value) Use to turn on the general replication algorithm. Your Evaluate() method will be called to evaluate each replication of a solution. -
GetUseReplications
public boolean GetUseReplications()Returns true if general replication processing is turned on. Returns false if it is not.- Returns:
- true if general replication processing is turned on.
-
SetMinimumReplications
Sets the minimum number of replications to be run when running general replication. The default is 2 replication and the minimum value allowed is 2.- Parameters:
minimum
- the minimum number of replications to be run before stopping replication processing.- Throws:
COptQuestException
- if provided value is less than the 2
-
GetMinimumReplications
public int GetMinimumReplications()Returns the minimum number of replications set by the call to SetMinimumReplications().- Returns:
- the minimum number of replications to be run before stopping.
-
SetMaximumReplications
public void SetMaximumReplications(int maximum) Sets the maximum number of replications to be run when running general replication. If you are running with confidence type 1 or 2, you can set the maximum to -1 which means we will run replications until the confidence criteria is met.- Parameters:
maximum
- the maximum number of replications to be run before stopping replication processing.
-
GetMaximumReplications
public int GetMaximumReplications()Returns the maximum number of replications set by the call to SetMaximumReplications().- Returns:
- the maximum number of replications to be run
-
SetHeatMapMinimumReplications
Sets the minimum number of replications to be run when running a HeatMap optimization. The default is 1.- Parameters:
minimum
- the minimum number of replications to be run before stopping replication processing in HeatMap mode- Throws:
COptQuestException
- if value provided is less than 1
-
GetHeatMapMinimumReplications
public int GetHeatMapMinimumReplications()Returns the minimum number of replications set by the call to SetHeatMapMinimumReplications().- Returns:
- the minimum number of replications to be run before stopping.
-
SetHeatMapMaximumReplications
Sets the maximum number of replications to be run when running a HeatMap optimization. The default is 1.- Parameters:
maximum
- the maximum number of replications to be run before stopping replication processing.- Throws:
COptQuestException
- if value provided is less than 1
-
GetHeatMapMaximumReplications
public int GetHeatMapMaximumReplications()Returns the maximum number of replications set by the call to SetMaximumReplications().- Returns:
- the maximum number of replications to be run
-
SetAdditionalReplicationsSolutions
Identifies the top n solutions that will have additional replications run. The method SetAdditionalReplications() identifies how many additional replications should be run. OptimizeAdditional() calls Evaluate() for each additional replication.- Parameters:
Value
- identifies the top n solutions that will have additional replications run.- Throws:
COptQuestException
- if not running with replications
-
IsAdditionalReplicationsMode
public boolean IsAdditionalReplicationsMode()Returns true if solution evaluation is running additional replications of previously evaluated solutions.Simulations usually need special setup to run an additional replication of a previously run solution.- Returns:
- true if solution evaluation is running additional replications
-
SearchRestart
For use by advanced users who want the search for solutions to be restarted. The call to this method will restart the search algorithms while keeping the database of evaluated solutions.- Throws:
COptQuestException
- if a problem is encountered
-
SetAdditionalReplications
Sets the number of additional replications to be run on the top n solutions. The method SetAdditionalReplicationSolutions() identifies the top n solutions. The default is to run additional replications on all solutions. Call the method OptimizeAdditional() to evaluate the additional replications.- Parameters:
MoreReplications
- the number of additional replications to be run- Throws:
COptQuestException
- if not running replications
-
SetAdditionalIterations
public void SetAdditionalIterations(int MoreIterations) Sets the number of additional iterations to be run after an optimization has stopped. UseOptimizeAdditional()
to run the additional iterations.- Parameters:
MoreIterations
- the number of additional iterations to be run
-
SetAdditionalTime
public void SetAdditionalTime(int NumberOfSeconds) Sets the number of seconds the additional 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 NumberOfSeconds.- Parameters:
NumberOfSeconds
- additional seconds to run
-
OptimizeAdditional
This method allows the user to run additional iterations after an optimization has stopped. To run additional iterations, useSetAdditionalIterations(int)
to specify the number of additional iterations to run. To run additional replications on a set of solutions, call the methodSetAdditionalReplications(int)
to specify the number of additional replications. To specify the number of solutions that will have additional replications evaluated useSetAdditionalReplicationsSolutions(int)
.- Throws:
COptQuestException
- if a problem is encountered
-
ContinueOptimize
This method allows the user to continue an optimization that was stopped while iterations or time remained. If you set additional iterations or time, the remaining iterations/time are added to the additional iterations/time. In addition, if an efficient frontier was running, it will continue. The new iteration count/time will be evenly divided among the bounds that did not complete evaluation in the original optimization.- Throws:
COptQuestException
- if a problem is encountered
-
SetUsePortfolioAlgorithms
public void SetUsePortfolioAlgorithms(boolean Value) If the input parameter is true, the OptQuest Engine will use portfolio algorithms to find a good starting solution for portfolio optimizations. Portfolio algorithms are used to enhance the search algorithms by looking for a good starting solution based on the statistic(s) and measure(s) defined in the problem. If the value is true, the OptQuest Engine will use portfolio algorithms to enhance the search.- Parameters:
Value
- true if portfolio algorithms should be used. False if they should not be used.
-
AddObjectiveFunction
public void AddObjectiveFunction(COptQuestObjectiveFunction objectiveFunction) throws COptQuestException Adds the linear objective function defined by the input parameter to the optimization.- Parameters:
objectiveFunction
- COptQuestObjectiveFunction object which defines a linear objective.- Throws:
COptQuestException
- if an objective is already defined
-
LogSetup
LogSetup() logs calls to the COptQuestOptimization class in an xml formatted file. This is used for debugging optimization setup problems.- Parameters:
logFilePath
- path to a file that will contain the logging info- Throws:
IOException
- if the file cannot be accessed
-
CloseLogSetupFile
public void CloseLogSetupFile()Closes the xml nodes in the log setup file and then closes the file. Use in conjunction with LogSetup() to have a properly formatted XML file. -
LogSolutions
LogSolutions() logs all solutions in a csv formatted file. This is used for debugging solution generation.- Parameters:
logFilePath
- path to a file that will contain the solution log- Throws:
IOException
- if the file cannot be accessed
-
CloseSolutionLog
public void CloseSolutionLog() -
GetVariable
Given a variable name, return the COptQuestVariable object.- Parameters:
Name
- variable name- Returns:
- - COptQuestVariable object with that name
-
GetRequirement
Given a requirement name, return the COptQuestRequirement object.- Parameters:
Name
- requirement name- Returns:
- - COptQuestRequirement object with that name.
-
GetVariables
Returns an array of all variables that have been added to the optimization using the AddVariable()method.- Returns:
- array of COptQuestVariable objects
-
GetNumberOfStringConstraints
public int GetNumberOfStringConstraints()Returns the number of COptQuestStringConstraint objects added to the optimization.- Returns:
- number of COptQuestStringConstraint objects
-
GetStringConstraint
Returns the string constraint at the index specified by the input parameter.- Parameters:
index
- index of the constraint- Returns:
- the string constraint at the specified index
-
GetBestSolution
Returns the solution that has the best objective value. Returns null if no best solution exists.- Returns:
- the best solution
-
GetNthBestSolution
Returns the nth best solution where solutions are ordered from best to worst based on the objective value. If the input parameter is 1, the best solution is returned, If the input parameter is 2, the second-best solution etc. If the nth best solution doesn't exist, null is returned.- Parameters:
nth
- 1 based number of the solution to return- Returns:
- the solution that produced the Nth best objective value
-
GetIterationSolution
Returns the solution that was generated at the iteration specified by the input parameter. Returns null if the solution doesn't exist. -
GetNumberOfFeasibleSolutions
public int GetNumberOfFeasibleSolutions()Returns the number of solutions that satisfied all linear and non-linear constraints. -
GetNumberOfInfeasibleSolutions
public int GetNumberOfInfeasibleSolutions()Returns the number of solutions that violated a non-linear constraint.- Returns:
- the number of infeasible solutions
-
GetNumberOfRejectedSolutions
public int GetNumberOfRejectedSolutions()Returns the number of solutions that were rejected by callingCOptQuestSolution.RejectSolution()
-
IsEnumerable
public boolean IsEnumerable()Returns true if all variables in the optimization problem can be enumerated. Note that if the combination of the variables results in a large solution space, OptQuest will not enumerate all possible solutions.- Returns:
- true if all the variables in the problem can be enumerated.
-
CreateSolution
Creates a new solution that can be used to create a suggested solution. The variable values are initialized to the last suggested value or the midpoint of the lower and upper bound if no solution has been suggested.- Returns:
- a new solution
- Throws:
COptQuestException
- if a problem is encountered
-
CreateSolutionSet
Creates an empty COptQuestSolutionSet object. To fill the set call COptQuestSolutionSet.LoadSolutionSet() COptQuestSolutionSet.- Returns:
- an empty COptQuestSolutionSet object.
-
GetPatternFrontier
Provides all solutions in the current pattern frontier in no particular order.- Returns:
- An unsorted ArrayList<COptQuestSolution> of solutions on the pattern frontier.
-
GetPatternFrontier
public ArrayList<COptQuestSolution> GetPatternFrontier(COptQuestSingleObjective obj) throws COptQuestException Provides all solutions in the current pattern frontier sorted by the specified objective.- Parameters:
obj
- the objective to sort by- Returns:
- A sorted ArrayList<COptQuestSolution> of solutions on the pattern frontier.
- Throws:
COptQuestException
- if objective not found
-
StopOnSuccessfulMILP
public void StopOnSuccessfulMILP(boolean stop) When this is set to true, the optimization stops as soon as it finds an optimal solution in the case that the optimization is a mixed integer linear program (MILP). -
SetUseInfeasibilityIndex
public void SetUseInfeasibilityIndex(boolean use) Allows infeasible solutions to be ranked according to their proximity to feasibility which affects the order solutions are returned when GetNthBestSolution() is called. An infeasibility index or infeasibility measure is calculated that is equal to the sum of all relative differences between the LHS and RHS for all requirements and non-linear constraints. The infeasible solutions are than ranked by this index. Note that feasible solutions are always ranked by their objective value.- Parameters:
use
- true if infeasible solutions are to be sorted using an infeasibility index.
-
GetUseInfeasibilityIndex
public boolean GetUseInfeasibilityIndex()Returns true if infeasible solutions are sorted based on an infeasibility index. The infeasibility index treats solutions that are closer to feasibility as superior to those farther away.- Returns:
- true if infeasible solutions are sorted using an infeasibility index. Returns false if infeasible solutions are sorted by their objective value.
-
SetUseMinimizeError
public void SetUseMinimizeError(boolean use) If this feature is turned on, tolerances are set to 0 for constraint and variable checking -
UseEnglishOnly
public void UseEnglishOnly(boolean onOff) Used to force string parsing to treat all strings as english format regardless of the current culture.- Parameters:
onOff
- true to turn on English only parsing
-
IsStopped
public boolean IsStopped()Returns the current state of the optimization. This will be false while an optimization is in progress. This will be true afterStopOptimization()
is called or when OptQuest terminates If stopped, a termination reason can be queried viaGetTerminationReason()
orGetTerminationReasonString()
.- Returns:
- - true if stopped, false otherwise
-
GetApproxSolutionSize
public int GetApproxSolutionSize()Returns the approximate size (in bytes) of a solution (COptQuestSolution).- Returns:
- approximate size
-
GetEstimatedIterations
Returns a lower and upper estimate on the number of iterations to run. Before calling this function, the optimization must be set up with all variables and objectives. This returns a list, the first element is the lower bound estimate and the second element is the upper bound estimate. These are estimates based on the number of variables and number of objectives in the optimization- Returns:
- List of lower and upper bound estimates for the number of iteration to run.
- Throws:
COptQuestException
- if problem not sufficiently defined
-
GetEstimatedParallelEvaluators
Returns an estimate on the maximum number of parallel evaluators that can be used with this problem. If resources are available, this problem should be efficiently solved with up to this many parallel evaluators.- Returns:
- an estimate for the number of parallel to use.
- Throws:
COptQuestException
- if problem not sufficiently defined
-
StopSolutionGeneration
public void StopSolutionGeneration()When this method is called, OptQuest will not generate any new solutions. The optimization will stop when all solutions that are out for evaluation have been returned by calling EvaluateComplete(COptQuestSolution) fromEvaluate(COptQuestSolution)
-
SetUseKrigSolutionGenerator
public void SetUseKrigSolutionGenerator(boolean onOff) If enabled, the Krig solution generator periodically creates a metamodel of the response surface and uses it to accelerate the optimization search. This feature is currently in Beta test and is turned off by default, but can be turned on using this method to see if it improves performance on your problems. The Krig solution generator takes longer to run than other OptQuest generators, so it only executes if the average solution evaluation time is over 2000 ms. This generator also runs asynchronously, so when used the solution search path may change each time an optimization is run. If you have turned on repeatable evaluationsRunRepeatableEvaluations(boolean)
the Krig solution generator will be turned off automatically. -
SetReplicationBatchSize
Some simulations can run multiple replication in a single simulation run and allow the replication data to be retrieved by replication.When running with confidence settings and a batchSize setting, all replication data will be used to calculate the confidence width. Replication processing will stop when the maximum number of replications has been reached or when confidence has been met and OptQuest has collected all data in the batch. For example, if the batch size is 5, the minimum number of replications is 5, and the maximum number of replications is 15, if confidence is met at the 13th replication, OptQuest will request data for replications 14 and 15 and then stop replications.- Parameters:
batchSize
- - the number of replications the simulation will run as a batch.- Throws:
COptQuestException
- if batchSize provided is less than 1
-