@@ -15,12 +15,15 @@ for alg in (:Static, :HagerZhang, :MoreThuente, :BackTracking, :StrongWolfe)
15
15
depmsg = " `$(alg) (args...; kwargs...)` is deprecated. Please use `LineSearchesJL(; \
16
16
method = $(alg) (args...; kwargs...))` instead."
17
17
@eval function $ (alg)(args... ; autodiff = nothing , initial_alpha = true , kwargs... )
18
- Base. depwarn ($ (depmsg), $ (alg))
18
+ Base. depwarn ($ (depmsg), $ (Meta . quot ( alg) ))
19
19
return LineSearch. LineSearchesJL (;
20
20
method = LineSearches.$ (alg)(args... ; kwargs... ), autodiff, initial_alpha)
21
21
end
22
22
end
23
23
24
+ Base. @deprecate LiFukushimaLineSearch (; nan_max_iter:: Int = 5 , kwargs... ) LineSearch. LiFukushimaLineSearch (;
25
+ nan_maxiters = nan_max_iter, kwargs... )
26
+
24
27
# """
25
28
# RobustNonMonotoneLineSearch(; gamma = 1 // 10000, sigma_0 = 1, M::Int = 10,
26
29
# tau_min = 1 // 10, tau_max = 1 // 2, n_exp::Int = 2, maxiters::Int = 100,
142
145
# cache.nsteps += 1
143
146
# return
144
147
# end
145
-
146
- # """
147
- # LiFukushimaLineSearch(; lambda_0 = 1, beta = 1 // 2, sigma_1 = 1 // 1000,
148
- # sigma_2 = 1 // 1000, eta = 1 // 10, nan_max_iter::Int = 5, maxiters::Int = 100)
149
-
150
- # A derivative-free line search and global convergence of Broyden-like method for nonlinear
151
- # equations [li2000derivative](@cite).
152
- # """
153
- # @kwdef @concrete struct LiFukushimaLineSearch <: AbstractNonlinearSolveLineSearchAlgorithm
154
- # lambda_0 = 1
155
- # beta = 1 // 2
156
- # sigma_1 = 1 // 1000
157
- # sigma_2 = 1 // 1000
158
- # eta = 1 // 10
159
- # rho = 9 // 10
160
- # nan_max_iter::Int = 5 # TODO (breaking): Change this to nan_maxiters for uniformity
161
- # maxiters::Int = 100
162
- # end
163
-
164
- # @concrete mutable struct LiFukushimaLineSearchCache <: AbstractNonlinearSolveLineSearchCache
165
- # ϕ
166
- # f
167
- # p
168
- # internalnorm
169
- # u_cache
170
- # fu_cache
171
- # λ₀
172
- # β
173
- # σ₁
174
- # σ₂
175
- # η
176
- # ρ
177
- # α
178
- # nan_maxiters::Int
179
- # maxiters::Int
180
- # stats::NLStats
181
- # end
182
-
183
- # function __internal_init(
184
- # prob::AbstractNonlinearProblem, alg::LiFukushimaLineSearch, f::F, fu, u, p,
185
- # args...; stats, internalnorm::IN = DEFAULT_NORM, kwargs...) where {F, IN}
186
- # @bb u_cache = similar(u)
187
- # @bb fu_cache = similar(fu)
188
- # T = promote_type(eltype(fu), eltype(u))
189
-
190
- # ϕ = @closure (f, p, u, du, α, u_cache, fu_cache) -> begin
191
- # @bb @. u_cache = u + α * du
192
- # fu_cache = evaluate_f!!(f, fu_cache, u_cache, p)
193
- # stats.nf += 1
194
- # return internalnorm(fu_cache)
195
- # end
196
-
197
- # return LiFukushimaLineSearchCache(
198
- # ϕ, f, p, internalnorm, u_cache, fu_cache, T(alg.lambda_0),
199
- # T(alg.beta), T(alg.sigma_1), T(alg.sigma_2), T(alg.eta),
200
- # T(alg.rho), T(true), alg.nan_max_iter, alg.maxiters, stats)
201
- # end
202
-
203
- # function __internal_solve!(cache::LiFukushimaLineSearchCache, u, du; kwargs...)
204
- # T = promote_type(eltype(u), eltype(du))
205
- # ϕ = @closure α -> cache.ϕ(cache.f, cache.p, u, du, α, cache.u_cache, cache.fu_cache)
206
-
207
- # fx_norm = ϕ(T(0))
208
-
209
- # # Non-Blocking exit if the norm is NaN or Inf
210
- # !isfinite(fx_norm) && return (true, cache.α)
211
-
212
- # # Early Terminate based on Eq. 2.7
213
- # du_norm = cache.internalnorm(du)
214
- # fxλ_norm = ϕ(cache.α)
215
- # fxλ_norm ≤ cache.ρ * fx_norm - cache.σ₂ * du_norm^2 && return (false, cache.α)
216
-
217
- # λ₂, λ₁ = cache.λ₀, cache.λ₀
218
- # fxλp_norm = ϕ(λ₂)
219
-
220
- # if !isfinite(fxλp_norm)
221
- # nan_converged = false
222
- # for _ in 1:(cache.nan_maxiters)
223
- # λ₁, λ₂ = λ₂, cache.β * λ₂
224
- # fxλp_norm = ϕ(λ₂)
225
- # nan_converged = isfinite(fxλp_norm)
226
- # nan_converged && break
227
- # end
228
- # nan_converged || return (true, cache.α)
229
- # end
230
-
231
- # for i in 1:(cache.maxiters)
232
- # fxλp_norm = ϕ(λ₂)
233
- # converged = fxλp_norm ≤ (1 + cache.η) * fx_norm - cache.σ₁ * λ₂^2 * du_norm^2
234
- # converged && return (false, λ₂)
235
- # λ₁, λ₂ = λ₂, cache.β * λ₂
236
- # end
237
-
238
- # return true, cache.α
239
- # end
0 commit comments