Skip to content

Commit 4cf4b4f

Browse files
authored
Uniform input (#158)
* uniform kwargs in R2
1 parent 6e4f6be commit 4cf4b4f

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/R2.jl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ For advanced usage, first define a `R2Solver` to preallocate the memory used in
1414
- `nlp::AbstractNLPModel{T, V}` is the model to solve, see `NLPModels.jl`.
1515
1616
# Keyword arguments
17-
- x0::V = nlp.meta.x0`: the initial guess
18-
- atol = eps(T)^(1 / 3): absolute tolerance
19-
- rtol = eps(T)^(1 / 3): relative tolerance: algorithm stops when ‖∇f(x)‖ ≤ ϵ\\_abs + ϵ\\_rel*‖∇f(x0)‖
20-
- η1 = eps(T)^(1/4), η2 = T(0.95): step acceptance parameters
21-
- γ1 = T(1/2), γ2 = 1/γ1: regularization update parameters
22-
- σmin = eps(T): step parameter for R2 algorithm
23-
- max_eval::Int: maximum number of evaluation of the objective function
24-
- max_time::Float64 = 3600.0: maximum time limit in seconds
25-
- β = T(0) ∈ [0,1] is the constant in the momentum term. If `β == 0`, R2 does not use momentum
26-
- verbose::Int = 0: if > 0, display iteration details every `verbose` iteration.
17+
- `x::V = nlp.meta.x0`: the initial guess.
18+
- `atol::T = eps(T)`: absolute tolerance.
19+
- `rtol::T = eps(T)`: relative tolerance: algorithm stops when ‖∇f(xᵏ)‖ ≤ atol + rtol * ‖∇f(x⁰)‖.
20+
- `η1 = eps(T)^(1/4)`, `η2 = T(0.95)`: step acceptance parameters.
21+
- `γ1 = T(1/2)`, `γ2 = 1/γ1`: regularization update parameters.
22+
- `σmin = eps(T)`: step parameter for R2 algorithm.
23+
- `max_eval::Int = -1`: maximum number of evaluation of the objective function.
24+
- `max_time::Float64 = 30.0`: maximum time limit in seconds.
25+
- `β = T(0) ∈ [0,1]` is the constant in the momentum term. If `β == 0`, R2 does not use momentum.
26+
- `verbose::Int = 0`: if > 0, display iteration details every `verbose` iteration.
2727
2828
# Output
2929
The value returned is a `GenericExecutionStats`, see `SolverCore.jl`.
@@ -91,15 +91,15 @@ function SolverCore.solve!(
9191
nlp::AbstractNLPModel{T, V},
9292
stats::GenericExecutionStats{T, V};
9393
callback = (args...) -> nothing,
94-
x0::V = nlp.meta.x0,
95-
atol = eps(T)^(1 / 2),
96-
rtol = eps(T)^(1 / 2),
94+
x::V = nlp.meta.x0,
95+
atol::T = eps(T),
96+
rtol::T = eps(T),
9797
η1 = eps(T)^(1 / 4),
9898
η2 = T(0.95),
9999
γ1 = T(1 / 2),
100100
γ2 = 1 / γ1,
101101
σmin = zero(T),
102-
max_time::Float64 = 3600.0,
102+
max_time::Float64 = 30.0,
103103
max_eval::Int = -1,
104104
β::T = T(0),
105105
verbose::Int = 0,
@@ -110,7 +110,7 @@ function SolverCore.solve!(
110110
start_time = time()
111111
set_time!(stats, 0.0)
112112

113-
x = solver.x .= x0
113+
x = solver.x .= x
114114
∇fk = solver.gx
115115
ck = solver.cx
116116
d = solver.d

0 commit comments

Comments
 (0)