SciML / NonlinearSolve.jl

High-performance and differentiation-enabled nonlinear solvers (Newton methods), bracketed rootfinding (bisection, Falsi), with sparsity and Newton-Krylov support.
https://docs.sciml.ai/NonlinearSolve/stable/
MIT License
229 stars 41 forks source link

:fixedpoint doesn't exist #192

Closed DanielVandH closed 11 months ago

DanielVandH commented 1 year ago

As claimed in the docs, a valid method for NLSolveJL is :fixedpoint (https://docs.sciml.ai/NonlinearSolve/stable/api/nlsolve/). This algorithm doesn't seem to exist:

using NonlinearSolve, SciMLNLSolve
f(u, p) = u .* u .- p 
u0 = [1.0, 1.0]
p = 2.0 
probN = NonlinearProblem(f, u0, p)
solver = solve(probN, NLSolveJL(method = :fixedpoint))
julia> solver = solve(probN, NLSolveJL(method = :fixedpoint))
ERROR: ArgumentError: Unknown method fixedpoint
Stacktrace:
  [1] nlsolve(df::NLSolversBase.OnceDifferentiable{Vector{Float64}, Matrix{Float64}, Vector{Float64}}, initial_x::Vector{Float64}; method::Symbol, xtol::Float64, ftol::Float64, iterations::Int64, store_trace::Bool, show_trace::Bool, extended_trace::Bool, linesearch::LineSearches.Static, linsolve::SciMLNLSolve.var"#3#5", factor::Float64, autoscale::Bool, m::Int64, beta::Float64, aa_start::Int64, droptol::Float64)
    @ NLsolve C:\Users\User\.julia\packages\NLsolve\gJL1I\src\nlsolve\nlsolve.jl:36
  [2] __solve(::NonlinearProblem{Vector{Float64}, false, Float64, NonlinearFunction{false, SciMLBase.FullSpecialize, typeof(f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardNonlinearProblem}, ::NLSolveJL{LineSearches.Static, SciMLNLSolve.var"#3#5"}; abstol::Float64, maxiters::Int64, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ SciMLNLSolve C:\Users\User\.julia\packages\SciMLNLSolve\cJBSI\src\solve.jl:91
  [3] __solve
    @ C:\Users\User\.julia\packages\SciMLNLSolve\cJBSI\src\solve.jl:1 [inlined]
  [4] #solve_call#22
    @ C:\Users\User\.julia\packages\DiffEqBase\G15op\src\solve.jl:511 [inlined]
  [5] solve_call
    @ C:\Users\User\.julia\packages\DiffEqBase\G15op\src\solve.jl:481 [inlined]
  [6] #solve_up#30
    @ C:\Users\User\.julia\packages\DiffEqBase\G15op\src\solve.jl:945 [inlined]
  [8] #solve#29
    @ C:\Users\User\.julia\packages\DiffEqBase\G15op\src\solve.jl:939 [inlined]
  [9] solve(prob::NonlinearProblem{Vector{Float64}, false, Float64, NonlinearFunction{false, SciMLBase.FullSpecialize, typeof(f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardNonlinearProblem}, args::NLSolveJL{LineSearches.Static, SciMLNLSolve.var"#3#5"})
    @ DiffEqBase C:\Users\User\.julia\packages\DiffEqBase\G15op\src\solve.jl:929
 [10] top-level scope
    @ Untitled-1:6

Based on the nlsolve.jl file at the start of the stacktrace, I'm guessing the available methods should be (:newton, :trust_region, :anderson, :broyden).

ChrisRackauckas commented 1 year ago

It must've just been removed for only having :anderson, since :anderson with no history is a fixed point method. We should update the docs.