|
5 | 5 | or
|
6 | 6 | minimise(f, X, tol=1e-3) in this case the default value of "structure" is "HeapedVector"
|
7 | 7 |
|
8 |
| -Find the global minimum of the function `f` over the `Interval` or `IntervalBox` `X` using the Moore-Skelboe algorithm. By specifing the way in which vector element are kept arranged which is in heaped array or in sorted array. If you not specify any particular strategy to keep vector elements arranged then by default heaped array is used. |
| 8 | +Find the global minimum of the function `f` over the `Interval` or `IntervalBox` `X` |
| 9 | +using the Moore-Skelboe algorithm. The way in which vector elements are |
| 10 | +kept arranged can be either a heaped array or a sorted array. |
| 11 | +If you not specify any particular strategy to keep vector elements arranged then |
| 12 | +by default heaped array is used. |
9 | 13 |
|
10 | 14 | For higher-dimensional functions ``f:\\mathbb{R}^n \\to \\mathbb{R}``, `f` must take a single vector argument.
|
11 | 15 |
|
12 | 16 | Returns an interval containing the global minimum, and a list of boxes that contain the minimisers.
|
13 | 17 | """
|
14 |
| - |
15 |
| - |
16 |
| -function minimise(f, X::T ; structure = HeapedVector, tol=1e-3 ) where {T} |
| 18 | +function minimise(f, X::T; structure = HeapedVector, tol=1e-3) where {T} |
17 | 19 |
|
18 | 20 | # list of boxes with corresponding lower bound, arranged according to selected structure :
|
19 | 21 | working = structure([(X, ∞)], x->x[2])
|
@@ -56,8 +58,18 @@ function minimise(f, X::T ; structure = HeapedVector, tol=1e-3 ) where {T}
|
56 | 58 | return Interval(lower_bound, global_min), minimizers
|
57 | 59 | end
|
58 | 60 |
|
| 61 | +""" |
| 62 | + maximise(f, X, structure = SortedVector, tol=1e-3) |
| 63 | + or |
| 64 | + maximise(f, X, structure = HeapedVector, tol=1e-3) |
| 65 | + or |
| 66 | + maximise(f, X, tol=1e-3) in this case the default value of "structure" is "HeapedVector" |
59 | 67 |
|
60 |
| -function maximise(f, X::T; structure = HeapedVector, tol=1e-3 ) where {T} |
| 68 | +Find the global maximum of the function `f` over the `Interval` or `IntervalBox` `X` |
| 69 | +using the Moore-Skelboe algorithm. See [`minimise`](@ref) for a description |
| 70 | +of the available options. |
| 71 | +""" |
| 72 | +function maximise(f, X::T; structure = HeapedVector, tol=1e-3) where {T} |
61 | 73 | bound, minimizers = minimise(x -> -f(x), X, structure, tol)
|
62 | 74 | return -bound, minimizers
|
63 | 75 | end
|
0 commit comments