Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a Trust Region solver. #116

Merged
merged 27 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
51206a5
Implemented a TrustRegion-solver
Deltadahl Jan 17, 2023
3f434c5
Moving functions.
Deltadahl Jan 17, 2023
76edc1f
Format
Deltadahl Jan 17, 2023
569599a
Update src/trustRegion.jl
ChrisRackauckas Jan 17, 2023
18abfba
Update src/trustRegion.jl
ChrisRackauckas Jan 17, 2023
7caf196
Update src/trustRegion.jl
ChrisRackauckas Jan 17, 2023
c532be2
fixing comments in #116 PR
Deltadahl Jan 17, 2023
bea5a07
Merge branch 'master' of github.com:CCsimon123/NonlinearSolve.jl
Deltadahl Jan 17, 2023
e4c91f1
fix misspell
Deltadahl Jan 17, 2023
2043c95
fix misspell
Deltadahl Jan 17, 2023
8e89003
fix docs
Deltadahl Jan 17, 2023
cae5f58
fixing allocation of du1
Deltadahl Jan 17, 2023
65458fc
fixing Copy of J -> new J
Deltadahl Jan 17, 2023
47ed728
replaced $delta N$ with du1
Deltadahl Jan 17, 2023
2751b16
undo last commit...
Deltadahl Jan 17, 2023
12a26cd
undo last commit that gave error
Deltadahl Jan 17, 2023
3c2a937
undo last error commits...
Deltadahl Jan 17, 2023
fd6c9a3
replaced $delta N$ with du1
Deltadahl Jan 17, 2023
b9ab326
replaced du1 with u_tmp
Deltadahl Jan 17, 2023
6dbae4e
solved ForwardDif problem
Deltadahl Jan 17, 2023
0da7d0e
Merge branch 'SciML:master' into master
Deltadahl Jan 18, 2023
15fa80e
Trying to fix allocations
Deltadahl Jan 18, 2023
c518e9b
testing for allocations
Deltadahl Jan 18, 2023
25de883
Update NonlinearSolve.jl
ChrisRackauckas Jan 18, 2023
3348ae0
Update NonlinearSolve.jl
ChrisRackauckas Jan 18, 2023
1758eca
Update NonlinearSolve.jl
ChrisRackauckas Jan 18, 2023
45d6195
Update NonlinearSolve.jl
ChrisRackauckas Jan 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ using NonlinearSolve, StaticArrays
f(u,p) = u .* u .- 2
u0 = @SVector[1.0, 1.0]
probN = NonlinearProblem(f, u0)
solver = solve(probN, NewtonRaphson(), tol = 1e-9)
solver = solve(probN, NewtonRaphson(), abstol = 1e-9)

## Bracketing Methods

Expand Down
3 changes: 2 additions & 1 deletion src/NonlinearSolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ end
include("utils.jl")
include("jacobian.jl")
include("raphson.jl")
include("trustRegion.jl")
include("ad.jl")

import SnoopPrecompile
Expand All @@ -47,6 +48,6 @@ SnoopPrecompile.@precompile_all_calls begin for T in (Float32, Float64)
end
end end

export NewtonRaphson
export NewtonRaphson, TrustRegion

end # module
6 changes: 4 additions & 2 deletions src/ad.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ end

function SciMLBase.solve(prob::NonlinearProblem{<:Union{Number, StaticArraysCore.SVector},
iip,
<:Dual{T, V, P}}, alg::NewtonRaphson,
<:Dual{T, V, P}},
alg::Union{NewtonRaphson, TrustRegion},
args...; kwargs...) where {iip, T, V, P}
sol, partials = scalar_nlsolve_ad(prob, alg, args...; kwargs...)
return SciMLBase.build_solution(prob, alg, Dual{T, V, P}(sol.u, partials), sol.resid;
Expand All @@ -34,7 +35,8 @@ end
function SciMLBase.solve(prob::NonlinearProblem{<:Union{Number, StaticArraysCore.SVector},
iip,
<:AbstractArray{<:Dual{T, V, P}}},
alg::NewtonRaphson, args...; kwargs...) where {iip, T, V, P}
alg::Union{NewtonRaphson, TrustRegion}, args...;
kwargs...) where {iip, T, V, P}
sol, partials = scalar_nlsolve_ad(prob, alg, args...; kwargs...)
return SciMLBase.build_solution(prob, alg, Dual{T, V, P}(sol.u, partials), sol.resid;
retcode = sol.retcode)
Expand Down
Loading