Skip to content

Commit 369ecf7

Browse files
MaxenceGollierdpo
authored andcommitted
add RegularizedExecutionStats
1 parent 0bb99f5 commit 369ecf7

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/R2_alg.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ For advanced usage, first define a solver "R2Solver" to preallocate the memory u
132132
solver = R2Solver(reg_nlp)
133133
solve!(solver, reg_nlp)
134134
135-
stats = GenericExecutionStats(reg_nlp)
135+
stats = RegularizedExecutionStats(reg_nlp)
136136
solver = R2Solver(reg_nlp)
137137
solve!(solver, reg_nlp, stats)
138138
@@ -292,7 +292,7 @@ function R2(reg_nlp::AbstractRegularizedNLPModel; kwargs...)
292292
kwargs_dict = Dict(kwargs...)
293293
max_iter = pop!(kwargs_dict, :max_iter, 10000)
294294
solver = R2Solver(reg_nlp, max_iter = max_iter)
295-
stats = GenericExecutionStats(reg_nlp.model) # TODO: change this to `stats = GenericExecutionStats(reg_nlp)` when FHist etc. is ruled out.
295+
stats = GenericExecutionStats(reg_nlp.model) # TODO: change this to `stats = RegularizedExecutionStats(reg_nlp)` when FHist etc. is ruled out.
296296
cb = pop!(
297297
kwargs_dict,
298298
:callback,

src/utils.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export GenericExecutionStats
1+
export RegularizedExecutionStats
22

33
import SolverCore.GenericExecutionStats
44

@@ -32,9 +32,8 @@ Construct a GenericExecutionStats object from an AbstractRegularizedNLPModel.
3232
More specifically, construct a GenericExecutionStats on the NLPModel of reg_nlp and add three solver_specific entries namely :smooth_obj, :nonsmooth_obj and :xi.
3333
This is useful for reducing the number of allocations when calling solve!(..., reg_nlp, stats) and should be used by default.
3434
Warning: This should *not* be used when adding other solver_specific entries that do not have the current scalar type.
35-
For instance, when one adds the history of the objective value as a solver_specific entry (which has Vector{T} type), this will cause an error and `GenericExecutionStats(reg_nlp.model)` should be used instead.
3635
"""
37-
function GenericExecutionStats(reg_nlp :: AbstractRegularizedNLPModel{T, V}) where{T, V}
36+
function RegularizedExecutionStats(reg_nlp :: AbstractRegularizedNLPModel{T, V}) where{T, V}
3837
stats = GenericExecutionStats(reg_nlp.model, solver_specific = Dict{Symbol, T}())
3938
set_solver_specific!(stats, :smooth_obj, T(Inf))
4039
set_solver_specific!(stats, :nonsmooth_obj, T(Inf))

test/test_allocs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ end
4141
for solver (:R2Solver,)
4242
reg_nlp = RegularizedNLPModel(bpdn, h)
4343
solver = eval(solver)(reg_nlp)
44-
stats = GenericExecutionStats(reg_nlp)
44+
stats = RegularizedExecutionStats(reg_nlp)
4545
@test @wrappedallocs(solve!(solver, reg_nlp, stats)) == 0
4646
end
4747
end

0 commit comments

Comments
 (0)