Ipopt.jl
Ipopt.jl copied to clipboard
Rebuild IpoptProblem only if modified
Part of https://github.com/jump-dev/JuMP.jl/issues/1185 x-ref https://github.com/jump-dev/JuMP.jl/pull/3018
For @ccoffrin's PF example: https://github.com/lanl-ansi/nlp-jump-examples/pull/9 (private link at present)
Without this PR
julia> @time bench_pf_nlparameter(case="pglib_opf_case2000_goc.m", n = 100)
83.591282 seconds (225.00 M allocations: 34.441 GiB, 14.97% gc time, 1.07% compilation time)
With this PR
julia> @time bench_pf_nlparameter(case="pglib_opf_case2000_goc.m", n = 100)
21.147063 seconds (27.64 M allocations: 1.517 GiB, 4.47% gc time)
Codecov Report
Merging #321 (5028dd9) into master (5bf1161) will increase coverage by
0.12%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #321 +/- ##
==========================================
+ Coverage 91.39% 91.52% +0.12%
==========================================
Files 4 4
Lines 732 743 +11
==========================================
+ Hits 669 680 +11
Misses 63 63
Impacted Files | Coverage Δ | |
---|---|---|
src/MOI_wrapper.jl | 88.78% <100.00%> (+0.30%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
A nice improvement for such minor updates.
It's actually not so straightforward, because it relies on https://github.com/jump-dev/JuMP.jl/pull/3018#issuecomment-1186677741. And it isn't obvious whether we need to call MOI.initialize
if a parameter changes.
Regardless of the JuMP change, this is still a win if you want to repeatedly solve the same problem with different primal/dual starting points.
@odow good point! I had not noticed the JuMP change that is required.
This does't solve the JuMP issue, because that needs changes in MOI/JuMP, but this is an uncontroversial change in Ipopt that still improves things somewhat (we don't rebuild if you want to change the starting point and re-optimize).
Still there are some good uses cases of this. Like multi-start inside of MINLP algorithms.
Like multi-start inside of MINLP algorithms.
Yes, this is exactly what I had in mind.