mlubin / cmpb

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

add support for vartypes and test with pajarito #3

Closed mlubin closed 8 years ago

mlubin commented 8 years ago

CC @SteveDiamond Haven't tried from cvxpy yet, let's see if the C version passes travis.

mlubin commented 8 years ago

Doesn't seem to be passing with Pajarito 0.1.0, but is passing on master, so I'll tag a new release soon.

mlubin commented 8 years ago

All passing on travis now. @SteveDiamond, could you check if this works locally?

SteveDiamond commented 8 years ago

The C interface works for me. There are some issues with the Python cmpb interface that I fixed here: https://github.com/SteveDiamond/cmpb There are tests in python/test.py. I have a weird bug where Pajarito works if I only run the int_constr test, but the call to optimize! in int_constr throws an error if I run all the tests.

SteveDiamond commented 8 years ago

Ok, I figured out the issue. Pajarito works when it's inside the first mpb_initialize, mpb_atexit block. But it doesn't work if there have been previous calls to mpb_initialize then mpb_atexit. Is this expected behavior? The other solvers work if there have been previous calls to mpb_initialize then mpb_atexit.

mlubin commented 8 years ago

According to @yuyichao, it's not safe to use the julia environment for the rest of the program after the first call to atexit. (It is safe though to initialize multiple times.)

SteveDiamond commented 8 years ago

That makes things a bit difficult in cvxpy, since I don't when the user is finished calling the Julia solvers. What would happen if I never called atexit?

mlubin commented 8 years ago

What about registering the atexit call with python, e.g., https://docs.python.org/2/library/atexit.html

mlubin commented 8 years ago

As long as you free the model object you shouldn't need to worry about the memory footprint of the model hanging around, but I've seen some weird behavior if the program ends before calling julia's atexit.

SteveDiamond commented 8 years ago

Ok, everything works now. I submitted a pull request and I have Pajarito working on the julia_opt branch of cvxpy.