Skip to content

Commit 500f0cc

Browse files
committed
up benchmark
1 parent bba43b4 commit 500f0cc

2 files changed

Lines changed: 19 additions & 15 deletions

File tree

benchmark/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
99
NLPModels = "a4795742-8479-5a88-8948-cc11e1c8c1a6"
1010
NLPModelsJuMP = "792afdf1-32c1-5681-94e0-d7bf7a5df49e"
1111
OptimizationProblems = "5049e819-d29b-5fba-b941-0eee7e64c1c6"
12+
PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d"

benchmark/benchmarks.jl

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,27 @@ SUITE["ADNLPProblems"]["NLP"] = BenchmarkGroup()
2020
SUITE["ADNLPProblems"]["NLP"]["constructor"] = BenchmarkGroup()
2121
SUITE["ADNLPProblems"]["NLP"]["obj"] = BenchmarkGroup()
2222
for pb in list_problems_ADNLPProblems
23-
SUITE["ADNLPProblems"]["NLP"]["constructor"][pb] =
24-
@benchmarkable eval(Meta.parse("OptimizationProblems.ADNLPProblems.$pb()"))
25-
SUITE["ADNLPProblems"]["NLP"]["obj"][pb] = @benchmarkable obj(nlp, nlp.meta.x0) setup =
26-
(nlp = eval(Meta.parse("OptimizationProblems.ADNLPProblems.$pb()")))
23+
problem_constructor = getproperty(OptimizationProblems.ADNLPProblems, Symbol(pb))
24+
SUITE["ADNLPProblems"]["NLP"]["constructor"][pb] = @benchmarkable $(problem_constructor)()
25+
SUITE["ADNLPProblems"]["NLP"]["obj"][pb] = @benchmarkable obj(nlp, nlp.meta.x0) setup = (nlp = $(problem_constructor)())
2726
end
2827

2928
SUITE["ADNLPProblems"]["NLS"] = BenchmarkGroup()
30-
for pb in
31-
intersect(Symbol.(meta[meta.objtype .== :least_squares, :name]), list_problems_ADNLPProblems)
32-
SUITE["ADNLPProblems"]["NLS"]["constructor"] =
33-
@benchmarkable eval(Meta.parse("OptimizationProblems.ADNLPProblems.$pb(use_nls = true)"))
34-
SUITE["ADNLPProblems"]["NLS"]["obj"] = @benchmarkable obj(nlp, nlp.meta.x0) setup =
35-
(nlp = eval(Meta.parse("OptimizationProblems.ADNLPProblems.$pb(use_nls = true)")))
29+
SUITE["ADNLPProblems"]["NLS"]["constructor"] = BenchmarkGroup()
30+
SUITE["ADNLPProblems"]["NLS"]["obj"] = BenchmarkGroup()
31+
list_problems_nls_ADNLPProblems = intersect(Symbol.(OptimizationProblems.meta[OptimizationProblems.meta.objtype .== :least_squares, :name]), list_problems_ADNLPProblems)
32+
for pb in list_problems_nls_ADNLPProblems
33+
problem_constructor = getproperty(OptimizationProblems.ADNLPProblems, Symbol(pb))
34+
SUITE["ADNLPProblems"]["NLS"]["constructor"][pb] = @benchmarkable $(problem_constructor)(use_nls = true)
35+
SUITE["ADNLPProblems"]["NLS"]["obj"][pb] = @benchmarkable obj(nlp, nlp.meta.x0) setup = (nlp = $(problem_constructor)(use_nls = true))
3636
end
3737
SUITE["PureJuMP"] = BenchmarkGroup()
38-
for pb in list_problems_ADNLPProblems
39-
SUITE["PureJuMP"]["constructor"] =
40-
@benchmarkable eval(Meta.parse("OptimizationProblems.PureJuMP.$pb()"))
41-
SUITE["PureJuMP"]["obj"] = @benchmarkable obj(nlp, nlp.meta.x0) setup =
42-
(nlp = MathOptNLPModel(eval(Meta.parse("OptimizationProblems.PureJuMP.$pb()"))))
38+
SUITE["PureJuMP"]["constructor"] = BenchmarkGroup()
39+
SUITE["PureJuMP"]["obj"] = BenchmarkGroup()
40+
for pb in list_problems_PureJuMP
41+
problem_constructor = getproperty(OptimizationProblems.PureJuMP, Symbol(pb))
42+
SUITE["PureJuMP"]["constructor"][pb] = @benchmarkable $(problem_constructor)()
43+
SUITE["PureJuMP"]["obj"][pb] = @benchmarkable obj(nlp, nlp.meta.x0) setup = (
44+
nlp = MathOptNLPModel($(problem_constructor)())
45+
)
4346
end

0 commit comments

Comments
 (0)