@@ -15,26 +15,28 @@ struct TRARCWorkspace{T,S,Hess}
1515 Fx:: S
1616 function TRARCWorkspace (nlp:: AbstractNLPModel{T,S} , :: Type{Hess} ) where {T,S,Hess}
1717 n = nlp. meta. nvar
18- return new {T,S,Hess} (
18+ Hstruct, Htype = init (Hess, nlp, n)
19+ return new {T,S,Htype} (
1920 S (undef, n), # xt
2021 S (undef, n), # xtnext
2122 S (undef, n), # d
2223 S (undef, n), # ∇f
2324 S (undef, n), # ∇fnext
24- Hess (nlp, n) ,
25+ Hstruct ,
2526 S (undef, n), # H * d
2627 S (undef, 0 ),
2728 )
2829 end
2930 function TRARCWorkspace (nlp:: AbstractNLSModel{T,S} , :: Type{Hess} ) where {T,S,Hess}
3031 n = nlp. meta. nvar
31- return new {T,S,Hess} (
32+ Hstruct, Htype = init (Hess, nlp, n)
33+ return new {T,S,Htype} (
3234 S (undef, n), # xt
3335 S (undef, n), # xtnext
3436 S (undef, n), # d
3537 S (undef, n), # ∇f
3638 S (undef, n), # ∇fnext
37- Hess (nlp, n) ,
39+ Hstruct ,
3840 S (undef, n), # H * d
3941 S (undef, nlp. nls_meta. nequ),
4042 )
@@ -193,8 +195,9 @@ function TRARC(
193195 norm_∇f = norm (∇f)
194196 nlp_stop. meta. optimality0 = norm_∇f
195197
196- OK = update_and_start! (nlp_stop, x = xt, fx = ft, gx = ∇f)
197- ! OK && Stopping. update! (nlp_at_x, Hx = hessian! (workspace, nlp, xt), convert = true )
198+ Stopping. _smart_update! (nlp_at_x, x = xt, fx = ft, gx = ∇f)
199+ OK = start! (nlp_stop)
200+ ! OK && Stopping. _smart_update! (nlp_at_x, Hx = hessian! (workspace, nlp, xt))
198201
199202 iter = 0 # counter different than stop count
200203 succ, unsucc, verysucc, unsuccinarow = 0 , 0 , 0 , 0
@@ -271,8 +274,9 @@ function TRARC(
271274 end # while !success
272275
273276 nlp_stop. meta. nb_of_stop = iter
274- OK = update_and_stop! (nlp_stop, x = xt, fx = ft, gx = ∇f)
275- success && Stopping. update! (nlp_at_x, Hx = hessian! (workspace, nlp, xt))
277+ Stopping. _smart_update! (nlp_at_x, x = xt, fx = ft, gx = ∇f)
278+ OK = stop! (nlp_stop)
279+ success && Stopping. _smart_update! (nlp_at_x, Hx = hessian! (workspace, nlp, xt))
276280 end # while !OK
277281
278282 return nlp_stop
0 commit comments