From 40b14754f4e11f777b3379edbb37ed862bfd371f Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Mon, 21 Oct 2024 12:13:35 -0400 Subject: [PATCH] chore: remove deprecated functionalities --- ext/NonlinearSolveMINPACKExt.jl | 4 +- ext/NonlinearSolveNLsolveExt.jl | 6 +- ext/NonlinearSolveSpeedMappingExt.jl | 2 +- src/algorithms/extension_algs.jl | 85 +++------------------------ src/algorithms/levenberg_marquardt.jl | 18 ++---- src/internal/jacobian.jl | 16 ++--- 6 files changed, 23 insertions(+), 108 deletions(-) diff --git a/ext/NonlinearSolveMINPACKExt.jl b/ext/NonlinearSolveMINPACKExt.jl index a7be409d4..8299b0b45 100644 --- a/ext/NonlinearSolveMINPACKExt.jl +++ b/ext/NonlinearSolveMINPACKExt.jl @@ -19,8 +19,8 @@ function SciMLBase.__solve( method = ifelse(alg.method === :auto, ifelse(prob isa NonlinearLeastSquaresProblem, :lm, :hybr), alg.method) - show_trace = alg.show_trace || ShT - tracing = alg.tracing || StT + show_trace = ShT + tracing = StT tol = NonlinearSolve.DEFAULT_TOLERANCE(abstol, eltype(u0)) if alg.autodiff === missing && prob.f.jac === nothing diff --git a/ext/NonlinearSolveNLsolveExt.jl b/ext/NonlinearSolveNLsolveExt.jl index 95de37055..9872c7953 100644 --- a/ext/NonlinearSolveNLsolveExt.jl +++ b/ext/NonlinearSolveNLsolveExt.jl @@ -28,9 +28,9 @@ function SciMLBase.__solve( end abstol = NonlinearSolve.DEFAULT_TOLERANCE(abstol, eltype(u0)) - show_trace = ShT || alg.show_trace - store_trace = StT || alg.store_trace - extended_trace = !(trace_level isa TraceMinimal) || alg.extended_trace + show_trace = ShT + store_trace = StT + extended_trace = !(trace_level isa TraceMinimal) linesearch = alg.linesearch === missing ? Static() : alg.linesearch diff --git a/ext/NonlinearSolveSpeedMappingExt.jl b/ext/NonlinearSolveSpeedMappingExt.jl index 2813e3e58..b39394a3b 100644 --- a/ext/NonlinearSolveSpeedMappingExt.jl +++ b/ext/NonlinearSolveSpeedMappingExt.jl @@ -14,7 +14,7 @@ function SciMLBase.__solve(prob::NonlinearProblem, alg::SpeedMappingJL, args...; prob; alias_u0, make_fixed_point = Val(true)) tol = NonlinearSolve.DEFAULT_TOLERANCE(abstol, eltype(u)) - time_limit = ifelse(maxtime === nothing, alg.time_limit, maxtime) + time_limit = ifelse(maxtime === nothing, 1000, maxtime) sol = speedmapping(u; m!, tol, Lp = Inf, maps_limit = maxiters, alg.orders, alg.check_obj, store_info, alg.σ_min, alg.stabilize, time_limit) diff --git a/src/algorithms/extension_algs.jl b/src/algorithms/extension_algs.jl index 9c08c5202..3cf36ca9f 100644 --- a/src/algorithms/extension_algs.jl +++ b/src/algorithms/extension_algs.jl @@ -142,39 +142,15 @@ NonlinearLeastSquaresProblem. This algorithm is only available if `MINPACK.jl` is installed. """ @concrete struct CMINPACK <: AbstractNonlinearSolveExtensionAlgorithm - show_trace::Bool - tracing::Bool method::Symbol autodiff end -function CMINPACK(; show_trace = missing, tracing = missing, - method::Symbol = :auto, autodiff = missing) +function CMINPACK(; method::Symbol = :auto, autodiff = missing) if Base.get_extension(@__MODULE__, :NonlinearSolveMINPACKExt) === nothing error("CMINPACK requires MINPACK.jl to be loaded") end - - if show_trace !== missing - Base.depwarn( - "`show_trace` for CMINPACK has been deprecated and will be removed \ - in v4. Use the `show_trace` keyword argument via the logging API \ - https://docs.sciml.ai/NonlinearSolve/stable/basics/Logging/ \ - instead.", :CMINPACK) - else - show_trace = false - end - - if tracing !== missing - Base.depwarn( - "`tracing` for CMINPACK has been deprecated and will be removed \ - in v4. Use the `store_trace` keyword argument via the logging API \ - https://docs.sciml.ai/NonlinearSolve/stable/basics/Logging/ \ - instead.", :CMINPACK) - else - tracing = false - end - - return CMINPACK(show_trace, tracing, method, autodiff) + return CMINPACK(method, autodiff) end """ @@ -228,63 +204,26 @@ For more information on these arguments, consult the @concrete struct NLsolveJL <: AbstractNonlinearSolveExtensionAlgorithm method::Symbol autodiff - store_trace::Bool - extended_trace::Bool linesearch linsolve factor autoscale::Bool m::Int beta - show_trace::Bool end -function NLsolveJL(; method = :trust_region, autodiff = :central, store_trace = missing, - extended_trace = missing, linesearch = missing, +function NLsolveJL(; method = :trust_region, autodiff = :central, linesearch = missing, linsolve = (x, A, b) -> copyto!(x, A \ b), factor = 1.0, - autoscale = true, m = 10, beta = one(Float64), show_trace = missing) + autoscale = true, m = 10, beta = one(Float64)) if Base.get_extension(@__MODULE__, :NonlinearSolveNLsolveExt) === nothing error("NLsolveJL requires NLsolve.jl to be loaded") end - if show_trace !== missing - Base.depwarn("`show_trace` for NLsolveJL has been deprecated and will be removed \ - in v4. Use the `show_trace` keyword argument via the logging API \ - https://docs.sciml.ai/NonlinearSolve/stable/basics/Logging/ \ - instead.", - :NLsolveJL) - else - show_trace = false - end - - if store_trace !== missing - Base.depwarn( - "`store_trace` for NLsolveJL has been deprecated and will be removed \ - in v4. Use the `store_trace` keyword argument via the logging API \ - https://docs.sciml.ai/NonlinearSolve/stable/basics/Logging/ \ - instead.", - :NLsolveJL) - else - store_trace = false - end - - if extended_trace !== missing - Base.depwarn( - "`extended_trace` for NLsolveJL has been deprecated and will be \ - removed in v4. Use the `trace_level = TraceAll()` keyword argument \ - via the logging API \ - https://docs.sciml.ai/NonlinearSolve/stable/basics/Logging/ instead.", - :NLsolveJL) - else - extended_trace = false - end - if autodiff isa Symbol && autodiff !== :central && autodiff !== :forward error("`autodiff` must be `:central` or `:forward`.") end - return NLsolveJL(method, autodiff, store_trace, extended_trace, linesearch, - linsolve, factor, autoscale, m, beta, show_trace) + return NLsolveJL(method, autodiff, linesearch, linsolve, factor, autoscale, m, beta) end """ @@ -349,25 +288,15 @@ Fixed Point Problems. We allow using this algorithm to solve root finding proble stabilize::Bool check_obj::Bool orders::Vector{Int} - time_limit end function SpeedMappingJL(; σ_min = 0.0, stabilize::Bool = false, check_obj::Bool = false, - orders::Vector{Int} = [3, 3, 2], time_limit = missing) + orders::Vector{Int} = [3, 3, 2]) if Base.get_extension(@__MODULE__, :NonlinearSolveSpeedMappingExt) === nothing error("SpeedMappingJL requires SpeedMapping.jl to be loaded") end - if time_limit !== missing - Base.depwarn("`time_limit` keyword argument to `SpeedMappingJL` has been \ - deprecated and will be removed in v4. Pass `maxtime = ` to \ - `SciMLBase.solve`.", - :SpeedMappingJL) - else - time_limit = 1000 - end - - return SpeedMappingJL(σ_min, stabilize, check_obj, orders, time_limit) + return SpeedMappingJL(σ_min, stabilize, check_obj, orders) end """ diff --git a/src/algorithms/levenberg_marquardt.jl b/src/algorithms/levenberg_marquardt.jl index 66554ee2d..e8a2fd0d7 100644 --- a/src/algorithms/levenberg_marquardt.jl +++ b/src/algorithms/levenberg_marquardt.jl @@ -31,19 +31,11 @@ For the remaining arguments, see [`GeodesicAcceleration`](@ref) and [`NonlinearSolve.LevenbergMarquardtTrustRegion`](@ref) documentations. """ function LevenbergMarquardt(; - concrete_jac = missing, linsolve = nothing, precs = DEFAULT_PRECS, - damping_initial::Real = 1.0, α_geodesic::Real = 0.75, - damping_increase_factor::Real = 2.0, damping_decrease_factor::Real = 3.0, - finite_diff_step_geodesic = 0.1, b_uphill::Real = 1.0, - autodiff = nothing, min_damping_D::Real = 1e-8, disable_geodesic = False) - if concrete_jac !== missing - Base.depwarn("The `concrete_jac` keyword argument is deprecated and will be \ - removed in v0.4. This kwarg doesn't make sense (and is currently \ - ignored) for LM since it needs to materialize the Jacobian to \ - compute the Damping Term", - :LevenbergMarquardt) - end - + linsolve = nothing, precs = DEFAULT_PRECS, damping_initial::Real = 1.0, + α_geodesic::Real = 0.75, damping_increase_factor::Real = 2.0, + damping_decrease_factor::Real = 3.0, finite_diff_step_geodesic = 0.1, + b_uphill::Real = 1.0, autodiff = nothing, + min_damping_D::Real = 1e-8, disable_geodesic = False) descent = DampedNewtonDescent(; linsolve, precs, initial_damping = damping_initial, diff --git a/src/internal/jacobian.jl b/src/internal/jacobian.jl index b78eb7383..358bca792 100644 --- a/src/internal/jacobian.jl +++ b/src/internal/jacobian.jl @@ -243,17 +243,11 @@ function select_fastest_coloring_algorithm( return GreedyColoringAlgorithm(LargestFirst()) end -function construct_concrete_adtype(f::NonlinearFunction, ad::AutoSparse) - Base.depwarn( - "Specifying a sparse AD type for Nonlinear Problems is deprecated. \ - Instead use the `sparsity`, `jac_prototype`, and `colorvec` to specify \ - the right sparsity pattern and coloring algorithm. Ignoring the sparsity \ - detection algorithm and coloring algorithm present in $(ad).", - :NonlinearSolve) - if f.sparsity === nothing && f.jac_prototype === nothing - @set! f.sparsity = TracerSparsityDetector() - end - return construct_concrete_adtype(f, get_dense_ad(ad)) +function construct_concrete_adtype(::NonlinearFunction, ad::AutoSparse) + error("Specifying a sparse AD type for Nonlinear Problems was removed in v4. \ + Instead use the `sparsity`, `jac_prototype`, and `colorvec` to specify \ + the right sparsity pattern and coloring algorithm. Ignoring the sparsity \ + detection algorithm and coloring algorithm present in $(ad).") end get_dense_ad(ad) = ad