You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/R2DH.jl
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -127,6 +127,8 @@ or
127
127
- `γ::T = T(3)`: regularization parameter multiplier, σ := σ/γ when the iteration is very successful and σ := σγ when the iteration is unsuccessful.
128
128
- `θ::T = 1/(1 + eps(T)^(1 / 5))`: is the model decrease fraction with respect to the decrease of the Cauchy model.
129
129
- `m_monotone::Int = 6`: monotoneness parameter. By default, R2DH is non-monotone but the monotone variant can be used with `m_monotone = 1`
130
+
- `compute_obj::Bool = true`: (advanced) whether `f(x₀)` should be computed or not. If set to false, then the value is retrieved from `stats.solver_specific[:smooth_obj]`;
131
+
- `compute_grad::Bool = true`: (advanced) whether `∇f(x₀)` should be computed or not. If set to false, then the value is retrieved from `solver.∇fk`;
130
132
131
133
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.
132
134
@@ -228,6 +230,8 @@ function SolverCore.solve!(
228
230
η2::T=T(0.9),
229
231
γ::T=T(3),
230
232
θ::T=1/(1+eps(T)^(1/5)),
233
+
compute_obj::Bool=true,
234
+
compute_grad::Bool=true,
231
235
) where {T, V}
232
236
reset!(stats)
233
237
@@ -293,8 +297,8 @@ function SolverCore.solve!(
293
297
local ξ::T
294
298
local ρk::T=zero(T)
295
299
296
-
fk =obj(nlp, xk)
297
-
grad!(nlp, xk, ∇fk)
300
+
fk =compute_obj ?obj(nlp, xk): stats.solver_specific[:smooth_obj]
Copy file name to clipboardExpand all lines: src/R2N.jl
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -141,6 +141,8 @@ For advanced usage, first define a solver "R2NSolver" to preallocate the memory
141
141
- `θ::T = 1/(1 + eps(T)^(1 / 5))`: is the model decrease fraction with respect to the decrease of the Cauchy model;
142
142
- `opnorm_maxiter::Int = 5`: how many iterations of the power method to use to compute the operator norm of Bₖ. If a negative number is provided, then Arpack is used instead;
143
143
- `m_monotone::Int = 1`: monotonicity parameter. By default, R2N is monotone but the non-monotone variant will be used if `m_monotone > 1`;
144
+
- `compute_obj::Bool = true`: (advanced) whether `f(x₀)` should be computed or not. If set to false, then the value is retrieved from `stats.solver_specific[:smooth_obj]`;
145
+
- `compute_grad::Bool = true`: (advanced) whether `∇f(x₀)` should be computed or not. If set to false, then the value is retrieved from `solver.∇fk`;
144
146
- `sub_kwargs::NamedTuple = NamedTuple()`: a named tuple containing the keyword arguments to be sent to the subsolver. The solver will fail if invalid keyword arguments are provided to the subsolver. For example, if the subsolver is `R2Solver`, you can pass `sub_kwargs = (max_iter = 100, σmin = 1e-6,)`.
145
147
146
148
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.
@@ -218,6 +220,8 @@ function SolverCore.solve!(
218
220
β::T=1/eps(T),
219
221
θ::T=1/(1+eps(T)^(1/5)),
220
222
opnorm_maxiter::Int=5,
223
+
compute_obj::Bool=true,
224
+
compute_grad::Bool=true,
221
225
sub_kwargs::NamedTuple=NamedTuple(),
222
226
) where {T, V, G}
223
227
reset!(stats)
@@ -285,8 +289,8 @@ function SolverCore.solve!(
285
289
local ρk::T=zero(T)
286
290
local prox_evals::Int=0
287
291
288
-
fk =obj(nlp, xk)
289
-
grad!(nlp, xk, ∇fk)
292
+
fk =compute_obj ?obj(nlp, xk): stats.solver_specific[:smooth_obj]
- `ν::T = eps(T)^(1 / 5)`: multiplicative inverse of the regularization parameter: ν = 1/σ;
155
155
- `γ::T = T(3)`: regularization parameter multiplier, σ := σ/γ when the iteration is very successful and σ := σγ when the iteration is unsuccessful.
156
+
- `compute_obj::Bool = true`: (advanced) whether `f(x₀)` should be computed or not. If set to false, then the value is retrieved from `stats.solver_specific[:smooth_obj]`;
157
+
- `compute_grad::Bool = true`: (advanced) whether `∇f(x₀)` should be computed or not. If set to false, then the value is retrieved from `solver.∇fk`;
156
158
157
159
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.
158
160
@@ -323,6 +325,8 @@ function SolverCore.solve!(
323
325
η2::T=T(0.9),
324
326
ν::T=eps(T)^(1/5),
325
327
γ::T=T(3),
328
+
compute_obj::Bool=true,
329
+
compute_grad::Bool=true,
326
330
) where {T, V}
327
331
reset!(stats)
328
332
@@ -386,8 +390,8 @@ function SolverCore.solve!(
386
390
ν =1/ σk
387
391
sqrt_ξ_νInv =one(T)
388
392
389
-
fk =obj(nlp, xk)
390
-
grad!(nlp, xk, ∇fk)
393
+
fk =compute_obj ?obj(nlp, xk): stats.solver_specific[:smooth_obj]
Copy file name to clipboardExpand all lines: src/TRDH_alg.jl
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -135,8 +135,10 @@ For advanced usage, first define a solver "TRDHSolver" to preallocate the memory
135
135
- `η2::T = T(0.9)`: very successful iteration threshold;
136
136
- `γ::T = T(3)`: trust-region radius parameter multiplier. Must satisfy `γ > 1`. The trust-region radius is updated as Δ := Δ*γ when the iteration is very successful and Δ := Δ/γ when the iteration is unsuccessful;
137
137
- `reduce_TR::Bool = true`: see explanation on the stopping criterion below;
138
-
- `χ::F = NormLinf(1)`: norm used to define the trust-region;`
139
-
- `D::L = nothing`: diagonal quasi-Newton approximation used for the model φ. If nothing is provided and `reg_nlp.model` is not a diagonal quasi-Newton approximation, a spectral gradient approximation is used.`
138
+
- `χ::F = NormLinf(1)`: norm used to define the trust-region;
139
+
- `D::L = nothing`: diagonal quasi-Newton approximation used for the model φ. If nothing is provided and `reg_nlp.model` is not a diagonal quasi-Newton approximation, a spectral gradient approximation is used;
140
+
- `compute_obj::Bool = true`: (advanced) whether `f(x₀)` should be computed or not. If set to false, then the value is retrieved from `stats.solver_specific[:smooth_obj]`;
141
+
- `compute_grad::Bool = true`: (advanced) whether `∇f(x₀)` should be computed or not. If set to false, then the value is retrieved from `solver.∇fk`;
140
142
141
143
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.
142
144
Alternatively, if `reduce_TR = true`, then ξₖ₁ := f(xₖ) + h(xₖ) - φ(sₖ₁; xₖ) - ψ(sₖ₁; xₖ) is used instead of ξₖ, where sₖ₁ is the Cauchy point.
@@ -241,6 +243,8 @@ function SolverCore.solve!(
241
243
η1::T=√√eps(T),
242
244
η2::T=T(0.9),
243
245
γ::T=T(3),
246
+
compute_obj::Bool=true,
247
+
compute_grad::Bool=true,
244
248
) where {T, G, V}
245
249
reset!(stats)
246
250
@@ -315,8 +319,8 @@ function SolverCore.solve!(
315
319
α =1/eps(T)
316
320
β =1/eps(T)
317
321
318
-
fk =obj(nlp, xk)
319
-
grad!(nlp, xk, ∇fk)
322
+
fk =compute_obj ?obj(nlp, xk): stats.solver_specific[:smooth_obj]
Copy file name to clipboardExpand all lines: src/TR_alg.jl
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -141,6 +141,8 @@ For advanced usage, first define a solver "TRSolver" to preallocate the memory u
141
141
- `opnorm_maxiter::Int = 5`: how many iterations of the power method to use to compute the operator norm of Bₖ. If a negative number is provided, then Arpack is used instead;
142
142
- `χ::F = NormLinf(1)`: norm used to define the trust-region;`
143
143
- `subsolver::S = R2Solver`: subsolver used to solve the subproblem that appears at each iteration.
144
+
- `compute_obj::Bool = true`: (advanced) whether `f(x₀)` should be computed or not. If set to false, then the value is retrieved from `stats.solver_specific[:smooth_obj]`;
145
+
- `compute_grad::Bool = true`: (advanced) whether `∇f(x₀)` should be computed or not. If set to false, then the value is retrieved from `solver.∇fk`;
144
146
- `sub_kwargs::NamedTuple = NamedTuple()`: a named tuple containing the keyword arguments to be sent to the subsolver. The solver will fail if invalid keyword arguments are provided to the subsolver. For example, if the subsolver is `R2Solver`, you can pass `sub_kwargs = (max_iter = 100, σmin = 1e-6,)`.
145
147
146
148
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.
@@ -213,6 +215,8 @@ function SolverCore.solve!(
213
215
γ::T=T(3),
214
216
sub_kwargs::NamedTuple=NamedTuple(),
215
217
opnorm_maxiter::Int=5,
218
+
compute_obj::Bool=true,
219
+
compute_grad::Bool=true,
216
220
) where {T, G, V}
217
221
reset!(stats)
218
222
@@ -286,8 +290,8 @@ function SolverCore.solve!(
286
290
α =1/eps(T)
287
291
β =1/eps(T)
288
292
289
-
fk =obj(nlp, xk)
290
-
grad!(nlp, xk, ∇fk)
293
+
fk =compute_obj ?obj(nlp, xk): stats.solver_specific[:smooth_obj]
0 commit comments