-
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
API idea #6
Comments
I like this idea, and I agree that the API could use some revision. This actually alleviates a bit the need to have solver-independent parameters, because the user could store multiple solver objects, e.g.
and change solvers by passing in different objects. One issue is the name clash. I don't think it's a great idea for the The second issue, which is a bit more important, is that users shouldn't need to know about different solvers, there should be a reasonable default. At the same time, making the solver explicit in the function call could encourage people to experiment with different solvers, which is always a good thing. I could be convinced either way about this, but I'm in favor of making the MathProgBase code a bit more complex by storing a default solver so that users can make simple calls to @carlobaldassi @lindahua, any feedback? |
I generally agree with your comments. I feel it is the right API to have solver types while proving a default solver. |
Also until JuliaLang/julia#2327 is resolved, I think we should shy away from using a name like |
@daviddelaat, I've pushed a change that partially implements your proposal. Let me know what you think about it. |
@mlubin: Thanks! That looks very nice, exactly what I mean. I posted in JuliaLang/julia#4345 about the |
BTW, just for reference, here is a very incomplete solve based interface in SemidefiniteProgramming.jl: https://github.com/daviddelaat/SemidefiniteProgramming.jl/blob/master/src/solvers.jl |
@daviddelaat just so you know, we are still interested in incorporating SDP into JuMP - we're just trying to get it right first time in a non-hacky way that meshes nicely with LP/MIP/NLP/etc |
@lindahua successfully motivated me to clean up this mess :). On the
I've implemented this in Clp.jl and Cbc.jl. To get a sense of what it looks like, see: https://github.com/mlubin/Clp.jl/blob/newapi/src/ClpSolverInterface.jl#L43. Let me know what you guys think (@daviddelaat, @carlobaldassi). Hopefully we can settle down on a stable API and close this issue. |
@mlubin I am happy with your new design. Except that I am not completely comfortable with the name What about the following naming changes:
In this way, the function |
That's a good logical distinction with much cleaner names than I came up with. I'll make these changes, and unless there are any other objections, I'll merge in a day or so. |
The |
GLPK is now complying with the new API. Miles, when you bump MathProgBase in METADATA, can you please also bump GLPKMathProgInterface at the same time? (And probably Gurobi, if it's ready.) In this way people updating will continue to see things working, more or less. |
Thanks for quickly implementing this, Carlo. I'll be sure to bump everything together. |
This has all be pushed to metadata now. |
Thanks a lot Miles. What do you guys think about finally moving away from v0.0.0? It seems to me that the API and docs shape is now good enough for this. Also, I'm using this stuff on a regular basis at work, and I suspect others are in the same situation; having some degree of stability would help a lot I think, especially collaboration with coworkers. |
You can go ahead and tag v0.1.0, I think we're ready. |
v0.1.0 tagged! |
congrats! |
Nice! |
This is just an API idea I was having: Instead of having functions like linprog, mixintprog, setmipsolver, etc, there could also be one method
solve(problem, solver)
with immutable problem and solver types.Example:
Instead of writing
one would write
MathProgBase.jl would then provide the immutable types LP, MIP, LinprogSolution, etc, and GLPK.jl would depend on MathProgBase.jl and provide the immutable type GLPK as well as the functions
solve(problem::LP, solver::GLPK)
andsolve(problem::MIP, solver::GLPK)
.The text was updated successfully, but these errors were encountered: