Skip to content

Commit

Permalink
add Nocedal and Wright trust region updating scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
FHoltorf committed Sep 26, 2023
1 parent 146dec9 commit 884aafc
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/trustRegion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ states as `RadiusUpdateSchemes.T`. Simply put the desired scheme as follows:
"""
NLsolve

"""
`RadiusUpdateSchemes.NLsolve`
Nocedal and Wright updating scheme
"""
NW

"""
`RadiusUpdateSchemes.Hei`
Expand Down Expand Up @@ -436,6 +443,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
Expand Down

0 comments on commit 884aafc

Please sign in to comment.