Skip to content

Commit d11d0f6

Browse files
committed
fix: Simplify some doctests
Changes in SolverBenchmark made the doctests break when comparing the output of bmark_solvers. This discard the logging from bmark_solvers to avoid this error. Closes #141
1 parent e4c7b59 commit d11d0f6

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

src/bmark-solvers.jl

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,19 @@ All the remaining keyword arguments are passed to the function `SolverBenchmark.
2828
# Examples
2929
3030
```jldoctest; output = false
31-
using ADNLPModels, JSOSuite, SolverBenchmark
31+
using ADNLPModels, JSOSuite, Logging, SolverBenchmark
3232
nlps = (
3333
ADNLPModel(x -> 100 * (x[2] - x[1]^2)^2 + (x[1] - 1)^2, [-1.2; 1.0]),
3434
ADNLPModel(x -> 4 * (x[2] - x[1]^2)^2 + (x[1] - 1)^2, [-1.2; 1.0]),
3535
)
3636
names = ["LBFGS", "TRON"] # see `JSOSuite.optimizers.name` for the complete list
37-
stats = bmark_solvers(nlps, names, atol = 1e-3, verbose = 0, colstats = [:name, :nvar, :ncon, :status])
37+
stats = with_logger(NullLogger()) do
38+
bmark_solvers(nlps, names, atol = 1e-3, colstats = [:name, :nvar, :ncon, :status])
39+
end
3840
keys(stats)
3941
4042
# output
4143
42-
[ Info: Name nvar ncon status
43-
[ Info: Generic 2 0 first_order
44-
[ Info: Generic 2 0 first_order
45-
[ Info: Name nvar ncon status
46-
[ Info: Generic 2 0 first_order
47-
[ Info: Generic 2 0 first_order
4844
KeySet for a Dict{Symbol, DataFrames.DataFrame} with 2 entries. Keys:
4945
:TRON
5046
:LBFGS
@@ -63,20 +59,13 @@ names = ["LBFGS", "TRON"] # see `JSOSuite.optimizers.name` for the complete list
6359
other_solvers = Dict{Symbol, Function}(
6460
:test => nlp -> lbfgs(nlp; mem = 2, atol = 1e-3, verbose = 0),
6561
)
66-
stats = bmark_solvers(nlps, names, other_solvers, atol = 1e-3, verbose = 0, colstats = [:name, :nvar, :ncon, :status])
62+
stats = with_logger(NullLogger()) do
63+
bmark_solvers(nlps, names, other_solvers, atol = 1e-3, colstats = [:name, :nvar, :ncon, :status])
64+
end
6765
keys(stats)
6866
6967
# output
7068
71-
[ Info: Name nvar ncon status
72-
[ Info: Generic 2 0 first_order
73-
[ Info: Generic 2 0 first_order
74-
[ Info: Name nvar ncon status
75-
[ Info: Generic 2 0 first_order
76-
[ Info: Generic 2 0 first_order
77-
[ Info: Name nvar ncon status
78-
[ Info: Generic 2 0 first_order
79-
[ Info: Generic 2 0 first_order
8069
KeySet for a Dict{Symbol, DataFrames.DataFrame} with 3 entries. Keys:
8170
:test
8271
:TRON

0 commit comments

Comments
 (0)