Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
julia 0.6
NLSolversBase 3.0
Parameters
NaNMath
2 changes: 1 addition & 1 deletion src/LineSearches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ isdefined(Base, :__precompile__) && __precompile__()

module LineSearches

using Parameters
using Parameters, NaNMath

import NLSolversBase
import Base.clear!
Expand Down
7 changes: 4 additions & 3 deletions src/backtracking.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function _backtracking!(df,

# Shrink proposed step-size:
if order == 2 || iteration == 1
# backtracking via interpolation:
# backtracking via quadratic interpolation:
# This interpolates the available data
# f(0), f'(0), f(α)
# with a quadractic which is then minimised; this comes with a
Expand All @@ -82,6 +82,7 @@ function _backtracking!(df,
# of the function guarantees at least a backtracking factor rho.
alphatmp = - (gxp * alpha^2) / ( 2.0 * (f_x_scratch - f_x - gxp*alpha) )
else
# Backtracking via cubic interpolation
alpha0 = lsr.alpha[end-1]
alpha1 = lsr.alpha[end]
phi0 = lsr.value[end-1]
Expand All @@ -98,8 +99,8 @@ function _backtracking!(df,
alphatmp = (-b + sqrt(discr)) / (3.0*a)
end
end
alphatmp = min(alphatmp, alpha*rhohi) # avoid too small reductions
alphatmp = max(alphatmp, alpha*rholo) # avoid too big reductions
alphatmp = NaNMath.min(alphatmp, alpha*rhohi) # avoid too small reductions
alphatmp = NaNMath.max(alphatmp, alpha*rholo) # avoid too big reductions

# enforce a maximum step alpha * s (application specific, default is Inf)
alpha = min(alphatmp, maxstep / vecnorm(s, Inf))
Expand Down