From 214fb0fd8e33963dbbd1940919fbdd9aa732b25c Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Fri, 9 Feb 2024 14:58:18 -0500 Subject: [PATCH 1/3] Dispatch didnot propagate problem kwargs --- lib/SimpleNonlinearSolve/Project.toml | 2 +- lib/SimpleNonlinearSolve/src/SimpleNonlinearSolve.jl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/SimpleNonlinearSolve/Project.toml b/lib/SimpleNonlinearSolve/Project.toml index bf943823d..fdef9b8ee 100644 --- a/lib/SimpleNonlinearSolve/Project.toml +++ b/lib/SimpleNonlinearSolve/Project.toml @@ -1,7 +1,7 @@ name = "SimpleNonlinearSolve" uuid = "727e6d20-b764-4bd8-a329-72de5adea6c7" authors = ["SciML"] -version = "1.4.1" +version = "1.4.2" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" diff --git a/lib/SimpleNonlinearSolve/src/SimpleNonlinearSolve.jl b/lib/SimpleNonlinearSolve/src/SimpleNonlinearSolve.jl index 894195106..55b579e95 100644 --- a/lib/SimpleNonlinearSolve/src/SimpleNonlinearSolve.jl +++ b/lib/SimpleNonlinearSolve/src/SimpleNonlinearSolve.jl @@ -53,7 +53,7 @@ include("ad.jl") # Set the default bracketing method to ITP SciMLBase.solve(prob::IntervalNonlinearProblem; kwargs...) = solve(prob, ITP(); kwargs...) function SciMLBase.solve(prob::IntervalNonlinearProblem, alg::Nothing, args...; kwargs...) - return solve(prob, ITP(), args...; kwargs...) + return solve(prob, ITP(), args...; prob.kwargs..., kwargs...) end # By Pass the highlevel checks for NonlinearProblem for Simple Algorithms @@ -67,7 +67,7 @@ function SciMLBase.solve( new_p = p !== nothing ? p : prob.p return __internal_solve_up( prob, sensealg, new_u0, u0 === nothing, new_p, p === nothing, - alg, args...; kwargs...) + alg, args...; prob.kwargs..., kwargs...) end function __internal_solve_up(_prob::NonlinearProblem, sensealg, u0, u0_changed, p, From 3e8ffd0309a2af7030b117a99927ab91d7f3a00a Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Thu, 15 Feb 2024 11:06:29 -0500 Subject: [PATCH 2/3] Add a test for kwarg propagation --- lib/SimpleNonlinearSolve/test/core/rootfind_tests.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/SimpleNonlinearSolve/test/core/rootfind_tests.jl b/lib/SimpleNonlinearSolve/test/core/rootfind_tests.jl index 005651568..f3ac188a9 100644 --- a/lib/SimpleNonlinearSolve/test/core/rootfind_tests.jl +++ b/lib/SimpleNonlinearSolve/test/core/rootfind_tests.jl @@ -120,14 +120,19 @@ end p = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] @testset "$(nameof(typeof(alg)))" for alg in (SimpleDFSane(), SimpleTrustRegion(), - SimpleHalley(), - SimpleTrustRegion(; nlsolve_update_rule = Val(true))) + SimpleHalley(), SimpleTrustRegion(; nlsolve_update_rule = Val(true))) sol = benchmark_nlsolve_oop(newton_fails, u0, p; solver = alg) @test SciMLBase.successful_retcode(sol) @test all(abs.(newton_fails(sol.u, p)) .< 1e-9) end end +@testitem "Kwargs Propagation" setup=[RootfindingTesting] begin + prob = NonlinearProblem(quadratic_f, ones(4), 2.0; maxiters = 2) + sol = solve(prob, SimpleNewtonRaphson()) + @test sol.retcode === ReturnCode.MaxIters +end + @testitem "Allocation Checks" setup=[RootfindingTesting] begin @testset "$(nameof(typeof(alg)))" for alg in (SimpleNewtonRaphson(), SimpleHalley(), SimpleBroyden(), SimpleKlement(), SimpleLimitedMemoryBroyden(), From 05c80bb151a6714abdbd6de991c3ef8af4da6a10 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Thu, 15 Feb 2024 11:40:00 -0500 Subject: [PATCH 3/3] Dont fail fast --- lib/SimpleNonlinearSolve/.github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/SimpleNonlinearSolve/.github/workflows/CI.yml b/lib/SimpleNonlinearSolve/.github/workflows/CI.yml index 8e0ab3bff..16ec1087c 100644 --- a/lib/SimpleNonlinearSolve/.github/workflows/CI.yml +++ b/lib/SimpleNonlinearSolve/.github/workflows/CI.yml @@ -10,6 +10,7 @@ jobs: test: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: group: - Core