diff --git a/tutorials/introduction-to-solverbenchmark/index.jmd b/tutorials/introduction-to-solverbenchmark/index.jmd index 09ef6b5..4ad5567 100644 --- a/tutorials/introduction-to-solverbenchmark/index.jmd +++ b/tutorials/introduction-to-solverbenchmark/index.jmd @@ -224,23 +224,22 @@ The tutorial covers how to use the problems from `OptimizationProblems` to run a ### Handling `solver_specific` in `stats` -If a solver's `GenericExecutionStats` contains a `solver_specific` dictionary, then when `bmark_solvers` processes the results it creates a column in the per-solver `DataFrame` for each key in that dictionary. These columns can then be analyzed and compared alongside the standard metrics such as `status` and `elapsed_time`. +If a solver's `GenericExecutionStats` contains a `solver_specific` dictionary, those values can be tabulated alongside the standard metrics such as `status` and `elapsed_time`. -Here is an example showing how to set a solver-specific flag so that it appears as a column in the resulting stats table and can be used for tabulation: +Here is an example showing how to populate `solver_specific` and place those fields in a stats table: ```julia -using NLPModelsTest, DataFrames, SolverCore, SolverBenchmark +using ADNLPModels, DataFrames, SolverCore -function newton(nlp) - stats = GenericExecutionStats(nlp) - set_solver_specific!(stats, :isConvex, true) - return stats -end - -solvers = Dict(:newton => newton) -problems = [NLPModelsTest.BROWNDEN()] -stats = bmark_solvers(solvers, problems) +nlp = ADNLPModel(x -> sum(x .^ 2), [1.0, 1.0]) +stats = SolverCore.GenericExecutionStats(nlp) +SolverCore.set_solver_specific!(stats, :isConvex, true) +SolverCore.set_solver_specific!(stats, :inner_iterations, 7) -# Access the solver-specific column `:isConvex` for the `:newton` solver -df_newton = stats[:newton] -df_newton.isConvex +df = DataFrame( + solver = ["newton"], + status = [stats.status], + isConvex = [stats.solver_specific[:isConvex]], + inner_iterations = [stats.solver_specific[:inner_iterations]], +) +pretty_stats(stdout, df) ```