-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into as/fix-sii
- Loading branch information
Showing
6 changed files
with
57 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "NonlinearSolveFirstOrder" | ||
uuid = "5959db7a-ea39-4486-b5fe-2dd0bf03d60d" | ||
authors = ["Avik Pal <[email protected]> and contributors"] | ||
version = "1.0.0" | ||
version = "1.1.0" | ||
|
||
[deps] | ||
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" | ||
|
@@ -13,6 +13,7 @@ FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41" | |
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" | ||
LineSearch = "87fe0de2-c867-4266-b59a-2f0a94fc965b" | ||
MaybeInplace = "bb5d69b7-63fc-4a16-80bd-7e42200c7bdb" | ||
NonlinearSolveBase = "be0214bd-f91f-a760-ac4e-3421ce2b2da0" | ||
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
""" | ||
RobustMultiNewton( | ||
::Type{T} = Float64; | ||
concrete_jac = nothing, | ||
linsolve = nothing, | ||
autodiff = nothing, vjp_autodiff = nothing, jvp_autodiff = nothing | ||
) | ||
A polyalgorithm focused on robustness. It uses a mixture of Newton methods with different | ||
globalizing techniques (trust region updates, line searches, etc.) in order to find a | ||
method that is able to adequately solve the minimization problem. | ||
Basically, if this algorithm fails, then "most" good ways of solving your problem fail and | ||
you may need to think about reformulating the model (either there is an issue with the model, | ||
or more precision / more stable linear solver choice is required). | ||
### Arguments | ||
- `T`: The eltype of the initial guess. It is only used to check if some of the algorithms | ||
are compatible with the problem type. Defaults to `Float64`. | ||
""" | ||
function RobustMultiNewton( | ||
::Type{T} = Float64; | ||
concrete_jac = nothing, | ||
linsolve = nothing, | ||
autodiff = nothing, vjp_autodiff = nothing, jvp_autodiff = nothing | ||
) where {T} | ||
common_kwargs = (; concrete_jac, linsolve, autodiff, vjp_autodiff, jvp_autodiff) | ||
if T <: Complex # Let's atleast have something here for complex numbers | ||
algs = ( | ||
NewtonRaphson(; common_kwargs...), | ||
) | ||
else | ||
algs = ( | ||
TrustRegion(; common_kwargs...), | ||
TrustRegion(; common_kwargs..., radius_update_scheme = RUS.Bastin), | ||
NewtonRaphson(; common_kwargs...), | ||
NewtonRaphson(; common_kwargs..., linesearch = BackTracking()), | ||
TrustRegion(; common_kwargs..., radius_update_scheme = RUS.NLsolve), | ||
TrustRegion(; common_kwargs..., radius_update_scheme = RUS.Fan) | ||
) | ||
end | ||
return NonlinearSolvePolyAlgorithm(algs) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters