-
Notifications
You must be signed in to change notification settings - Fork 87
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
Versatile model type #1261
Comments
I would be in favor of a new |
We would still have |
In the line of #1252 (comment), in case the solver wants the matrix to be column-wise, we could have a fallback implementation of |
@blegat: this, #1470 and #1502 are blocking for MOI 0.10. Can I ask that we either set a timeline ASAP for getting these implemented and merged. Or, more preferably, decide to delay these until MOI 1.x? A |
Currently, MOI only provides one implementation of model:
MOIU.AbstractModel
that are created withMOIU.@model
with the common choice ofMOIU.Model
.This represents models in the following way:
We have a struct containing:
SingleVariable
,ScalarAffineFunction
orScalarQuadraticFunction
SingleVariable
constraintsThis is useful to use as the cache used by JuMP to store the model as it gives good performance for all MOI operations. However, when copying this model to a solver, some work should be done by the solver to transfrom it into its canonical form.
If we look at it more closely, the form required by the solvers are a combination of the following:
SingleVariable
constraintsVectorAffineFunction
-in-Zeros
and one forVectorAffineFunction
-in-K
in other conesK
.LP solvers such as Clp, GLPK, HiGHS need all the constraints mixed up in a single matrix stored either row-wise or column-wise.
If we refactor
AbstractModel
, it could cover all these use case, simply by being parametrized by:SingleVariable
constraintsThis third type is either
VectorOfConstraints
: Refactor Model and UniversalFallback #1245MatrixOfConstraints
in either aMutableSparseMatrixCSC
or aTranspose{<:MutableSparseMatrixCSC}
. ForMutableSparseMatrixCSC
, incrementally adding the constraints is not supported. See https://github.com/jump-dev/MatrixOptInterface.jl/blob/master/src/sparse_matrix.jl for what it would look likeThen, each solver would be able to significantly simplify it's copy_to function by doing, e.g. LP solvers could do
In order to drastically increase the chance a
MODEL
is copied to the solver, we could add an MOI attribute and replaceUtilities.Model{with_bridge_type}()
inMathOptInterface.jl/src/instantiate.jl
Line 122 in e9b03cb
by
MOI.get(optimizer, MOI.PreferedModelType())()
.The result of all this is two-fold:
copy_to
for solver wrappers and ensure they are all efficiently optimizedcopy_to
as the cache of theCachingOptimizer
will already contain the data in the right form.The text was updated successfully, but these errors were encountered: