@@ -19,7 +19,7 @@ for solving `NonlinearLeastSquaresProblem`.
1919
2020 This algorithm is only available if `LeastSquaresOptim.jl` is installed.
2121"""
22- struct LeastSquaresOptimJL{alg, linsolve} <: AbstractNonlinearAlgorithm
22+ struct LeastSquaresOptimJL{alg, linsolve} <: AbstractNonlinearSolveAlgorithm
2323 autodiff:: Symbol
2424end
2525
@@ -58,7 +58,7 @@ for solving `NonlinearLeastSquaresProblem`.
5858
5959 This algorithm is only available if `FastLevenbergMarquardt.jl` is installed.
6060"""
61- @concrete struct FastLevenbergMarquardtJL{linsolve} <: AbstractNonlinearAlgorithm
61+ @concrete struct FastLevenbergMarquardtJL{linsolve} <: AbstractNonlinearSolveAlgorithm
6262 autodiff
6363 factor
6464 factoraccept
@@ -128,7 +128,7 @@ then the following methods are allowed:
128128The default choice of `:auto` selects `:hybr` for NonlinearProblem and `:lm` for
129129NonlinearLeastSquaresProblem.
130130"""
131- struct CMINPACK <: AbstractNonlinearAlgorithm
131+ struct CMINPACK <: AbstractNonlinearSolveAlgorithm
132132 show_trace:: Bool
133133 tracing:: Bool
134134 method:: Symbol
@@ -181,7 +181,7 @@ Choices for methods in `NLsolveJL`:
181181 these arguments, consult the
182182 [NLsolve.jl documentation](https://github.com/JuliaNLSolvers/NLsolve.jl).
183183"""
184- @concrete struct NLsolveJL <: AbstractNonlinearAlgorithm
184+ @concrete struct NLsolveJL <: AbstractNonlinearSolveAlgorithm
185185 method:: Symbol
186186 autodiff:: Symbol
187187 store_trace:: Bool
@@ -232,7 +232,7 @@ Fixed Point Problems. We allow using this algorithm to solve root finding proble
232232 - N. Lepage-Saucier, Alternating cyclic extrapolation methods for optimization algorithms,
233233 arXiv:2104.04974 (2021). https://arxiv.org/abs/2104.04974.
234234"""
235- @concrete struct SpeedMappingJL <: AbstractNonlinearAlgorithm
235+ @concrete struct SpeedMappingJL <: AbstractNonlinearSolveAlgorithm
236236 σ_min
237237 stabilize:: Bool
238238 check_obj:: Bool
@@ -248,3 +248,77 @@ function SpeedMappingJL(; σ_min = 0.0, stabilize::Bool = false, check_obj::Bool
248248
249249 return SpeedMappingJL (σ_min, stabilize, check_obj, orders, time_limit)
250250end
251+
252+ """
253+ FixedPointAccelerationJL(; algorithm = :Anderson, m = missing,
254+ condition_number_threshold = missing, extrapolation_period = missing,
255+ replace_invalids = :NoAction)
256+
257+ Wrapper over [FixedPointAcceleration.jl](https://s-baumann.github.io/FixedPointAcceleration.jl/)
258+ for solving Fixed Point Problems. We allow using this algorithm to solve root finding
259+ problems as well.
260+
261+ ## Arguments:
262+
263+ - `algorithm`: The algorithm to use. Can be `:Anderson`, `:MPE`, `:RRE`, `:VEA`, `:SEA`,
264+ `:Simple`, `:Aitken` or `:Newton`.
265+ - `m`: The number of previous iterates to use for the extrapolation. Only valid for
266+ `:Anderson`.
267+ - `condition_number_threshold`: The condition number threshold for Least Squares Problem.
268+ Only valid for `:Anderson`.
269+ - `extrapolation_period`: The number of iterates between extrapolations. Only valid for
270+ `:MPE`, `:RRE`, `:VEA` and `:SEA`. Defaults to `7` for `:MPE` & `:RRE`, and `6` for
271+ `:SEA` and `:VEA`. For `:SEA` and `:VEA`, this must be a multiple of `2`.
272+ - `replace_invalids`: The method to use for replacing invalid iterates. Can be
273+ `:ReplaceInvalids`, `:ReplaceVector` or `:NoAction`.
274+ """
275+ @concrete struct FixedPointAccelerationJL <: AbstractNonlinearSolveAlgorithm
276+ algorithm:: Symbol
277+ extrapolation_period:: Int
278+ replace_invalids:: Symbol
279+ dampening
280+ m:: Int
281+ condition_number_threshold
282+ end
283+
284+ function FixedPointAccelerationJL (; algorithm = :Anderson , m = missing ,
285+ condition_number_threshold = missing , extrapolation_period = missing ,
286+ replace_invalids = :NoAction , dampening = 1.0 )
287+ if Base. get_extension (@__MODULE__ , :NonlinearSolveFixedPointAccelerationExt ) === nothing
288+ error (" FixedPointAccelerationJL requires FixedPointAcceleration.jl to be loaded" )
289+ end
290+
291+ @assert algorithm in (:Anderson , :MPE , :RRE , :VEA , :SEA , :Simple , :Aitken , :Newton )
292+ @assert replace_invalids in (:ReplaceInvalids , :ReplaceVector , :NoAction )
293+
294+ if algorithm != = :Anderson
295+ if condition_number_threshold != = missing
296+ error (" `condition_number_threshold` is only valid for Anderson acceleration" )
297+ end
298+ if m != = missing
299+ error (" `m` is only valid for Anderson acceleration" )
300+ end
301+ end
302+ condition_number_threshold === missing && (condition_number_threshold = 1e3 )
303+ m === missing && (m = 10 )
304+
305+ if algorithm != = :MPE && algorithm != = :RRE && algorithm != = :VEA && algorithm != = :SEA
306+ if extrapolation_period != = missing
307+ error (" `extrapolation_period` is only valid for MPE, RRE, VEA and SEA" )
308+ end
309+ end
310+ if extrapolation_period === missing
311+ if algorithm === :SEA || algorithm === :VEA
312+ extrapolation_period = 6
313+ else
314+ extrapolation_period = 7
315+ end
316+ else
317+ if (algorithm === :SEA || algorithm === :VEA ) && extrapolation_period % 2 != 0
318+ error (" `extrapolation_period` must be multiples of 2 for SEA and VEA" )
319+ end
320+ end
321+
322+ return FixedPointAccelerationJL (algorithm, extrapolation_period, replace_invalids,
323+ dampening, m, condition_number_threshold)
324+ end
0 commit comments