|
|
(13 intermediate revisions by 3 users not shown) |
Line 1: |
Line 1: |
| [[Category: Analytica Optimizer Guide]] | | [[Category: Analytica Optimizer Guide]] |
− | <breadcrumbs> Analytica Optimizer Guide > {{PAGENAME}}</breadcrumbs> | + | <breadcrumbs> Analytica Optimizer Guide > {{PAGENAME}}</breadcrumbs> <br /> |
| | | |
− | This chapter shows you how to: | + | This chapter shows you how to specify Optimizer engine settings in [[DefineOptimization]](), determine the available settings, defaults and possible range for each optimization engine, determine size capacities for installed engines, control termination criteria during optimization, select search algorithms, and specify numeric precision. |
− | * Specify Optimizer engine settings in DefineOptimization()
| |
− | * Determine what setting are available for each engine, defaults, and possible range
| |
− | * Determine size capacities for installed engines
| |
− | * Control termination criteria during optimization
| |
− | * Select search algorithms
| |
− | * Specify numeric precision
| |
| | | |
− | == Controlling the search == | + | == Sections == |
| + | * [[Controlling the Search]] |
| + | * [[Selecting the Optimization Engine]] |
| + | * [[Examining Engine Capabilities]] |
| + | * [[Specifying Settings]] |
| + | * [[Examining Available Settings]] |
| + | * [[Termination Controls]] |
| + | * [[Algorithm Selection]] |
| + | * [[Numeric Tolerance and Precision]] |
| + | * [[Unused Settings]] |
| | | |
− | The optimization engine exposes several settings that you can change to influence how the search for the optimum proceeds and when it terminates. The specific collection of available settings is a function of which engine is used to solve the optimization, so that if you install and use an add-on engine, other than the engine that comes standard with Analytica Optimizer, the possible settings might be different. The [http://wiki.analytica.com/index.php?title=OptInfo OptInfo]() function can be used to view current values for a problem.
| + | ==See Also== |
| + | * [[DefineOptimization#Engine_Settings|Optimization engine settings]] |
| | | |
− | To see this, define a variable as:
| |
− | <nowiki> OptInfo(Opt, "Settings")</nowiki>
| |
− | Where Opt identifies the variable containing the [http://wiki.analytica.com/index.php?title=DefineOptimization DefineOptimization]() function.
| |
| | | |
− | Settings can be changed for a particular problem by specifying values for the '''SettingName''' and '''SettingValue''' parameters to [http://wiki.analytica.com/index.php?title=DefineOptimization DefineOptimization](). The first subsection below describes how you specify and view settings, while the subsequent sub-sections detail particular settings used by engines the come standard with Analytica Optimizer.
| |
| | | |
− | == Selecting the optimization engine ==
| + | <footer>Optimizer Functions / {{PAGENAME}} / Controlling the Search</footer> |
− | Four optimization engines come standard with Analytica Optimizer:
| |
− | * '''LP/Quadratic''' - uses a dual simplex method combined with branch-and bound for mixed-integer constraints, with a variety of integer cut-set procedures. This is generally the engine of choice for LPs and mixed-integer LPs. For hard mixed-integer LPs, however, the Evolutionary engine uses a very different approach and might be worth trying.
| |
− | | |
− | * '''SOCP Barrier''' - uses interior point methods designed specifically for quadratically constrained convex problems. The GRG Nonlinear engine is often a good alternative for thi type of problem, especially if the constraints end up being non-convex.
| |
− | | |
− | * '''GRG Nonlinea'''r - The Generalized Reduced Gradient solver is suitable for smooth non-linear problems. If gradients and Jacobians can be analytically determined, the speed of this method will be dramatically faster.
| |
− | | |
− | * '''Evolutionary''' - Best suited for non-smooth problems the evolutionary engine creates a population of potential solutions and keeps the best ones.. By default, the Evolutionary engine does not use gradient information. However, if the '''LocalSearch''' setting is on, then it optimizes sample points before adding them to the population using various techniques including gradient-based search.
| |
− | | |
− | The following matrix shows engine compatibility for each problem type:
| |
− | {| class="wikitable" cellpadding="2"
| |
− | |-
| |
− | ! width="100pt" |
| |
− | ! width="350pt" |
| |
− | ! width="150pt" | LP/Quadratic
| |
− | ! width="150pt" | SOCP Barrier
| |
− | ! width="150pt" | GRG Nonlinear
| |
− | ! width="150pt" | Evolutionary
| |
− | |-
| |
− | |LP
| |
− | |Linear Program
| |
− | |*
| |
− | |*
| |
− | |*
| |
− | |*
| |
− | |-
| |
− | |QP
| |
− | |Quadratic Program (linearly constrained)
| |
− | |*
| |
− | |*
| |
− | |*
| |
− | |*
| |
− | |-
| |
− | |QCP
| |
− | |Quadratically Constrained Program
| |
− | |
| |
− | |*<ref>You may not know whether your QCP is convex when you formulate it, and DefineOptimization’s quadratic analysis does not determine convexity. Testing for convexity can be more computationally intensive than solving the problem, so if you think SOCP Barrier is the preferred engine, you can attempt to solve it using SOCP Barrier. During the solution, it may succeed, or it may detect the non-convexity and terminate without a feasible solution. Always check '''OptStatusText'''().</ref>
| |
− | |*
| |
− | |*
| |
− | |-
| |
− | |CQCP
| |
− | |Convex QCP
| |
− | |
| |
− | |*
| |
− | |*
| |
− | |*
| |
− | |-
| |
− | |NCQCP
| |
− | |Non-Convex QCP
| |
− | |
| |
− | |
| |
− | |*
| |
− | |*
| |
− | |-
| |
− | |NLP
| |
− | |Non-Linear Program (smooth)
| |
− | |
| |
− | |
| |
− | |*
| |
− | |*
| |
− | |-
| |
− | |NSP
| |
− | |Non-Smooth Program
| |
− | |
| |
− | |
| |
− | |*
| |
− | |*
| |
− | |}
| |
− | | |
− | If you have purchased other add-on engines, other options might also be available to you. You can obtain a full list of installed engines and the problem types supported by each by evaluating the following Analytica expression.
| |
− | <nowiki> OptEngineInfo("All","ProblemTypes")</nowiki>
| |
− | To explicitly select the engine to be used, include the <code>Engine</code> parameter to [http://wiki.analytica.com/index.php?title=DefineOptimization DefineOptimization]().
| |
− | <nowiki> Engine : Optional Text</nowiki>
| |
− | For example:
| |
− | <nowiki> DefineOptimization( ..., Engine: "Evolutionary" )</nowiki>
| |
− | If you do not specify the engine, Analytica selects an appropriate engine based on the properties of the problem that you specified. However, if the engine does not perform satisfactorily on that problem, you might obtain better results with a different engine.
| |
− | | |
− | To determine what engine is actually used on a problem, evaluate this Analytica expression.
| |
− | <nowiki> OptInfo(Opt, "Engine")</nowiki>
| |
− | Where <code>Opt</code> is the object returned by [http://wiki.analytica.com/index.php?title=DefineOptimization DefineOptimization]().
| |
− | | |
− | == Examining engine capabilities ==
| |
− | | |
− | Information about the limits on the maximum number of variables or constraints allowed by each installed engine can be accessed using this expression:
| |
− | OptEngineInfo( "All",["MaxVars","MaxIntVars","MaxConstraints"])
| |
− | This returns a table indexed by <code>.ProblemType</code>, <code>.Engine</code> and the limit type, e.g.:
| |
− | | |
− | [[File:7-1.png|350px]]
| |
− | | |
− | The problem types displayed include are:
| |
− | | |
− | {| class="wikitable" cellpadding="2"
| |
− | |-
| |
− | ! width="100pt" | Element
| |
− | ! width="350pt" | Description
| |
− | |-
| |
− | |LP
| |
− | |linear program
| |
− | |-
| |
− | |QP
| |
− | |quadratic objective, linear constraints
| |
− | |-
| |
− | |QCP
| |
− | |quadratic with convex quadratic constraints
| |
− | (solvers designed specifically for quadratics treat this as
| |
− | if the problem is convex)
| |
− | |-
| |
− | |NLP
| |
− | |smooth nonlinear
| |
− | |-
| |
− | |NSP
| |
− | |non-smooth nonlinear
| |
− | |}
| |
− | | |
− | ==Specifying settings==
| |
− | | |
− | If you want to change the value for a single control setting, you can specify values for two optional parameters, '''settingName''' and '''settingValue''', to [http://wiki.analytica.com/index.php?title=DefineOptimization DefineOptimization](), providing the text name of the setting to '''settingName''', and the numeric value to '''settingValue'''.
| |
− | For example, if you want to set the Scaling parameter to 1, you would modify your call to [http://wiki.analytica.com/index.php?title=DefineOptimization DefineOptimization]() as follows.
| |
− | | |
− | <nowiki> DefineOptimization( .., settingName: "Scaling", settingValue: 1 )</nowiki>
| |
− | | |
− | To alter more than one control setting, you need to supply arrays to these parameters. The arrays passed to '''settingName''' and '''settingValue''' should have a single common index. If the index of the array passed to '''settingValue''' is a list of labels, where the index labels contain the name of each control setting, then you only need to include the '''settingValue''' parameter.
| |
− | | |
− | It is often convenient to specify control settings in a self-indexed edit table. The following steps illustrate this:
| |
− | # Drag a variable node to your diagram, title it '''Opt Settings'''.
| |
− | # In the definition pane, set the definition type to '''Table'''.
| |
− | # In the '''Index Chooser''' box, select '''Opt Settings (Self)''' as the table index.
| |
− | # Click the row heading cell, and change <code>Item</code> 1 to <code>Scaling</code>.
| |
− | # With the row header still selected, press down-arrow to add a row.
| |
− | # Change the second row header cell to <code>MaxTime</code>.
| |
− | # Enter <code>1</code> into the first table body cell.
| |
− | # Enter <code>30</code> into the second body table cell.
| |
− | | |
− | ::[[File:7-2.png|300px]]
| |
− | | |
− | <ol start="9"><li> In your call to [http://wiki.analytica.com/index.php?title=DefineOptimization DefineOptimization](), insert a settng parameter as follows.</li></ol>
| |
− | | |
− | <nowiki> DefineOptimization( ..., settingValue: Opt_Settings )</nowiki>
| |
− | | |
− | The Optimizer scales parameters and terminates after 30 seconds if the optimum has not been found. A self-indexed table set up in this fashion makes it easy to adjust multiple control settings if the need arises.
| |
− | | |
− | == Examining available settings ==
| |
− | | |
− | The following function returns the set of control settings used for a problem.
| |
− | | |
− | <nowiki> OptInfo(opt, "Setting")</nowiki>
| |
− | | |
− | Replace opt with the name of the variable holding the result from [http://wiki.analytica.com/index.php?title=DefineOptimization DefineOptimization]().
| |
− | | |
− | You can also access the range of allowed values for each setting, as well as the default value, using [http://wiki.analytica.com/index.php?title=OptInfo OptInfo]() or [http://wiki.analytica.com/index.php?title=OptEngineInfo OptEngineInfo](). [http://wiki.analytica.com/index.php?title=OptInfo OptInfo]() is used when you have a problem instance, [http://wiki.analytica.com/index.php?title=OptEngineInfo OptEngineInfo]() is defined when you know the name of the engine but don’t have a problem instance.
| |
− | | |
− | The range (min/max) of possible values for each setting, and the default value, can be obtained using these — first case using an existing problem instance, second case using the engine name:
| |
− | | |
− | <nowiki> OptInfo( opt,["MinSetting","MaxSetting","Defaults"])</nowiki>
| |
− | <nowiki> OptEngineInfo("LP/Quadratic",["MinSetting","MaxSetting","Defaults"])</nowiki>
| |
− | | |
− | == Termination controls ==
| |
− | | |
− | === Iterations ===
| |
− | Specifies the maximum number of iterations (pivots) by the simplex algorithm during the optimization. If this is exceeded, [http://wiki.analytica.com/index.php?title=OptStatusNum OptStatusNum]() returns 3 (Iterates limit reached. Indicates an early exit of the algorithm.). Maximum number of generations in Evolutionary solver. Maximum number of gradient descent steps by ''GRG Nonlinear''. If the problem has integer or grouped integer domains, it is preferred to use the MaxSubproblems setting instead of Iterations.
| |
− | | |
− | '''Default''': no limit
| |
− | | |
− | === MaxSubproblems ===
| |
− | Applies only to problems with integer or grouped integer domains. Places a limit on the number of sub-problems that the Branch & Bound algorithm explores before pausing and prompting the user to stop or continue.
| |
− | | |
− | '''Default''': no limit
| |
− | | |
− | === MaxIntegerSols ===
| |
− | Applies only to problems with integer or grouped integer domains. Places a limit on the number of integer solutions the Branch & Bound algorithm explores before pausing and prompting the user to stop or continue.
| |
− | | |
− | '''Default''': no limit
| |
− | | |
− | === MaxTime ===
| |
− | Maximum number of seconds the Optimizer spends on the problem. If exceeded, [http://wiki.analytica.com/index.php?title=OptStatusNum OptStatusNum]() is 10 (Time out status. Returned when the maximum allowed time has been exceeded. Indicates an early exit of the algorithm.).
| |
− | | |
− | '''Default''': no limit
| |
− | | |
− | === MaxTimeNoImp ===
| |
− | The maximum number of seconds that the Optimizer continues without finding any improvement in the best solution.
| |
− | | |
− | '''Default''': 30 seconds
| |
− | | |
− | '''Allowed range''': positive
| |
− | | |
− | === IntTolerance ===
| |
− | In a MIP optimization, if the branch-and-bound algorithm can determine that the best solution found so far is within this relative tolerance of the true optimal, it terminates the search and return the best solution found so far. The bound is relative, meaning a value of 10% guarantees a solution within 10% of the optimal. Often, the branch-and-bound algorithm quickly locates a nearly optimal solution, but then spends a large amount of
| |
− | refining its best solution to the true optimum. Specifying a non-zero gap tolerance can eliminate this additional search, thus in some cases drastically reducing computation time. The gap is computed as the absolute value of the difference between the best solution so far, and the best bound on the optimum, divided by the best bound on the optimum. With zero gap (default), the search continues until the entire search space is eliminated so that the global optimum is reached.
| |
− | | |
− | '''Default''': 0%
| |
− | | |
− | '''Allowed range''': 0 to 1
| |
− | | |
− | === Convergence ===
| |
− | The evolutionary solver stops with status “Solver has converged to the current solution” when nearly all members in the current population have very similar fitness values. This stopping criteria is satisfied when 99% of the population members all have fitness values within Convergence tolerance of each other.
| |
− | | |
− | The fitness value is a combination of the objective function value and a penalty for constraints still violated. If you think the evolutionary solver is terminating too quickly, you can make this tolerance smaller, but you might also want to increase '''MutationRate''' or '''PopulationSize''' in order to increase the diversity of trial solutions.
| |
− | | |
− | '''Default''': 10-4
| |
− | | |
− | '''Allowed range''': 0 to 1
| |
− | | |
− | === Tolerance ===
| |
− | If the relative (i.e., percentage) improvement observed during the previous MaxTimeNoImp seconds does not exceed this value, then evolutionary solver terminates. See MaxTimeNoImp.
| |
− | | |
− | '''Default''': 0
| |
− | | |
− | '''Allowed range''': 0 to 1
| |
− | | |
− | === MaxTimeNoImp ===
| |
− | Controls the amount of time (in seconds) that the evolutionary solver is willing to spend without making any significant progress. If the relative improvement during this time has not exceeded the setting specified by Tolerance, it terminates with status (Solver cannot improve the current solution) or (Solver could not find a feasible solution).
| |
− | | |
− | '''Default''': 10-5
| |
− | | |
− | '''Allowed range''': 10-9 to 10-4
| |
− | | |
− | === MaxFeasibleSolutions ===
| |
− | The maximum number of feasible solutions found by the Evolutionary algorithm before terminating.
| |
− | | |
− | '''Default''': no limit
| |
− | | |
− | '''Allowed range''': positive
| |
− | <footer>Optimizer Function Reference / {{PAGENAME}} / Next</footer> | |
Enable comment auto-refresher