Skip to content

Commit

Permalink
chore: remove deprecated functionalities
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Oct 21, 2024
1 parent 3a680ef commit 40b1475
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 108 deletions.
4 changes: 2 additions & 2 deletions ext/NonlinearSolveMINPACKExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions ext/NonlinearSolveNLsolveExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion ext/NonlinearSolveSpeedMappingExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
85 changes: 7 additions & 78 deletions src/algorithms/extension_algs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

"""
Expand Down Expand Up @@ -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

"""
Expand Down Expand Up @@ -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 = <value>` 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

"""
Expand Down
18 changes: 5 additions & 13 deletions src/algorithms/levenberg_marquardt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 5 additions & 11 deletions src/internal/jacobian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 40b1475

Please sign in to comment.