[ExaModelsMOI] tidy up the MOI wrapper - #290
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #290 +/- ##
===========================================
- Coverage 80.80% 54.42% -26.38%
===========================================
Files 20 25 +5
Lines 2021 3886 +1865
===========================================
+ Hits 1633 2115 +482
- Misses 388 1771 +1383 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Benchmark Results |
Contributor
Author
BeforeAfterCodeusing Revise
using JuMP
import ExaModels
import KernelAbstractions
import NLPModelsIpopt
import PowerModels
PowerModels.silence()
function benchmark(filename::String, optimizer)
start_time = time()
pm = PowerModels.instantiate_model(
filename,
PowerModels.ACPPowerModel,
PowerModels.build_opf,
)
build_time = time()
set_optimizer(pm.model, optimizer; with_bridge_type = nothing)
optimize!(pm.model)
finish_time = time()
return (;
filename,
build_time = build_time - start_time,
solver_setup_time = finish_time - build_time - solve_time(pm.model),
solve_time = solve_time(pm.model),
total = finish_time - start_time,
objective_value = objective_value(pm.model),
)
end |
odow
commented
Aug 6, 2026
Contributor
Author
|
We should benchmark https://github.com/MadNLP/COPSBenchmark.jl |
Member
Contributor
Author
|
This is ticking along to be a nice win. Two runs of the 30k benchmark: ret = benchmark(
"/Users/odow/git/exanauts/ExaModels/test/pglib/pglib_opf_case30000_goc.m",
() -> ExaModels.Optimizer(NLPModelsIpopt.ipopt, KernelAbstractions.CPU()),
)Before(;
filename = "/Users/odow/git/exanauts/ExaModels/test/pglib/pglib_opf_case30000_goc.m",
build_time = 7.070135116577148,
solver_setup_time = 10.925534944793696,
solve_time = 87.794706125,
total = 105.79037618637085,
objective_value = 1.1423315687882672e6,
)
(;
filename = "/Users/odow/git/exanauts/ExaModels/test/pglib/pglib_opf_case30000_goc.m",
build_time = 5.016787052154541,
solver_setup_time = 5.8046203707885695,
solve_time = 84.870095625,
total = 95.69150304794312,
objective_value = 1.1423315687882672e6,
)After(;
filename = "/Users/odow/git/exanauts/ExaModels/test/pglib/pglib_opf_case30000_goc.m",
build_time = 6.841040134429932,
solver_setup_time = 9.776680946350098,
solve_time = 80.09886598587036,
total = 96.71658706665039,
objective_value = 1.1423315687882756e6,
)
(;
filename = "/Users/odow/git/exanauts/ExaModels/test/pglib/pglib_opf_case30000_goc.m",
build_time = 5.235661029815674,
solver_setup_time = 4.343807935714722,
solve_time = 77.17140507698059,
total = 86.75087404251099,
objective_value = 1.1423315687882756e6,
) |
The purpose of this rewrite is to: * simplify the implementation by removing the linked list * thoroughly document and comment the file to explain what is happening * add various improvements: split additive terms into separate constraint augmentations, support :(x - y), skip constants if they are 0.0, re-use variables in symbolic expressions * fix various bugs in the MOI wrapper * add many more tests
odow
marked this pull request as ready for review
August 11, 2026 21:52
Contributor
Author
|
Changed to the incremental MOI interface. Using this script. Note how it now uses import ExaModels
import NLPModelsIpopt
import PowerModels
PowerModels.silence()
function benchmark(filename::String, optimizer)
start_time = time()
ret = PowerModels.solve_opf(filename, PowerModels.ACPPowerModel, optimizer)
total_time = time() - start_time
return (;
filename,
total_time,
solve_time = ret["solve_time"],
overhead = total_time - ret["solve_time"],
objective_value = ret["objective"],
)
end
ret = benchmark(
"/Users/odow/git/exanauts/ExaModels/test/pglib/pglib_opf_case30000_goc.m",
() -> ExaModels.Optimizer(NLPModelsIpopt.ipopt),
)Before After |
6 tasks
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm taking a look to see if we can improve the JuMP -> ExaModels conversion. The first step is to tidy up the wrapper that is already there.
My other TODOs:
MOI.Test.runtestsI think we can support
MOI.add_constraint. We just need to keep thebinaround, and then we can convert it to anadd_conat runtime. This would save on a cache of the problem between the bridges and ExaModels. In my benchmarks below I have explicitlyadd_bridges = false.