Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/LMTR_alg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ function SolverCore.solve!(

σmax, found_σ = opnorm(solver.subpb.model.J)
found_σ || error("operator norm computation failed")
ν = α * Δk / (1 + σmax^2 * (α * Δk + 1))
ν = 1 / (σmax^2 + 1 / (α * Δk))
@. mν∇fk = -∇fk * ν
sqrt_ξ1_νInv = one(T)

Expand Down Expand Up @@ -449,7 +449,7 @@ function SolverCore.solve!(
set_time!(stats, time() - start_time)
set_solver_specific!(stats, :prox_evals, prox_evals + 1)

ν = α * Δk / (1 + σmax^2 * (α * Δk + 1))
ν = 1 / (σmax^2 + 1 / (α * Δk))
@. mν∇fk = -∇fk * ν

prox!(s, ψ, mν∇fk, ν)
Expand Down
20 changes: 6 additions & 14 deletions src/TRDH_alg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ function SolverCore.solve!(
dk .= D.d
DNorm = norm(D.d, Inf)

ν = (α * Δk)/(DNorm + one(T))
ν = 1 / (DNorm + 1 / (α * Δk))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, thank you. In addition, DNorm can be computed as norm(max.(D.d, 0), Inf) (although that allocates). That was a late update to the convergence theory; it looks like it didn't make it into the paper.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be or should be ?

sqrt_ξ_νInv = one(T)

@. mν∇fk = -ν * ∇fk
Expand All @@ -345,13 +345,6 @@ function SolverCore.solve!(
set_solver_specific!(stats, :nonsmooth_obj, hk)

# models
φ1 = let ∇fk = ∇fk
d -> dot(∇fk, d)
end
mk1 = let ψ = ψ
d -> φ1(d) + ψ(d)::T
end

φ = let ∇fk = ∇fk, dk = dk
d -> begin
result = zero(T)
Expand All @@ -368,7 +361,7 @@ function SolverCore.solve!(

if reduce_TR
prox!(s, ψ, mν∇fk, ν)
mks = mk1(s)
mks = mk(s)

ξ1 = hk - mks + max(1, abs(hk)) * 10 * eps()
sqrt_ξ_νInv = ξ1 ≥ 0 ? sqrt(ξ1 / ν) : sqrt(-ξ1 / ν)
Expand Down Expand Up @@ -484,24 +477,23 @@ function SolverCore.solve!(
set_iter!(stats, stats.iter + 1)
set_time!(stats, time() - start_time)

ν = reduce_TR ? (α * Δk)/(DNorm + one(T)) : α / (DNorm + one(T))
ν = reduce_TR ? 1 / (DNorm + 1 / (α * Δk)) : 1 / (DNorm + 1 / α)
mν∇fk .= -ν .* ∇fk

if reduce_TR
prox!(s, ψ, mν∇fk, ν)
ξ1 = hk - mk1(s) + max(1, abs(hk)) * 10 * eps()
ξ1 = hk - mk(s) + max(1, abs(hk)) * 10 * eps()
sqrt_ξ_νInv = ξ1 ≥ 0 ? sqrt(ξ1 / ν) : sqrt(-ξ1 / ν)
solved = (ξ1 < 0 && sqrt_ξ_νInv ≤ neg_tol) || (ξ1 ≥ 0 && sqrt_ξ_νInv < atol)
(ξ1 < 0 && sqrt_ξ_νInv > neg_tol) &&
error("TRDH: prox-gradient step should produce a decrease but ξ = $(ξ)")
end

iprox!(s, ψ, ∇fk, dk)

ξ = hk - mk(s) + max(1, abs(hk)) * 10 * eps()
sNorm = χ(s)

if !reduce_TR
ξ = hk - mk(s) + max(1, abs(hk)) * 10 * eps()
if !reduce_TR
sqrt_ξ_νInv = ξ ≥ 0 ? sqrt(ξ / ν) : sqrt(-ξ / ν)
solved = (ξ < 0 && sqrt_ξ_νInv ≤ neg_tol) || (ξ ≥ 0 && sqrt_ξ_νInv < atol)
(ξ < 0 && sqrt_ξ_νInv > neg_tol) &&
Expand Down
Loading