Skip to content

Commit f957460

Browse files
change theta for better readibility
1 parent f477d1f commit f957460

File tree

5 files changed

+19
-14
lines changed

5 files changed

+19
-14
lines changed

src/LMTR_alg.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function LMTR(
131131
Jt_Fk = similar(∇fk) # temporary storage
132132
133133
σmax = opnorm(Jk)
134-
νInv = (1 + θ) * σmax^2 # ‖J'J‖ = ‖J‖²
134+
νInv = σmax^2 # ‖J'J‖ = ‖J‖²
135135

136136
mν∇fk = -∇fk / νInv
137137

@@ -253,7 +253,7 @@ function LMTR(
253253
Jk = jac_op_residual(nls, xk)
254254
jtprod_residual!(nls, xk, Fk, ∇fk)
255255
σmax = opnorm(Jk)
256-
νInv = (1 + θ) * σmax^2 # ‖J'J‖ = ‖J‖²
256+
νInv = σmax^2/θ # ‖J'J‖ = ‖J‖²
257257
@. mν∇fk = -∇fk / νInv
258258
end
259259

src/LM_alg.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ function LM(
124124
Jt_Fk = similar(∇fk)
125125
126126
σmax = opnorm(Jk)
127-
νInv = (1 + θ) * (σmax^2 + σk) # ‖J'J + σₖ I‖ = ‖J‖² + σₖ
127+
νInv = (σmax^2 + σk) # ‖J'J + σₖ I‖ = ‖J‖² + σₖ
128128

129129
s = zero(xk)
130130

@@ -251,7 +251,7 @@ function LM(
251251
if ρk < η1 || ρk == Inf
252252
σk = σk * γ
253253
end
254-
νInv = (1 + θ) * (σmax^2 + σk) # ‖J'J + σₖ I‖ = ‖J‖² + σₖ
254+
νInv = (σmax^2 + σk)/θ # ‖J'J + σₖ I‖ = ‖J‖² + σₖ
255255
tired = k maxIter || elapsed_time > maxTime
256256
end
257257

src/R2DH.jl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ function SolverCore.solve!(
199199
η2::T = T(0.9),
200200
ν::T = eps(T)^(1 / 5),
201201
γ::T = T(3),
202-
θ::T = eps(T)^(1 / 5),
202+
θ::T = 1/(1 + eps(T)^(1 / 5)),
203203
) where{T, V}
204204

205205
reset!(stats)
@@ -275,7 +275,7 @@ function SolverCore.solve!(
275275
@. dkσk = D.d .+ σk
276276
DNorm = norm(D.d, Inf)
277277

278-
ν₁ = 1 / ((DNorm + σk) * (1 + θ))
278+
ν₁ = θ / (DNorm + σk)
279279
sqrt_ξ_νInv = one(T)
280280

281281
@. mν∇fk = -ν₁ * ∇fk
@@ -306,7 +306,7 @@ function SolverCore.solve!(
306306
σk = σk * γ
307307
dkσk .= D.d .+ σk
308308
DNorm = norm(D.d, Inf)
309-
ν₁ = 1 / ((DNorm + σk) * (1 + θ))
309+
ν₁ = θ / (DNorm + σk)
310310
@. mν∇fk = -ν₁ * ∇fk
311311
spectral_test ? prox!(s, ψ, mν∇fk, ν₁) : iprox!(s, ψ, ∇fk, dkσk)
312312
mks = mk(s)
@@ -399,7 +399,7 @@ function SolverCore.solve!(
399399
@. dkσk = D.d .+ σk
400400
DNorm = norm(D.d, Inf)
401401

402-
ν₁ = 1 / ((DNorm + σk) * (1 + θ))
402+
ν₁ = θ / (DNorm + σk)
403403

404404
@. mν∇fk = -ν₁ * ∇fk
405405
m_monotone > 1 && (m_fh_hist[stats.iter%(m_monotone - 1) + 1] = fk + hk)
@@ -411,7 +411,7 @@ function SolverCore.solve!(
411411
σk = σk * γ
412412
dkσk .= D.d .+ σk
413413
DNorm = norm(D.d, Inf)
414-
ν₁ = 1 / ((DNorm + σk) * (1 + θ))
414+
ν₁ = θ / (DNorm + σk)
415415
@. mν∇fk = -ν₁ * ∇fk
416416
spectral_test ? prox!(s, ψ, mν∇fk, ν₁) : iprox!(s, ψ, ∇fk, dkσk)
417417
mks = mk(s)
@@ -464,3 +464,8 @@ function SolverCore.solve!(
464464
set_residuals!(stats, zero(eltype(xk)), sqrt_ξ_νInv)
465465
return stats
466466
end
467+
468+
469+
#theta 0.000740095979741405
470+
#nu1 0.0003700479898707025
471+
#original 0.4996302256786179

src/R2N.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ For advanced usage, first define a solver "R2NSolver" to preallocate the memory
130130
- `η2::T = T(0.9)`: very successful iteration threshold;
131131
- `ν::T = eps(T)^(1 / 5)`: inverse of the initial regularization parameter: ν = 1/σ;
132132
- `γ::T = T(3)`: regularization parameter multiplier, σ := σ/γ when the iteration is very successful and σ := σγ when the iteration is unsuccessful.
133-
- `θ::T = eps(T)^(1/5)`: is the model decrease fraction with respect to the decrease of the Cauchy model.
133+
- `θ::T = 1/(1 + eps(T)^(1 / 5))`: is the model decrease fraction with respect to the decrease of the Cauchy model.
134134
- `m_monotone::Int = 1`: monotonicity parameter. By default, R2DH is monotone but the non-monotone variant will be used if `m_monotone > 1`
135135
136136
The algorithm stops either when `√(ξₖ/νₖ) < atol + rtol*√(ξ₀/ν₀) ` or `ξₖ < 0` and `√(-ξₖ/νₖ) < neg_tol` where ξₖ := f(xₖ) + h(xₖ) - φ(sₖ; xₖ) - ψ(sₖ; xₖ), and √(ξₖ/νₖ) is a stationarity measure.
@@ -212,7 +212,7 @@ function SolverCore.solve!(
212212
ν::T = eps(T)^(1 / 5),
213213
γ::T = T(3),
214214
β::T = 1 / eps(T),
215-
θ::T = eps(T)^(1 / 5),
215+
θ::T = 1/(1+eps(T)^(1 / 5)),
216216
kwargs...
217217
) where{T, V, G}
218218
reset!(stats)
@@ -289,7 +289,7 @@ function SolverCore.solve!(
289289

290290
λmax = opnorm(solver.subpb.model.B)
291291

292-
ν₁ = 1 / ((λmax + σk) * (1 + θ))
292+
ν₁ = θ / (λmax + σk)
293293
ν_sub = ν₁
294294

295295
sqrt_ξ1_νInv = one(T)
@@ -435,7 +435,7 @@ function SolverCore.solve!(
435435
σk = σk * γ
436436
end
437437

438-
ν₁ = 1 / ((λmax + σk) * (1 + θ))
438+
ν₁ = θ / (λmax + σk)
439439
m_monotone > 1 && (m_fh_hist[stats.iter%(m_monotone - 1) + 1] = fk + hk)
440440

441441
set_objective!(stats, fk + hk)

src/input_struct.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ mutable struct ROSolverOptions{R}
3434
α::R = 1 / eps(R),
3535
ν::R = eps(R)^(1 / 5),
3636
γ::R = R(3),
37-
θ::R = eps(R)^(1 / 5),
37+
θ::R = 1/(1+eps(R)^(1 / 5)),
3838
β::R = 1 / eps(R),
3939
reduce_TR::Bool = true,
4040
) where {R <: Real}

0 commit comments

Comments
 (0)