Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit dbe614b

Browse files
committed
Implemented max allowed shrink of trust-region
1 parent b64cc2f commit dbe614b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/trustRegion.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ function SciMLBase.solve(prob::NonlinearProblem,
7474
fₖ = 0.5 * norm(F)^2
7575
H = ∇f * ∇f
7676
g = ∇f * F
77+
counter = 0
7778

7879
for k in 1:maxiters
7980
# Solve the trust region subproblem.
@@ -89,11 +90,13 @@ function SciMLBase.solve(prob::NonlinearProblem,
8990
# Update the trust region radius.
9091
if r < η₂
9192
Δ = t₁ * Δ
92-
93-
if Δ < 1e-10
93+
counter += 1
94+
if counter > 32
9495
return SciMLBase.build_solution(prob, alg, x, F;
9596
retcode = ReturnCode.Success)
9697
end
98+
else
99+
counter = 0
97100
end
98101
if r > η₁
99102
if isapprox(xₖ₊₁, x, atol = atol, rtol = rtol)

0 commit comments

Comments
 (0)