Skip to content

Commit a57c0b3

Browse files
early exit in SimpleTrustRegion
Fixes #596
1 parent 1105703 commit a57c0b3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/SimpleNonlinearSolve/src/trust_region.jl

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ scalar and static array problems.
2222
- `step_threshold`: the threshold for taking a step. In every iteration, the threshold is
2323
compared with a value `r`, which is the actual reduction in the objective function
2424
divided by the predicted reduction. If `step_threshold > r` the model is not a good
25-
approximation, and the step is rejected. Defaults to `0.1`. For more details, see
25+
approximation, and the step is rejected. Defaults to `0.0001`. For more details, see
2626
[Rahpeymaii, F.](https://link.springer.com/article/10.1007/s40096-020-00339-4)
2727
- `shrink_threshold`: the threshold for shrinking the trust region radius. In every
2828
iteration, the threshold is compared with a value `r` which is the actual reduction in
@@ -128,6 +128,11 @@ function SciMLBase.__solve(
128128
@bb= copy(x)
129129
dogleg_cache = (; δsd, δN_δsd, δN)
130130

131+
solved, retcode, fx_sol, x_sol = Utils.check_termination(
132+
tc_cache, fx, x, xo, prob
133+
)
134+
solved && return SciMLBase.build_solution(prob, alg, x_sol, fx_sol; retcode)
135+
131136
for _ in 1:maxiters
132137
# Solve the trust region subproblem.
133138
δ = dogleg_method!!(dogleg_cache, J, fx, g, Δ)

0 commit comments

Comments
 (0)