Skip to content

Commit f28247f

Browse files
mforetsdpsanders
authored andcommitted
min and max docstrings (#38)
1 parent 09b52a4 commit f28247f

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/optimise.jl

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55
or
66
minimise(f, X, tol=1e-3) in this case the default value of "structure" is "HeapedVector"
77
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.
913
1014
For higher-dimensional functions ``f:\\mathbb{R}^n \\to \\mathbb{R}``, `f` must take a single vector argument.
1115
1216
Returns an interval containing the global minimum, and a list of boxes that contain the minimisers.
1317
"""
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}
1719

1820
# list of boxes with corresponding lower bound, arranged according to selected structure :
1921
working = structure([(X, ∞)], x->x[2])
@@ -56,8 +58,18 @@ function minimise(f, X::T ; structure = HeapedVector, tol=1e-3 ) where {T}
5658
return Interval(lower_bound, global_min), minimizers
5759
end
5860

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"
5967
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}
6173
bound, minimizers = minimise(x -> -f(x), X, structure, tol)
6274
return -bound, minimizers
6375
end

0 commit comments

Comments
 (0)