diff --git a/src/default.jl b/src/default.jl index 758e049f3..8ce34ec0d 100644 --- a/src/default.jl +++ b/src/default.jl @@ -252,12 +252,21 @@ end ## Defaults -function SciMLBase.__init(prob::NonlinearProblem{uType, iip}, alg::Nothing, args...; - kwargs...) where {uType, iip} - SciMLBase.__init(prob, FastShortcutNonlinearPolyalg(), args...; kwargs...) +function SciMLBase.__init(prob::NonlinearProblem, ::Nothing, args...; kwargs...) + return SciMLBase.__init(prob, FastShortcutNonlinearPolyalg(), args...; kwargs...) end -function SciMLBase.__solve(prob::NonlinearProblem{uType, iip}, alg::Nothing, args...; - kwargs...) where {uType, iip} - SciMLBase.__solve(prob, FastShortcutNonlinearPolyalg(), args...; kwargs...) +function SciMLBase.__solve(prob::NonlinearProblem, ::Nothing, args...; kwargs...) + return SciMLBase.__solve(prob, FastShortcutNonlinearPolyalg(), args...; kwargs...) +end + +# FIXME: We default to using LM currently. But once we have line searches for GN implemented +# we should default to a polyalgorithm. +function SciMLBase.__init(prob::NonlinearLeastSquaresProblem, ::Nothing, args...; kwargs...) + return SciMLBase.__init(prob, LevenbergMarquardt(), args...; kwargs...) +end + +function SciMLBase.__solve(prob::NonlinearLeastSquaresProblem, ::Nothing, args...; + kwargs...) + return SciMLBase.__solve(prob, LevenbergMarquardt(), args...; kwargs...) end diff --git a/test/nonlinear_least_squares.jl b/test/nonlinear_least_squares.jl index 07a310196..5b4ff265e 100644 --- a/test/nonlinear_least_squares.jl +++ b/test/nonlinear_least_squares.jl @@ -36,6 +36,7 @@ append!(solvers, LevenbergMarquardt(; linsolve = LUFactorization()), LeastSquaresOptimJL(:lm), LeastSquaresOptimJL(:dogleg), + nothing, ]) for prob in nlls_problems, solver in solvers