@@ -134,7 +134,7 @@ function TR(
134134 χ:: X ,
135135 options:: ROSolverOptions{R} ;
136136 x0:: AbstractVector{R} = f. meta. x0,
137- subsolver_logger:: Logging.AbstractLogger = Logging. NullLogger (),
137+ subsolver_logger:: Logging.AbstractLogger = Logging. SimpleLogger (),
138138 subsolver = R2,
139139 subsolver_options = ROSolverOptions (ϵa = options. ϵa),
140140 selected:: AbstractVector{<:Integer} = 1 : (f. meta. nvar),
@@ -264,7 +264,7 @@ function TR(
264264 continue
265265 end
266266
267- subsolver_options. ϵa = k == 1 ? 1.0e-5 : max (ϵ_subsolver, min (1e-2 , sqrt_ξ1_νInv))
267+ subsolver_options. ϵa = k == 2 ? 1.0e-5 : max (ϵ_subsolver, min (1e-2 , sqrt_ξ1_νInv))
268268 ∆_effective = min (β * χ (s), Δk)
269269 (has_bounds (f) || subsolver == TRDH) ?
270270 set_bounds! (ψ, max .(- ∆_effective, l_bound - xk), min .(∆_effective, u_bound - xk)) :
@@ -273,17 +273,18 @@ function TR(
273273 subsolver_options. ν = ν
274274 subsolver_args = subsolver == TRDH ? (SpectralGradient (1 / ν, f. meta. nvar),) : ()
275275
276- # s, iter, outdict = with_logger(subsolver_logger) do
277- s, iter, outdict = subsolver (φ, ∇φ!, ψ, subsolver_args... , subsolver_options, s)
278- # end
276+ stats = subsolver (φ, ∇φ!, ψ, subsolver_args... , subsolver_options, s)
277+
278+ s = stats. solution
279+ iter = stats. iter
279280
280281 # restore initial values of subsolver_options here so that it is not modified
281282 # if there is an error
282283 subsolver_options. ν = ν_subsolver
283284 subsolver_options. ϵa = ϵa_subsolver
284285 subsolver_options. Δk = Δk_subsolver
285286
286- Complex_hist[k] = sum (outdict[ :Chist ])
287+ Complex_hist[k] = 1
287288
288289 sNorm = χ (s)
289290 xkn .= xk .+ s
@@ -429,6 +430,8 @@ function SolverCore.solve!(
429430 u_bound = solver. u_bound
430431 @. l_bound_m_x = l_bound - xk
431432 @. u_bound_m_x = u_bound - xk
433+ @. l_bound_m_x .= max .(l_bound_m_x, - Δk)
434+ @. u_bound_m_x .= min .(u_bound_m_x, Δk)
432435 set_bounds! (ψ, l_bound_m_x, u_bound_m_x)
433436 else
434437 set_radius! (ψ, Δk)
@@ -535,7 +538,18 @@ function SolverCore.solve!(
535538 while ! done
536539
537540 sub_atol = stats. iter == 0 ? 1e-5 : max (sub_atol, min (1e-2 , sqrt_ξ1_νInv))
538-
541+ ∆_effective = min (β * χ (s), Δk)
542+
543+ if has_bnds || isa (solver. subsolver, TRDHSolver) # TODO elsewhere ?
544+ @. l_bound_m_x = l_bound - xk
545+ @. u_bound_m_x = u_bound - xk
546+ @. l_bound_m_x .= max .(l_bound_m_x, - ∆_effective)
547+ @. u_bound_m_x .= min .(u_bound_m_x, ∆_effective)
548+ set_bounds! (ψ, l_bound_m_x, u_bound_m_x)
549+ else
550+ set_radius! (ψ, ∆_effective)
551+ end
552+
539553 if isa (solver. subsolver, TRDHSolver) # FIXME
540554 solver. subsolver. D. d[1 ] = 1 / ν₁
541555 solve! (
@@ -544,7 +558,7 @@ function SolverCore.solve!(
544558 solver. substats;
545559 x = s,
546560 atol = stats. iter == 0 ? 1e-5 : max (sub_atol, min (1e-2 , sqrt_ξ1_νInv)),
547- Δk = min (β * χ (s), Δk) / 10
561+ Δk = ∆_effective / 10
548562 )
549563 else
550564 solve! (
@@ -633,13 +647,6 @@ function SolverCore.solve!(
633647
634648 if ρk < η1 || ρk == Inf
635649 Δk = Δk / 2
636- if has_bnds || isa (solver. subsolver, TRDHSolver) # TODO elsewhere ?
637- @. l_bound_m_x = l_bound - xk
638- @. u_bound_m_x = u_bound - xk
639- set_bounds! (ψ, l_bound_m_x, u_bound_m_x)
640- else
641- set_radius! (ψ, Δk)
642- end
643650 end
644651
645652 set_objective! (stats, fk + hk)
0 commit comments