-
Notifications
You must be signed in to change notification settings - Fork 38
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
separate model
types
#73
Comments
Just so I have this straight, this is the MathProgBase lower-case Somewhat related, in putting QP/QCQP support into CoinOptServices it was pretty apparent that quadratic objectives and constraints are sort of tacked onto the LP API in a not-so-elegant way, a dedicated |
Yes, this is |
At least for LP, QP, and QCQP there's an obvious hierarchy where there's one obvious choice for an MIQCQP data structure which could represent all 6 combinations with either I found myself doing a lot of checking whether quadratic objectives and/or quadratic constraints were empty and was never really happy with it - kind of a code smell that feels against the spirit of multiple dispatch (and might make LP's slower), but we also don't have an easy way of inheriting and extending from concrete types. The objective and linear part of a QCQP could be put in a QP data structure as a subfield of the QCQP type, and the linear part of a QP could be put in an LP data structure as a subfield of the QP type, but this also feels wrong. |
At the same time, I don't think a pure LP solver should have to deal with or worry about data structures which have quadratic terms. It doesn't feel right to say that LP and MIP are special cases of MIQCQP. |
I'd like to revisit this. I propose to separate out into Regarding the name of the |
I have to disagree with
I think that's far more accurate than putting "linear" in the name for a data structure that you're using for MIQCQP. |
Fair enough, but let's leave the |
It could be |
Which is only slightly a misnomer because you can pass SOCP constraints through the interface. |
Maybe instead of trying to name them based on problem classes, name them based on the data structures they're using? MatrixProblem, ConeProblem, ExprProblem? ConeProblem is a bit of a generalization of MatrixProblem with additional data and classes of constraints that it can cover. |
I like the idea, needs a bit more bikeshedding. ExprProblem seems a bit off for derivative-based NLP solvers though, and MatrixProblem isn't really self explanatory. |
To me, it seems conceptually simpler to think about types of problem The model instance might have a distinct type for every solver, and would Other functions, like getconstrduals, would be renamed to refer to This allows for a more complex world of models with non-hierarchical On Thu, Nov 19, 2015 at 12:38 PM, Miles Lubin [email protected]
Madeleine Udell |
I agree that keeping track of quadratic, conic, etc constraints separately from linear makes a lot of sense in giving a cleaner internal implementation. The current MPB design for quadratic problems seems a bit overly driven by the CPLEX/Gurobi API. |
We've been tailoring the interface in MPB for solvers as they are and not as we'd like them to be :). I'm all in favor of smashing the hierarchy, but I'm very hesitant to design an abstraction for solvers that don't exist yet. We just don't know what input format might be ideal for a conic+NLP solver. I could see splitting out linear/QP/conic constraints (we already split linear and quadratic), and leaving NLP on its own for now. The more concrete problem is that we need a design for how to deal with transformations when the solver itself doesn't directly support the input format, e.g. Gurobi/CPLEX don't accept conic constraints in natural conic format, and ECOS/SCS don't support variable bounds directly. There are no solvers which support conic+quadratic constraints in the same problem without some transformation. These transformations are annoying to write, and we shouldn't force each solver wrapper to implement them from scratch. My proposal was to categorize the solvers according to the input format that they do accept (e.g. Gurobi/CPLEX LP++ style versus conic form) and then have some standard transformation code that can take any conic solver and turn it into an LP solver, for example. Another example is NLP solvers, which can act as LP or QCQP solvers after some transformation. The motivation for these three problem classes is really just to make this transformation process tractable and not to provide an ideal interface for mathematical programming, which can be done on top of this plumbing code. |
We don't have PENNON http://www.penopt.com hooked up, but it certainly exists and straddles the divisions here. |
Does PENNON have any publicly available documentation? Can't find it. |
Smash the hierarchy! (Oh sorry; wrong internet forum.) I'd want to use two levels of abstraction to do what Miles suggests. The Then we'd have a bunch of translator functions for mapping between sorts of On Thu, Nov 19, 2015 at 1:49 PM, Miles Lubin [email protected]
Madeleine Udell |
You apparently have to fill out a form to get the code, but
says it's GPL - http://web.mat.bham.ac.uk/kocvara/penlab. Have not looked at it in any depth though, so don't know how much is done in Matlab code vs mex files that we could maybe adapt more easily. I think I skimmed some of the associated papers at some point. |
That's almost what a JuMP model is right now.
That logic is in JuMP already. |
One possible conclusion, then, is that JuMP is an abstraction sitting on On Thu, Nov 19, 2015 at 5:48 PM, Miles Lubin [email protected]
Madeleine Udell |
Quite possibly, unless they only care exclusively about LPs or conic problems. |
Closed by #91 |
The abstraction is a getting a bit crowded with methods overloaded to mean different things depending on the sequence of operations you perform on a model object. E.g., if you load a nonlinear problem, then
getconstrduals
returns the multipliers for all constraints, while if you load a linear problem, it returns the multipliers for the linear constraints. A similar issue leads to jump-dev/JuMP.jl#472 where you're only allowed to callsetquadobj!
afterloadproblem!
but not afterloadnonlinearproblem!
. I think we should be a bit more careful about solver features (jump-dev/JuMP.jl#83).Concrete proposal:
Define a finite list of problem classes which a solver might support, and force users to request the features that they need as arguments to
model()
. Example:or
Having these as arguments to
model
lets the solver wrapper potentially return different types depending on the input. The major problem classes might beLP
,Conic
, andNonlinear
. These are meant to be very broad but capture the different styles of input that we currently support. Further distinctions can be made by usingapplicable
as we do now. (Extra bonus if we can resolve theGLPKSolverMIP
/GLPKSolverLP
split.) These changes would most directly affect JuMP; Convex.jl shouldn't need more than a couple lines of code tweaked.CC @carlobaldassi @tkelman @madeleineudell
The text was updated successfully, but these errors were encountered: