diff --git a/src/LMTR_alg.jl b/src/LMTR_alg.jl index 83e58792..a96bcc01 100644 --- a/src/LMTR_alg.jl +++ b/src/LMTR_alg.jl @@ -100,7 +100,8 @@ function LMTR( xkn = similar(xk) s = zero(xk) - ψ = treats_bounds ? shifted(h, xk, max.(-Δk, l_bound - xk), min.(Δk, u_bound - xk), selected) : + ψ = + treats_bounds ? shifted(h, xk, max.(-Δk, l_bound - xk), min.(Δk, u_bound - xk), selected) : shifted(h, xk, Δk, χ) Fobj_hist = zeros(maxIter) @@ -183,7 +184,8 @@ function LMTR( subsolver_options.ϵa = k == 1 ? 1.0e-5 : max(ϵ_subsolver, min(1.0e-1, ξ1 / 10)) ∆_effective = min(β * χ(s), Δk) - treats_bounds ? set_bounds!(ψ, max.(-∆_effective, l_bound - xk), min.(∆_effective, u_bound - xk)) : + treats_bounds ? + set_bounds!(ψ, max.(-∆_effective, l_bound - xk), min.(∆_effective, u_bound - xk)) : set_radius!(ψ, ∆_effective) subsolver_options.Δk = ∆_effective / 10 s, iter, _ = with_logger(subsolver_logger) do diff --git a/src/LM_alg.jl b/src/LM_alg.jl index ca3a8794..5adafd9b 100644 --- a/src/LM_alg.jl +++ b/src/LM_alg.jl @@ -94,8 +94,7 @@ function LM( verbose > 0 && @debug "LM: found point where h has value" hk end hk == -Inf && error("nonsmooth term is not proper") - ψ = treats_bounds ? shifted(h, xk, l_bound - xk, u_bound - xk, selected) : - shifted(h, xk) + ψ = treats_bounds ? shifted(h, xk, l_bound - xk, u_bound - xk, selected) : shifted(h, xk) xkn = similar(xk) diff --git a/test/test_bounds.jl b/test/test_bounds.jl index e9ef336d..fa21a0bf 100644 --- a/test/test_bounds.jl +++ b/test/test_bounds.jl @@ -54,7 +54,15 @@ for (h, h_name) ∈ ((NormL0(λ), "l0"), (NormL1(λ), "l1")) x0 = zeros(bpdn_nls2.meta.nvar) args = solver_sym == :LM ? () : (NormLinf(1.0),) @test has_bounds(bpdn_nls2) - out = solver(bpdn_nls2, h, args..., options, x0 = x0, subsolver = TRDH, subsolver_options = subsolver_options) + out = solver( + bpdn_nls2, + h, + args..., + options, + x0 = x0, + subsolver = TRDH, + subsolver_options = subsolver_options, + ) @test typeof(out.solution) == typeof(bpdn_nls2.meta.x0) @test length(out.solution) == bpdn_nls2.meta.nvar @test typeof(out.solver_specific[:Fhist]) == typeof(out.solution)