Skip to content

Commit 41937e0

Browse files
committed
adding failing reset!
1 parent 8a7891c commit 41937e0

2 files changed

Lines changed: 18 additions & 14 deletions

File tree

tutorials/introduction-to-solverbenchmark/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[deps]
22
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
33
NLPModelsTest = "7998695d-6960-4d3a-85c4-e1bceb8cd856"
4+
NLPModels = "a4795742-8479-5a88-8948-cc11e1c8c1a6"
45
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
56
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
67
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee"
@@ -12,6 +13,7 @@ SolverCore = "ff4d7338-4cf1-434d-91df-b86cb86fb843"
1213

1314
DataFrames = "1.3.4"
1415
NLPModelsTest = "0.9"
16+
NLPModels = "0.20"
1517
Plots = "1.31.7"
1618
PyPlot = "2.10.0"
1719
SolverBenchmark = "0.5.3"

tutorials/introduction-to-solverbenchmark/index.jmd

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -228,18 +228,20 @@ If a solver's `GenericExecutionStats` contains a `solver_specific` dictionary, t
228228

229229
Here is an example showing how to populate `solver_specific` and place those fields in a stats table:
230230
```julia
231-
using ADNLPModels, DataFrames, SolverCore
232-
233-
nlp = ADNLPModel(x -> sum(x .^ 2), [1.0, 1.0])
234-
stats = SolverCore.GenericExecutionStats(nlp)
235-
SolverCore.set_solver_specific!(stats, :isConvex, true)
236-
SolverCore.set_solver_specific!(stats, :inner_iterations, 7)
237-
238-
df = DataFrame(
239-
solver = ["newton"],
240-
status = [stats.status],
241-
isConvex = [stats.solver_specific[:isConvex]],
242-
inner_iterations = [stats.solver_specific[:inner_iterations]],
243-
)
244-
pretty_stats(stdout, df)
231+
import NLPModels: reset!
232+
using NLPModelsTest, DataFrames, SolverCore, SolverBenchmark
233+
234+
function newton(nlp)
235+
stats = GenericExecutionStats(nlp)
236+
set_solver_specific!(stats, :isConvex, true)
237+
return stats
238+
end
239+
240+
solvers = Dict(:newton => newton)
241+
problems = [NLPModelsTest.BROWNDEN()]
242+
stats = bmark_solvers(solvers, problems)
243+
244+
# Access the solver-specific column `:isConvex` for the `:newton` solver
245+
df_newton = stats[:newton]
246+
df_newton.isConvex
245247
```

0 commit comments

Comments
 (0)