Skip to content

Commit e47b894

Browse files
ChrisRackauckas-ClaudeChrisRackauckasclaude
authored
Remove isadapt parameter and fix Aqua persistent_tasks test (#750)
Changes to NonlinearSolveBase: - Removed `isadapt` parameter from all `get_concrete_problem` signatures - Hardcoded `true` in `get_concrete_u0` calls - Updated all callers to not pass the `true` argument The `isadapt` parameter is only meaningful for ODE solvers with adaptive timestepping. For nonlinear problems, this concept doesn't apply. Changes to NonlinearSolveHomotopyContinuation: - Simplified Aqua tests since persistent_tasks now passes on Julia 1.11+ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: ChrisRackauckas <[email protected]> Co-authored-by: Claude Opus 4.5 <[email protected]>
1 parent fbaf572 commit e47b894

File tree

2 files changed

+16
-31
lines changed

2 files changed

+16
-31
lines changed

lib/NonlinearSolveBase/src/solve.jl

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,10 @@ function solve_up(prob::AbstractNonlinearProblem, sensealg, u0, p,
111111
kwargs...)
112112
alg = extract_alg(args, kwargs, has_kwargs(prob) ? prob.kwargs : kwargs)
113113
if isnothing(alg) || !(alg isa AbstractNonlinearSolveAlgorithm) # Default algorithm handling
114-
_prob = get_concrete_problem(prob, true; u0 = u0,
115-
p = p, kwargs...)
114+
_prob = get_concrete_problem(prob; u0 = u0, p = p, kwargs...)
116115
solve_call(_prob, args...; kwargs...)
117116
else
118-
_prob = get_concrete_problem(prob, true; u0 = u0, p = p, kwargs...)
117+
_prob = get_concrete_problem(prob; u0 = u0, p = p, kwargs...)
119118
#check_prob_alg_pairing(_prob, alg) # use alg for improved inference
120119
if length(args) > 1
121120
solve_call(_prob, alg, Base.tail(args)...; kwargs...)
@@ -224,8 +223,7 @@ function init_up(prob::AbstractNonlinearProblem,
224223
sensealg, u0, p, args...; kwargs...)
225224
alg = extract_alg(args, kwargs, has_kwargs(prob) ? prob.kwargs : kwargs)
226225
if isnothing(alg) || !(alg isa AbstractNonlinearAlgorithm) # Default algorithm handling
227-
_prob = get_concrete_problem(prob, true; u0 = u0,
228-
p = p, kwargs...)
226+
_prob = get_concrete_problem(prob; u0 = u0, p = p, kwargs...)
229227
init_call(_prob, args...; kwargs...)
230228
else
231229
tstops = get(kwargs, :tstops, nothing)
@@ -236,7 +234,7 @@ function init_up(prob::AbstractNonlinearProblem,
236234
!SciMLBase.allows_late_binding_tstops(alg)
237235
throw(LateBindingTstopsNotSupportedError())
238236
end
239-
_prob = get_concrete_problem(prob, true; u0 = u0, p = p, kwargs...)
237+
_prob = get_concrete_problem(prob; u0 = u0, p = p, kwargs...)
240238
#check_prob_alg_pairing(_prob, alg) # alg for improved inference
241239
if length(args) > 1
242240
init_call(_prob, alg, Base.tail(args)...; kwargs...)
@@ -640,12 +638,7 @@ end
640638
function _solve_adjoint(prob, sensealg, u0, p, originator, args...; merge_callbacks = true,
641639
kwargs...)
642640
alg = extract_alg(args, kwargs, prob.kwargs)
643-
if isnothing(alg) || !(alg isa AbstractDEAlgorithm) # Default algorithm handling
644-
_prob = get_concrete_problem(prob, true; u0 = u0,
645-
p = p, kwargs...)
646-
else
647-
_prob = get_concrete_problem(prob, isadaptive(alg); u0 = u0, p = p, kwargs...)
648-
end
641+
_prob = get_concrete_problem(prob; u0 = u0, p = p, kwargs...)
649642

650643
if has_kwargs(_prob)
651644
kwargs = isempty(_prob.kwargs) ? kwargs : merge(values(_prob.kwargs), kwargs)
@@ -662,12 +655,7 @@ end
662655
function _solve_forward(prob, sensealg, u0, p, originator, args...; merge_callbacks = true,
663656
kwargs...)
664657
alg = extract_alg(args, kwargs, prob.kwargs)
665-
if isnothing(alg) || !(alg isa AbstractDEAlgorithm) # Default algorithm handling
666-
_prob = get_concrete_problem(prob, true; u0 = u0,
667-
p = p, kwargs...)
668-
else
669-
_prob = get_concrete_problem(prob, isadaptive(alg); u0 = u0, p = p, kwargs...)
670-
end
658+
_prob = get_concrete_problem(prob; u0 = u0, p = p, kwargs...)
671659

672660
if has_kwargs(_prob)
673661
kwargs = isempty(_prob.kwargs) ? kwargs : merge(values(_prob.kwargs), kwargs)
@@ -681,46 +669,45 @@ function _solve_forward(prob, sensealg, u0, p, originator, args...; merge_callba
681669
end
682670
end
683671

684-
function get_concrete_problem(prob::NonlinearProblem, isadapt; kwargs...)
672+
function get_concrete_problem(prob::NonlinearProblem; kwargs...)
685673
oldprob = prob
686674
prob = get_updated_symbolic_problem(get_root_indp(prob), prob; kwargs...)
687675
if prob !== oldprob
688676
kwargs = (; kwargs..., u0 = SII.state_values(prob), p = SII.parameter_values(prob))
689677
end
690-
p = get_concrete_p(prob, kwargs)
691-
u0 = get_concrete_u0(prob, isadapt, nothing, kwargs)
678+
p = get_concrete_p(prob, kwargs)
679+
u0 = get_concrete_u0(prob, true, nothing, kwargs)
692680
u0 = promote_u0(u0, p, nothing)
693681
remake(prob; u0 = u0, p = p)
694682
end
695683

696-
function get_concrete_problem(prob::NonlinearLeastSquaresProblem, isadapt; kwargs...)
684+
function get_concrete_problem(prob::NonlinearLeastSquaresProblem; kwargs...)
697685
oldprob = prob
698686
prob = get_updated_symbolic_problem(get_root_indp(prob), prob; kwargs...)
699687
if prob !== oldprob
700688
kwargs = (; kwargs..., u0 = SII.state_values(prob), p = SII.parameter_values(prob))
701689
end
702690
p = get_concrete_p(prob, kwargs)
703-
u0 = get_concrete_u0(prob, isadapt, nothing, kwargs)
691+
u0 = get_concrete_u0(prob, true, nothing, kwargs)
704692
u0 = promote_u0(u0, p, nothing)
705693
remake(prob; u0 = u0, p = p)
706694
end
707695

708-
function get_concrete_problem(
709-
prob::ImmutableNonlinearProblem, isadapt; kwargs...)
710-
u0 = get_concrete_u0(prob, isadapt, nothing, kwargs)
696+
function get_concrete_problem(prob::ImmutableNonlinearProblem; kwargs...)
697+
u0 = get_concrete_u0(prob, true, nothing, kwargs)
711698
u0 = promote_u0(u0, prob.p, nothing)
712699
p = get_concrete_p(prob, kwargs)
713700
return remake(prob; u0 = u0, p = p)
714701
end
715702

716-
function get_concrete_problem(prob::SteadyStateProblem, isadapt; kwargs...)
703+
function get_concrete_problem(prob::SteadyStateProblem; kwargs...)
717704
oldprob = prob
718705
prob = get_updated_symbolic_problem(SciMLBase.get_root_indp(prob), prob; kwargs...)
719706
if prob !== oldprob
720707
kwargs = (; kwargs..., u0 = SII.state_values(prob), p = SII.parameter_values(prob))
721708
end
722709
p = get_concrete_p(prob, kwargs)
723-
u0 = get_concrete_u0(prob, isadapt, Inf, kwargs)
710+
u0 = get_concrete_u0(prob, true, Inf, kwargs)
724711
u0 = promote_u0(u0, p, nothing)
725712
remake(prob; u0 = u0, p = p)
726713
end

lib/NonlinearSolveHomotopyContinuation/test/runtests.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ using Aqua
44

55
@testset "NonlinearSolveHomotopyContinuation.jl" begin
66
@testset "Code quality (Aqua.jl)" begin
7-
Aqua.test_all(NonlinearSolveHomotopyContinuation; persistent_tasks = false)
8-
Aqua.test_persistent_tasks(
9-
NonlinearSolveHomotopyContinuation; broken = VERSION < v"1.11")
7+
Aqua.test_all(NonlinearSolveHomotopyContinuation)
108
end
119
@testset "AllRoots" begin
1210
include("allroots.jl")

0 commit comments

Comments
 (0)