-
Notifications
You must be signed in to change notification settings - Fork 557
Add Gurobi Direct MINLP solver in contrib.solver #3745
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
base: main
Are you sure you want to change the base?
Conversation
… from Gurobi's perspective. Starting to write the gurobi walker modeled after the sympy one
…on visitor, no real tests to speak of yet though
…I try to get the constraint objects...
…ngs like AbsExpression, we can't rely completely on the expression evaluation visitor, and I need to know the types of expressions. Starting to build out tests of the walker.
…inear expression tree, yay!!
…ressions in the RHS
…sionExpressions from the writer
…ven matching version...
…ator overloading--putting the gurobi expressions first when constructing constraints
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3745 +/- ##
==========================================
+ Coverage 89.31% 89.35% +0.04%
==========================================
Files 896 897 +1
Lines 103687 104487 +800
==========================================
+ Hits 92609 93369 +760
- Misses 11078 11118 +40
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
# ESJ TODO: THIS IS COPIED FROM THE LINEAR WALKER--CAN WE PUT IT IN UTIL OR | ||
# SOMETHING? | ||
def check_constant(self, ans, obj): |
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.
@jsiirola I copied this over from the linear walker, but can we somehow centralize it?
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.
Answer: Promote to pyomo.core.expr
. And does it really need the visitor?
# ESJ TODO: Could we move this to util or somewhere less bizarre? | ||
from pyomo.contrib.cp.repn.docplex_writer import collect_valid_components |
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.
@jsiirola this is my other oddity: I kind of like this function, and we hid it in the docplex writer. Where should we put it?
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.
Ans: repn.util
, if it or something similar isn't already there.
Fixes #3522 (except for the request to have a persistent MINLP interface to Gurobi)
Summary/Motivation:
This adds a new solver interface
gurobi_direct_minlp
that supports sending MINLP problems to Gurobi via the Python API. currently this is implemented as a separate Gurobi direct interface incontrib.solver
so that we don't have negative performance implications forgurobi_direct_v2
(and to punt for the moment on integrating the matrix-vector inferface with the general MINLP one).Changes proposed in this PR:
aux_var == general_nonlinear_expr
equalities and linear/quadratic constraints involving the auxiliary and other variables.GurobiDirect
incontrib.solver
: The only thing special here is thesolve
function which is again just unique because of the custom walker/writer explained above.Outstanding TODOs, none of which should prevent merging unless we want them to:
gurobi_nl_to_pyo_expr
function, which will make them a lot more readable, and easier to maintain if every there is a change to the public API in gurobipy.Legal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: