mlubin / cmpb

Prototype C interface to MathProgBase.jl
MIT License
5 stars 2 forks source link

cvxpy interface works #2

Open SteveDiamond opened 8 years ago

SteveDiamond commented 8 years ago

I got the cvxpy to call ECOS and SCS via this package in the cvxpy julia_opt branch. The tests are in cvxpy/tests/test_julia_opt.py.

Let me know if it works for you guys.

mlubin commented 8 years ago

Looks great! Only syntax issue that might need a bit more thought is for when we compose solvers. For example the conic <-> nonlinear wrapper at https://github.com/mlubin/ConicNonlinearBridge.jl (which is still a bit broken) requires more than one julia package to be imported before being used, e.g.,

using ConicNonlinearBridge, Ipopt

and then the "name" of the conic solver is ConicNLPWrapper(IpoptSolver()). Similarly, for Pajarito the MILP and conic solvers are also input options. You could hack around this by first calling

mpb_new_solver("Gurobi","GurobiSolver()", &solver);

and then calling

mpb_new_solver("Pajarito","PajaritoSolver(milp_solver=GurobiSolver())", &solver);

but that's a bit ugly. A better approach would probably be to have a function in the API just to import julia packages without creating a solver. Another solution which isn't too weird is to just do:

mpb_new_solver("Gurobi, Pajarito","PajaritoSolver(milp_solver=GurobiSolver())", &solver);
mlubin commented 8 years ago

Ok, with https://github.com/mlubin/cmpb/commit/26c2b6a30b5f597513d72bb9823f7b7ee93f3b9f the comma-separated syntax above should work just fine. No need to change anything else.

SteveDiamond commented 8 years ago

Is the cvxpy interface to Pajarito working for you? I was testing it out and had some issues.

mlubin commented 8 years ago

Currently at a conference but I'll try it out later this week

mlubin commented 8 years ago

Sorry, will definitely get to it this week.

mlubin commented 8 years ago

Ok, got most everything set up but running into:

SolverError: The solver JULIA_OPT is not installed.

How do I point it to the libcmpb.so file?

An obvious reason why Pajarito wouldn't be working yet is that there's no API in cmpb to pass in variable categories (binary, int, etc.), but that should be easy to do once everything else is going.

SteveDiamond commented 8 years ago

That error means import cmpb failed in Python. Did you run python setup.py install for cmpb?