Skip to content
Open
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
3 changes: 3 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ version = "0.2.0"

[deps]
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
JSOSolvers = "10dff2fc-5484-5881-a0e0-c90441020f8a"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
NLPModelsTest = "7998695d-6960-4d3a-85c4-e1bceb8cd856"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Weave = "44d3d7a6-8a23-5bf8-98c5-b353f8df5ec9"
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
Expand Down
32 changes: 32 additions & 0 deletions tutorials/introduction-to-solverbenchmark/index.jmd
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,35 @@ p = profile_solvers(stats, costs, costnames)
Here is a useful tutorial on how to use the benchmark with specific solver:
[Run a benchmark with OptimizationProblems](https://jso.dev/OptimizationProblems.jl/dev/benchmark/)
The tutorial covers how to use the problems from `OptimizationProblems` to run a benchmark for unconstrained optimization.

## Handling `solver_specific` in benchmark runs
If a solver's execution-stats object contains a `solver_specific` dictionary
(accessible as `s.solver_specific`), `solve_problems` will create columns for
each key in that dictionary in the per-solver `DataFrame`. (Note: `bmark_solvers`
forwards keyword arguments to each solver, so ensure your solver wrapper populates
`s.solver_specific` if you want those columns.)

Here is a example showing how to set a solver-specific flag and then access it for tabulation:
```julia
using NLPModelsTest, DataFrames, SolverCore, SolverBenchmark

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)

combined_stats = DataFrame(
name = stats[:newton].name,
nvars = stats[:newton].nvar,
convex = stats[:newton].isConvex,
newton_iters = stats[:newton].iter,
)

combined_stats.convex = string.(combined_stats.convex)
pretty_stats(combined_stats)
```