Skip to content

Commit 3ba5675

Browse files
solve m-monotoneness issues - R2N w R2DH give the same result now
1 parent daafb0b commit 3ba5675

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/R2DH_alg.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ function SolverCore.solve!(
222222
ψ = solver.ψ
223223
xkn = solver.xkn
224224
s = solver.s
225-
m_fh_hist = solver.m_fh_hist
225+
m_fh_hist = solver.m_fh_hist .= T(-Inf)
226226
has_bnds = solver.has_bnds
227227

228228
if has_bnds
@@ -279,14 +279,14 @@ function SolverCore.solve!(
279279
sqrt_ξ_νInv = one(T)
280280

281281
@. mν∇fk = -ν₁ * ∇fk
282-
m_monotone > 1 && (m_fh_hist[mod(stats.iter+1, m_monotone - 1) + 1] = fk + hk)
283282

284283
set_iter!(stats, 0)
285284
start_time = time()
286285
set_time!(stats, 0.0)
287286
set_objective!(stats, fk + hk)
288287
set_solver_specific!(stats, :smooth_obj, fk)
289288
set_solver_specific!(stats, :nonsmooth_obj, hk)
289+
m_monotone > 1 && (m_fh_hist[(stats.iter)%(m_monotone - 1) + 1] = fk + hk)
290290

291291
φ(d) = begin
292292
result = zero(T)
@@ -404,7 +404,7 @@ function SolverCore.solve!(
404404
ν₁ = 1 / ((DNorm + σk) * (1 + θ))
405405

406406
@. mν∇fk = -ν₁ * ∇fk
407-
m_monotone > 1 && (m_fh_hist[mod(stats.iter+1, m_monotone - 1) + 1] = fk + hk)
407+
m_monotone > 1 && (m_fh_hist[stats.iter%(m_monotone - 1) + 1] = fk + hk)
408408

409409
spectral_test ? prox!(s, ψ, mν∇fk, ν₁) : iprox!(s, ψ, ∇fk, dkσk)
410410
mks = mk(s)

src/R2N_alg.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ function SolverCore.solve!(
236236
xkn = solver.xkn
237237
s = solver.s
238238
s1 = solver.s1
239-
m_fh_hist = solver.m_fh_hist
239+
m_fh_hist = solver.m_fh_hist .= T(-Inf)
240240
has_bnds = solver.has_bnds
241241

242242
if has_bnds
@@ -299,14 +299,14 @@ function SolverCore.solve!(
299299
sqrt_ξ1_νInv = one(T)
300300

301301
@. mν∇fk = -ν₁ * ∇fk
302-
m_monotone > 1 && (m_fh_hist[mod(stats.iter+1, m_monotone - 1) + 1] = fk + hk)
303302

304303
set_iter!(stats, 0)
305304
start_time = time()
306305
set_time!(stats, 0.0)
307306
set_objective!(stats, fk + hk)
308307
set_solver_specific!(stats, :smooth_obj, fk)
309308
set_solver_specific!(stats, :nonsmooth_obj, hk)
309+
m_monotone > 1 && (m_fh_hist[stats.iter%(m_monotone - 1) + 1] = fk + hk)
310310

311311
φ1 = let ∇fk = ∇fk
312312
d -> dot(∇fk, d)
@@ -361,7 +361,7 @@ function SolverCore.solve!(
361361
solver.substats;
362362
x = s1,
363363
atol = sub_atol,
364-
ν = ν₁,
364+
ν = 1/σk,
365365
kwargs...
366366
)
367367

@@ -445,7 +445,7 @@ function SolverCore.solve!(
445445
end
446446

447447
ν₁ = 1 / ((λmax + σk) * (1 + θ))
448-
m_monotone > 1 && (m_fh_hist[mod(stats.iter+1, m_monotone - 1) + 1] = fk + hk)
448+
m_monotone > 1 && (m_fh_hist[stats.iter%(m_monotone - 1) + 1] = fk + hk)
449449

450450
set_objective!(stats, fk + hk)
451451
set_solver_specific!(stats, :smooth_obj, fk)

0 commit comments

Comments
 (0)