Skip to content
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Manifest.toml
12 changes: 7 additions & 5 deletions src/LMTR_alg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function SolverCore.solve!(
solver::LMTRSolver{T, G, V},
reg_nls::AbstractRegularizedNLPModel{T, V},
stats::GenericExecutionStats{T, V};
callback = (args...) -> nothing,
callback = (args...) -> false,
x::V = reg_nls.model.meta.x0,
atol::T = √eps(T),
sub_atol::T = atol,
Expand Down Expand Up @@ -310,12 +310,15 @@ function SolverCore.solve!(
atol += rtol * sqrt_ξ1_νInv # make stopping test absolute and relative
sub_atol += rtol * sqrt_ξ1_νInv

user_requested_exit = callback(nls, solver, stats) :: Bool

set_status!(
stats,
get_status(
reg_nls,
elapsed_time = stats.elapsed_time,
iter = stats.iter,
user_requested_exit = user_requested_exit,
optimal = solved,
improper = improper,
max_eval = max_eval,
Expand All @@ -324,8 +327,6 @@ function SolverCore.solve!(
),
)

callback(nls, solver, stats)

done = stats.status != :unknown

while !done
Expand Down Expand Up @@ -459,12 +460,15 @@ function SolverCore.solve!(
(ξ1 < 0 && sqrt_ξ1_νInv > neg_tol) &&
error("LM: prox-gradient step should produce a decrease but ξ1 = $(ξ1)")

user_requested_exit = callback(nls, solver, stats) :: Bool

set_status!(
stats,
get_status(
reg_nls,
elapsed_time = stats.elapsed_time,
iter = stats.iter,
user_requested_exit = user_requested_exit,
optimal = solved,
improper = improper,
max_eval = max_eval,
Expand All @@ -473,8 +477,6 @@ function SolverCore.solve!(
),
)

callback(nls, solver, stats)

done = stats.status != :unknown
end

Expand Down
13 changes: 7 additions & 6 deletions src/LM_alg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function SolverCore.solve!(
solver::LMSolver{T, G, V},
reg_nls::AbstractRegularizedNLPModel{T, V},
stats::GenericExecutionStats{T, V};
callback = (args...) -> nothing,
callback = (args...) -> false,
x::V = reg_nls.model.meta.x0,
nonlinear::Bool = true,
atol::T = √eps(T),
Expand Down Expand Up @@ -313,12 +313,15 @@ function SolverCore.solve!(
error("LM: prox-gradient step should produce a decrease but ξ1 = $(ξ1)")
atol += rtol * sqrt_ξ1_νInv # make stopping test absolute and relative

user_requested_exit = callback(nls, solver, stats) :: Bool

set_status!(
stats,
get_status(
reg_nls,
elapsed_time = stats.elapsed_time,
iter = stats.iter,
user_requested_exit = user_requested_exit,
optimal = solved,
improper = improper,
max_eval = max_eval,
Expand All @@ -327,8 +330,6 @@ function SolverCore.solve!(
),
)

callback(nls, solver, stats)

done = stats.status != :unknown

while !done
Expand Down Expand Up @@ -449,22 +450,22 @@ function SolverCore.solve!(
(ξ1 < 0 && sqrt_ξ1_νInv > neg_tol) &&
error("LM: prox-gradient step should produce a decrease but ξ1 = $(ξ1)")

user_requested_exit = callback(nls, solver, stats) :: Bool

set_status!(
stats,
get_status(
reg_nls,
elapsed_time = stats.elapsed_time,
iter = stats.iter,
user_requested_exit = user_requested_exit,
optimal = solved,
improper = improper,
max_eval = max_eval,
max_time = max_time,
max_iter = max_iter,
),
)

callback(nls, solver, stats)

done = stats.status != :unknown
end

Expand Down
12 changes: 7 additions & 5 deletions src/R2DH.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ function SolverCore.solve!(
solver::R2DHSolver{T},
reg_nlp::AbstractRegularizedNLPModel{T, V},
stats::GenericExecutionStats{T, V};
callback = (args...) -> nothing,
callback = (args...) -> false,
x::V = reg_nlp.model.meta.x0,
atol::T = √eps(T),
rtol::T = √eps(T),
Expand Down Expand Up @@ -338,12 +338,15 @@ function SolverCore.solve!(
error("R2DH: prox-gradient step should produce a decrease but ξ = $(ξ)")
atol += rtol * sqrt_ξ_νInv # make stopping test absolute and relative

user_requested_exit = callback(nlp, solver, stats) :: Bool

set_status!(
stats,
get_status(
reg_nlp,
elapsed_time = stats.elapsed_time,
iter = stats.iter,
user_requested_exit = user_requested_exit,
optimal = solved,
improper = improper,
max_eval = max_eval,
Expand All @@ -352,8 +355,6 @@ function SolverCore.solve!(
),
)

callback(nlp, solver, stats)

done = stats.status != :unknown

while !done
Expand Down Expand Up @@ -433,12 +434,15 @@ function SolverCore.solve!(
(ξ < 0 && sqrt_ξ_νInv > neg_tol) &&
error("R2DH: prox-gradient step should produce a decrease but ξ = $(ξ)")

user_requested_exit = callback(nlp, solver, stats) :: Bool

set_status!(
stats,
get_status(
reg_nlp,
elapsed_time = stats.elapsed_time,
iter = stats.iter,
user_requested_exit = user_requested_exit,
optimal = solved,
improper = improper,
max_eval = max_eval,
Expand All @@ -447,8 +451,6 @@ function SolverCore.solve!(
),
)

callback(nlp, solver, stats)

done = stats.status != :unknown
end

Expand Down
12 changes: 7 additions & 5 deletions src/R2N.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function SolverCore.solve!(
solver::R2NSolver{T, G, V},
reg_nlp::AbstractRegularizedNLPModel{T, V},
stats::GenericExecutionStats{T, V};
callback = (args...) -> nothing,
callback = (args...) -> false,
qn_update_y!::Function = _qn_grad_update_y!,
qn_copy!::Function = _qn_grad_copy!,
x::V = reg_nlp.model.meta.x0,
Expand Down Expand Up @@ -340,12 +340,15 @@ function SolverCore.solve!(
error("R2N: prox-gradient step should produce a decrease but ξ1 = $(ξ1)")
atol += rtol * sqrt_ξ1_νInv # make stopping test absolute and relative

user_requested_exit = callback(nlp, solver, stats) :: Bool

set_status!(
stats,
get_status(
reg_nlp,
elapsed_time = stats.elapsed_time,
iter = stats.iter,
user_requested_exit = user_requested_exit,
optimal = solved,
improper = improper,
max_eval = max_eval,
Expand All @@ -354,8 +357,6 @@ function SolverCore.solve!(
),
)

callback(nlp, solver, stats)

done = stats.status != :unknown

while !done
Expand Down Expand Up @@ -486,12 +487,15 @@ function SolverCore.solve!(

(ξ1 < 0 && sqrt_ξ1_νInv > neg_tol) &&
error("R2N: prox-gradient step should produce a decrease but ξ1 = $(ξ1)")
user_requested_exit = callback(nlp, solver, stats) :: Bool

set_status!(
stats,
get_status(
reg_nlp,
elapsed_time = stats.elapsed_time,
iter = stats.iter,
user_requested_exit = user_requested_exit,
optimal = solved,
improper = improper,
max_eval = max_eval,
Expand All @@ -500,8 +504,6 @@ function SolverCore.solve!(
),
)

callback(nlp, solver, stats)

done = stats.status != :unknown
end

Expand Down
13 changes: 8 additions & 5 deletions src/R2_alg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ function R2(reg_nlp::AbstractRegularizedNLPModel; kwargs...)
solver.Fobj_hist[stats.iter + 1] = stats.solver_specific[:smooth_obj]
solver.Hobj_hist[stats.iter + 1] = stats.solver_specific[:nonsmooth_obj]
solver.Complex_hist[stats.iter + 1] += 1
return false
end,
)
solve!(solver, reg_nlp, stats; callback = cb, max_iter = max_iter, kwargs...)
Expand All @@ -309,7 +310,7 @@ function SolverCore.solve!(
solver::R2Solver{T},
reg_nlp::AbstractRegularizedNLPModel{T, V},
stats::GenericExecutionStats{T, V};
callback = (args...) -> nothing,
callback = (args...) -> false,
x::V = reg_nlp.model.meta.x0,
atol::T = √eps(T),
rtol::T = √eps(T),
Expand Down Expand Up @@ -413,12 +414,15 @@ function SolverCore.solve!(
(ξ < 0 && sqrt_ξ_νInv > neg_tol) &&
error("R2: prox-gradient step should produce a decrease but ξ = $(ξ)")

user_requested_exit = callback(nlp, solver, stats) :: Bool

set_status!(
stats,
get_status(
reg_nlp,
elapsed_time = stats.elapsed_time,
iter = stats.iter,
user_requested_exit = user_requested_exit,
optimal = solved,
improper = improper,
max_eval = max_eval,
Expand All @@ -427,8 +431,6 @@ function SolverCore.solve!(
),
)

callback(nlp, solver, stats)

done = stats.status != :unknown

while !done
Expand Down Expand Up @@ -497,12 +499,15 @@ function SolverCore.solve!(
(ξ < 0 && sqrt_ξ_νInv > neg_tol) &&
error("R2: prox-gradient step should produce a decrease but ξ = $(ξ)")

user_requested_exit = callback(nlp, solver, stats) :: Bool

set_status!(
stats,
get_status(
reg_nlp,
elapsed_time = stats.elapsed_time,
iter = stats.iter,
user_requested_exit = user_requested_exit,
optimal = solved,
improper = improper,
max_eval = max_eval,
Expand All @@ -511,8 +516,6 @@ function SolverCore.solve!(
),
)

callback(nlp, solver, stats)

done = stats.status != :unknown
end

Expand Down
12 changes: 7 additions & 5 deletions src/TRDH_alg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function SolverCore.solve!(
solver::TRDHSolver{T, G, V},
reg_nlp::AbstractRegularizedNLPModel{T, V},
stats::GenericExecutionStats{T, V};
callback = (args...) -> nothing,
callback = (args...) -> false,
x::V = reg_nlp.model.meta.x0,
atol::T = √eps(T),
rtol::T = √eps(T),
Expand Down Expand Up @@ -390,12 +390,15 @@ function SolverCore.solve!(
atol += rtol * sqrt_ξ_νInv # make stopping test absolute and relative #TODO : this is redundant code with the other case of the test.
end

user_requested_exit = callback(nlp, solver, stats) :: Bool

set_status!(
stats,
get_status(
reg_nlp,
elapsed_time = stats.elapsed_time,
iter = stats.iter,
user_requested_exit = user_requested_exit,
optimal = solved,
improper = improper,
max_eval = max_eval,
Expand All @@ -404,8 +407,6 @@ function SolverCore.solve!(
),
)

callback(nlp, solver, stats)

done = stats.status != :unknown

while !done
Expand Down Expand Up @@ -496,12 +497,15 @@ function SolverCore.solve!(
error("TRDH: prox-gradient step should produce a decrease but ξ = $(ξ)")
end

user_requested_exit = callback(nlp, solver, stats) :: Bool

set_status!(
stats,
get_status(
reg_nlp,
elapsed_time = stats.elapsed_time,
iter = stats.iter,
user_requested_exit = user_requested_exit,
optimal = solved,
improper = improper,
max_eval = max_eval,
Expand All @@ -510,8 +514,6 @@ function SolverCore.solve!(
),
)

callback(nlp, solver, stats)

done = stats.status != :unknown
end

Expand Down
Loading
Loading