Skip to content

Commit b5d8055

Browse files
authored
Add docstrings for StrongWolfe (#159)
1 parent 084b1fa commit b5d8055

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/strongwolfe.jl

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,35 @@ use `MoreThuente`, `HagerZhang` or `BackTracking`.
2020
ρ::T = 2.0
2121
end
2222

23+
"""
24+
(ls::StrongWolfe)(df, x::AbstractArray, p::AbstractArray, alpha0::Real, x_new, ϕ_0, dϕ_0) -> alpha, ϕalpha
25+
26+
Given a differentiable function `df` (in the sense of `NLSolversBase.OnceDifferentiable` or
27+
`NLSolversBase.TwiceDifferentiable`), a multidimensional starting point `x` and step `p`,
28+
and a guess `alpha0` for the step length, find an `alpha` satisfying the strong Wolfe conditions.
29+
30+
See the one-dimensional method for additional details.
31+
"""
2332
function (ls::StrongWolfe)(df, x::AbstractArray{T},
2433
p::AbstractArray{T}, α::Real, x_new::AbstractArray{T},
2534
ϕ_0, dϕ_0) where T
2635
ϕ, dϕ, ϕdϕ = make_ϕ_dϕ_ϕdϕ(df, x_new, x, p)
2736
ls(ϕ, dϕ, ϕdϕ, α, ϕ_0, dϕ_0)
2837
end
38+
39+
"""
40+
(ls::StrongWolfe)(ϕ, dϕ, ϕdϕ, alpha0, ϕ_0, dϕ_0) -> alpha, ϕalpha
41+
42+
Given `ϕ(alpha::Real)`, its derivative `dϕ`, a combined-evaluation function
43+
`ϕdϕ(alpha) -> (ϕ(alpha), dϕ(alpha))`, and an initial guess `alpha0`,
44+
identify a value of `alpha > 0` satisfying the strong Wolfe conditions.
45+
46+
`ϕ_0` and `dϕ_0` are the value and derivative, respectively, of `ϕ` at `alpha = 0.`
47+
48+
Both `alpha` and `ϕ(alpha)` are returned.
49+
"""
2950
function (ls::StrongWolfe)(ϕ, dϕ, ϕdϕ,
30-
alpha0::T, ϕ_0, dϕ_0) where T
51+
alpha0::T, ϕ_0, dϕ_0) where T<:Real
3152
@unpack c_1, c_2, ρ = ls
3253

3354
zeroT = convert(T, 0)

0 commit comments

Comments
 (0)