From c693f2ce10e7113466badeabd8b9ab0d9cc83764 Mon Sep 17 00:00:00 2001 From: FHoltorf <32248677+FHoltorf@users.noreply.github.com> Date: Thu, 14 Sep 2023 16:30:53 -0400 Subject: [PATCH] add Nocedal and Wright trust region updating scheme --- src/trustRegion.jl | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/trustRegion.jl b/src/trustRegion.jl index 19d5ef0ad..12289c9a2 100644 --- a/src/trustRegion.jl +++ b/src/trustRegion.jl @@ -32,6 +32,13 @@ EnumX.@enumx RadiusUpdateSchemes begin """ NLsolve + """ + `RadiusUpdateSchemes.NLsolve` + + Nocedal and Wright updating scheme + """ + NW + """ `RadiusUpdateSchemes.Hei` @@ -180,7 +187,7 @@ function TrustRegion(; chunk_size = Val{0}(), autodiff = Val{true}(), standardtag = Val{true}(), concrete_jac = nothing, diff_type = Val{:forward}, linsolve = nothing, precs = DEFAULT_PRECS, - radius_update_scheme::RadiusUpdateSchemes.T = RadiusUpdateSchemes.Simple, #defaults to conventional radius update + radius_update_scheme::RadiusUpdateSchemes.T = RadiusUpdateSchemes.NW, #defaults to conventional radius update max_trust_radius::Real = 0 // 1, initial_trust_radius::Real = 0 // 1, step_threshold::Real = 1 // 10000, @@ -540,6 +547,22 @@ function trust_region_step!(cache::TrustRegionCache) if iszero(cache.fu) || cache.internalnorm(cache.fu) < cache.abstol cache.force_stop = true end + + elseif radius_update_scheme === RadiusUpdateSchemes.NW + # accept/reject decision + if r > cache.step_threshold # accept + take_step!(cache) + cache.loss = cache.loss_new + cache.make_new_J = true + else # reject + cache.make_new_J = false + end + + if r < 1 // 4 + cache.trust_r = (1 // 4) * norm(cache.step_size) + elseif (r > (3 // 4)) && abs(norm(cache.step_size) - cache.trust_r)/cache.trust_r < 1e-6 + cache.trust_r = min(2*cache.trust_r, cache.max_trust_r) + end elseif radius_update_scheme === RadiusUpdateSchemes.Hei if r > cache.step_threshold