|
1 | | -# Common Solver Options |
| 1 | +# Common Solver Options (Solve Keyword Arguments) |
2 | 2 |
|
3 | | -In GalacticOptim.jl, solving an `OptimizationProblem` is done via: |
4 | | - |
5 | | -```julia |
6 | | -solve(prob,alg;kwargs...) |
7 | | -``` |
8 | | - |
9 | | -The arguments to `solve` are common across all of the optimizers. |
10 | | -These common arguments are: |
11 | | - |
12 | | -- `maxiters` (the maximum number of iterations) |
13 | | -- `maxtime` (the maximum of time the optimization runs for) |
14 | | -- `abstol` (absolute tolerance in changes of the objective value) |
15 | | -- `reltol` (relative tolerance in changes of the objective value) |
16 | | -- `callback` (a callback function) |
17 | | - |
18 | | -If the chosen global optimzer employs a local optimization method a similiar set of common local optimizer arguments exists. |
19 | | -The common local optimizer arguments are: |
20 | | - |
21 | | -- `local_method` (optimiser used for local optimization in global method) |
22 | | -- `local_maxiters` (the maximum number of iterations) |
23 | | -- `local_maxtime` (the maximum of time the optimization runs for) |
24 | | -- `local_abstol` (absolute tolerance in changes of the objective value) |
25 | | -- `local_reltol` (relative tolerance in changes of the objective value) |
26 | | -- `local_options` (NamedTuple of keyword arguments for local optimizer) |
27 | | - |
28 | | -Some optimizer algorithms have special keyword arguments documented in the |
29 | | -solver portion of the documentation and their respective documentation. |
30 | | -These arguments can be passed as `kwargs...` to `solve`. Similiarly, the special |
31 | | -kewyword arguments for the `local_method` of a global optimizer are passed as a |
32 | | -`NamedTuple` to `local_options`. |
33 | | - |
34 | | -Over time we hope to cover more of these keyword arguments under the common interface. |
35 | | - |
36 | | -If a common argument is not implemented for a optimizer a warning will be shown. |
37 | | - |
38 | | - |
39 | | -## Callback Functions |
40 | | - |
41 | | -The callback function `callback` is a function which is called after every optimizer |
42 | | -step. Its signature is: |
43 | | - |
44 | | -```julia |
45 | | -callback = (x,other_args) -> false |
| 3 | +```@docs |
| 4 | +solve(::OptimizationProblem,::Any) |
46 | 5 | ``` |
47 | | - |
48 | | -where `other_args` is are the extra return arguments of the optimization `f`. |
49 | | -For example, if `f(x,p) = 5x`, then `callback = (x) -> ...` is used. If `f(x,p) = 5x,55x`, |
50 | | -then ` = (x,extra) -> ...` is used, where `extra = 55x`. This allows for saving |
51 | | -values from the optimization and using them for plotting and display without |
52 | | -recalculating. The callback should return a Boolean value, and the default |
53 | | -should be `false`, such that the optimization gets stopped if it returns `true`. |
0 commit comments