@@ -35,39 +35,39 @@ The objective and gradient of `nlp` will be accessed.
3535The value returned is a `GenericExecutionStats`, see `SolverCore.jl`.
3636"""
3737function R2DH (
38- nlp:: AbstractDiagonalQNModel{R, S} ,
38+ nlp:: AbstractDiagonalQNModel{R, S} ,
39+ h,
40+ options:: ROSolverOptions{R} ;
41+ kwargs... ,
42+ ) where {R <: Real , S}
43+ kwargs_dict = Dict (kwargs... )
44+ x0 = pop! (kwargs_dict, :x0 , nlp. meta. x0)
45+ xk, k, outdict = R2DH (
46+ x -> obj (nlp, x),
47+ (g, x) -> grad! (nlp, x, g),
3948 h,
40- options:: ROSolverOptions{R} ;
49+ hess_op (nlp, x0),
50+ options,
51+ x0;
52+ l_bound = nlp. meta. lvar,
53+ u_bound = nlp. meta. uvar,
4154 kwargs... ,
42- ) where {R <: Real , S}
43- kwargs_dict = Dict (kwargs... )
44- x0 = pop! (kwargs_dict, :x0 , nlp. meta. x0)
45- xk, k, outdict = R2DH (
46- x -> obj (nlp, x),
47- (g, x) -> grad! (nlp, x, g),
48- h,
49- hess_op (nlp, x0),
50- options,
51- x0;
52- l_bound = nlp. meta. lvar,
53- u_bound = nlp. meta. uvar,
54- kwargs... ,
55- )
56- sqrt_ξ_νInv = outdict[:sqrt_ξ_νInv ]
57- stats = GenericExecutionStats (nlp)
58- set_status! (stats, outdict[:status ])
59- set_solution! (stats, xk)
60- set_objective! (stats, outdict[:fk ] + outdict[:hk ])
61- set_residuals! (stats, zero (eltype (xk)), sqrt_ξ_νInv)
62- set_iter! (stats, k)
63- set_time! (stats, outdict[:elapsed_time ])
64- set_solver_specific! (stats, :Fhist , outdict[:Fhist ])
65- set_solver_specific! (stats, :Hhist , outdict[:Hhist ])
66- set_solver_specific! (stats, :Time_hist , outdict[:Time_hist ])
67- set_solver_specific! (stats, :NonSmooth , outdict[:NonSmooth ])
68- set_solver_specific! (stats, :SubsolverCounter , outdict[:Chist ])
69- return stats
70- end
55+ )
56+ sqrt_ξ_νInv = outdict[:sqrt_ξ_νInv ]
57+ stats = GenericExecutionStats (nlp)
58+ set_status! (stats, outdict[:status ])
59+ set_solution! (stats, xk)
60+ set_objective! (stats, outdict[:fk ] + outdict[:hk ])
61+ set_residuals! (stats, zero (eltype (xk)), sqrt_ξ_νInv)
62+ set_iter! (stats, k)
63+ set_time! (stats, outdict[:elapsed_time ])
64+ set_solver_specific! (stats, :Fhist , outdict[:Fhist ])
65+ set_solver_specific! (stats, :Hhist , outdict[:Hhist ])
66+ set_solver_specific! (stats, :Time_hist , outdict[:Time_hist ])
67+ set_solver_specific! (stats, :NonSmooth , outdict[:NonSmooth ])
68+ set_solver_specific! (stats, :SubsolverCounter , outdict[:Chist ])
69+ return stats
70+ end
7171
7272"""
7373 R2DH(f, ∇f!, h, options, x0)
@@ -169,11 +169,11 @@ function R2DH(
169169 s = zero (xk)
170170 ψ = has_bnds ? shifted (h, xk, l_bound - xk, u_bound - xk, selected) : shifted (h, xk)
171171
172- Fobj_hist = zeros (maxIter+ 1 )
173- Hobj_hist = zeros (maxIter+ 1 )
174- time_hist = zeros (maxIter+ 1 )
172+ Fobj_hist = zeros (maxIter + 1 )
173+ Hobj_hist = zeros (maxIter + 1 )
174+ time_hist = zeros (maxIter + 1 )
175175 FHobj_hist = fill! (Vector {R} (undef, Mmonotone - 1 ), R (- Inf ))
176- Complex_hist = zeros (Int, maxIter+ 1 )
176+ Complex_hist = zeros (Int, maxIter + 1 )
177177 if verbose > 0
178178 # ! format: off
179179 @info @sprintf " %6s %8s %8s %7s %8s %7s %7s %7s %1s" " iter" " f(x)" " h(x)" " √(ξ/ν)" " ρ" " σ" " ‖x‖" " ‖s‖" " "
@@ -265,7 +265,7 @@ function R2DH(
265265 shift! (ψ, xk)
266266 ∇f! (∇fk, xk)
267267 push! (D, s, ∇fk - ∇fk⁻) # update QN operator
268- DNorm = norm (D. d, Inf )
268+ DNorm = norm (D. d, Inf )
269269 ∇fk⁻ .= ∇fk
270270 end
271271
@@ -275,7 +275,7 @@ function R2DH(
275275
276276 Dkσk .= D. d .+ σk
277277 ν = 1 / ((DNorm + σk) * (1 + θ))
278-
278+
279279 tired = maxIter > 0 && k ≥ maxIter
280280 if ! tired
281281 @. mν∇fk = - ν * ∇fk
0 commit comments