-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds support for MOI.AbstractOptimizer that do not support MOI.NLPBlock #381
Adds support for MOI.AbstractOptimizer that do not support MOI.NLPBlock #381
Conversation
Codecov Report
@@ Coverage Diff @@
## master #381 +/- ##
==========================================
- Coverage 27.89% 23.44% -4.45%
==========================================
Files 34 36 +2
Lines 1678 2026 +348
==========================================
+ Hits 468 475 +7
- Misses 1210 1551 +341
... and 4 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
a6d69cf
to
a143979
Compare
builds on #400 |
230fe1d
to
37f38f2
Compare
1aa0395
to
74da67d
Compare
f4d9cb5
to
5606df3
Compare
This is pretty awesome. @Vaibhavdixit02 are you reviewing this? |
Yes |
No idea why the docs fail. There is no such |
It does run the branch |
8de3788
to
95db4c4
Compare
I think it is not. I added the exact same code to the tests and they pass but the docs not. |
Still, I think the docs are not built with this branch. The only place the error can be from is this: https://github.com/SciML/Optimization.jl/blob/master/lib/OptimizationMOI/src/OptimizationMOI.jl#L219 |
what's status now? |
It needs review and the conflicts need to be resolved. |
@@ -5,9 +5,11 @@ version = "0.1.7" | |||
|
|||
[deps] | |||
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" | |||
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this dependecy?
@ValentinKaisermayer this seems to based off on the caching PR but that's marked as draft still, can you clean that up and we will merge that and then this? |
expr_map = get_expr_map(prob.f.sys) | ||
expr = repl_getindex!(convert_to_expr(MTK.subs_constants(MTK.objective(prob.f.sys)), | ||
prob.f.sys; expand_expr = false, expr_map)) | ||
|
||
cons = MTK.constraints(prob.f.sys) | ||
cons_expr = Vector{Expr}(undef, length(cons)) | ||
Threads.@sync for i in eachindex(cons) | ||
Threads.@spawn cons_expr[i] = repl_getindex!(convert_to_expr(Symbolics.canonical_form(MTK.subs_constants(cons[i])), | ||
prob.f.sys; | ||
expand_expr = false, | ||
expr_map)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MTK is needed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although both are in the prob.expr
and prob.cons_expr
, the parameters are replaced in MTK:
https://github.com/SciML/ModelingToolkit.jl/blob/master/src/systems/optimization/optimizationsystem.jl#L497-L498
what's status now? can merge this ? |
It doesn't pass tests if I'm not mistaken. |
@ValentinKaisermayer can you take a look at the Codecov warnings, it seems to be a lot so I am worried (also kind of making reviewing the MOI file painful) |
robustifies MOI term collection fix fix fix format do the expression expansion ourselfs adds returncode handling format make sure that simplify returns eventually expand quad expressions dont call on operator changes @asserts to meaningfull exceptions error early if NaN or Inf is in an expression adds test adds opt fix test use process_p_u0_symbolic formatting
5f4b05e
to
322c625
Compare
I'm pretty certain that the codevov is broken. It marks essentially every line as not hit, but the tests pass, that is not possible. |
Yes, Codecov has issues that won't be fixed here. That shouldn't get in the way of the review. |
I took it from here, but ok. |
That should probably also using |
Oh wait, there the reason is that |
A concretized cache can have a |
Also |
Okay that makes sense, I'll dismiss my comments above. |
🎉 Very happy this is in. Though what's missing is tutorials on these new features. This and the integer support is not documented anywhere. The docs really need to get up to speed. |
Really great work @ValentinKaisermayer! |
This adds a caching interface for MOI solvers as well as simple (only linear and quadratic objective and constraints with possible integer variables) support for MOI solvers that do not support the NLBlock interface, e.g. Gurobi or HiGHS.
reinit!
to work properly (later) Keep pars in expr ModelingToolkit.jl#1901see also SciML/ModelingToolkit.jl#1786