-
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
Questions implementing a wrapper #71
Comments
Maybe with plural: |
We can't prevent a solver from recognizing the constraint, but no (#64).
It's one function per set in MOI.
Up to the discretion of whoever is writing the MOI wrapper. Keep in mind that eventually there will be a desire for a standalone and feature complete CPLEX wrapper (#22). It's not our job to do that, but removing existing wrappers for C functions that aren't used in MOI seems unnecessary. It's fine with me to remove higher-level helper functions that aren't needed for MOI. |
|
Not to my knowledge. You could store the constraints in a MathOptInterfaceUtilities's Instance until you figure out which setup you need and then you set up the solver, load the constraints and throw the instance away. |
To keep MOI generic the type of the model, in my opinion, should be just an optional argument. For some model types like LPs where there is no variable type and only linear constraints, it could be nice for the solver to know it. CLP for example has: LinearQuadraticModel(s::ClpSolver) = ClpMathProgModel(;s.options...)
ConicModel(s::ClpSolver) = LPQPtoConicBridge(LinearQuadraticModel(s)) For Cplex I think that if you declare the problem as LP you can't add integer variables afterwards. MOIU despite adding an intermediary layer doesn't solve the issue because it doesn't tell you anything about what the user is planning to add after the EDIT: |
This may be a partial answer to my question, for solvers which rely on MOIU https://github.com/JuliaOpt/MathOptInterfaceUtilities.jl/blob/master/src/instance.jl#L229 |
For stuff being added after |
CLP has multiple solvers? |
One solver but two possible models (solver instances) |
We can maybe use a cplex example of the function to be called by the attribute setter: And if a solver needs the problem type before creating the instance we can create the instance only on julia side and delay calling the true constructor until the attribute has been set. |
If we force everyone to specify a "problem type" when calling
|
I don't have a good understanding of what CPLEX's problem type actually means. Using a |
CPLEX's problem type is used to dispatch on different optimize calls. For instance, if the problem type is MILP, a call to |
@odow I was looking at the latest CPLEX MOI. It seems that there is a lot of work around exposing all the MOI flexibility which differs from MPB that was much simpler. You have written the code so that it is explicit when you use a cplex function. I listed most of them here https://gist.github.com/joaquimg/e793e5a0677d77b0e190df556f58e178 Many of them map DIRECTLY into some functions of Xpress and Gurobi. And some other need simple adaptations. What do you think about having a intermediate package (SomeCleverNameOptInterface) to make it easier to wrap the 3 of them in MOI? just like SOI does for its solvers... Specific corner cases could be handled by the wrappers (CPLEXMathOptInterface...) |
If I copy what you have done and change a few functions I get 90% of the functionality... |
I'm a bit busy writing up bits of my thesis for a few weeks., but this seems sensible. |
I started the experiment: https://github.com/joaquimg/LinQuadOptInterface.jl The Xpress version is in LQOI branch in Xpress.jl and the CPLEX version consists of simply replacing "lqs" by "cpx" |
I am glad to see that much of the code can be shared between the LQ solvers ! The name LinQuadOptInterface seems fine to me, it is consistent with SOI. I wonder if GLPK and Clp can use LQOI. |
This discussion seems mostly resolved. |
* Update LP format to sanitise variable names. Code ported from LPWriter.jl, changed regex API so it runs in Julia 1.1. Other changes: constraints must have a "=" sign, say CPLEX and lp_solve; add an End keyword, says CPLEX. * Add a test case for the name sanitisation. * Adding more test cases, ported from LPWriter. * @odow's nit-picking :). * Implement a name cache. Based on https://stackoverflow.com/a/33783534 * Rework the cache mechanism to pass it as an argument. * Handle created duplicate names in sanitisation. * Ensure the generated names are never too long.
I'm going to use this issue as a collection place for a range of questions I have implementing the CPLEX solver wrapper:
On the purpose of low-level interface
On variable bounds
addconstraint!(m, v::VectorOfVariables, set::LessThan{Float64})
a valid constraint? oOaddconstraint!(m, v::VectorOfVariables, set::Vector{Union{LessThan{Float64}, GreaterThan{Float64}, EqualsTo{Float64}, Interval{Float64}}})
be a valid constraint so users can set bounds all at once? No.Overload the broadcast operator performance hints #63 (comment)performance hints #63 (comment)The text was updated successfully, but these errors were encountered: