Closed IainNZ closed 10 years ago
Roger that!
Progress:
using JuMP
using ECOS
m = Model(solver=ECOSSolver())
@defVar(m, x[1:5])
@setObjective(m, Max, 3x[1] + 4x[2] + 4x[3] + 9x[4] + 5x[5])
@addConstraint(m, pos[i=1:5], x[i] >= 0)
@addConstraint(m, x[1] + x[2] <= 5)
@addConstraint(m, x[2] + x[5] <= 3)
@addConstraint(m, x[3] + x[4] + x[5] <= 9)
solve(m)
works (well, solves the right problem)
That's a good sign :) I honestly do not know what would be some interesting "corner cases" to try, but one idea I had is to rewrite some of the original ECOS tests using the conic interface. I can run the MATLAB examples from here and store the outputs in data files. Would this help?
Yes, that sounds like it would be great!
More tests is always good.
I'm hitting a wall extracting stuff from the problem type, i.e.
ecos_prob = unsafe_pointer_to_objref(ecos_prob_ptr)
dump(ecos_prob.x) # segfault
@mlubin any ideas?
I am also getting a segfault when trying to get the solution from the low-level interface. However, doing it like in the CVX implementation works:
using ECOS
include("~/.julia/v0.3/ECOS/test/runtests.jl")
work = pointer_to_array(mywork, 1)[1]
x = pointer_to_array(work.x, 223)
(In this case, I think a cleaner way of doing that would be work = unsafe_load(mywork, 1)
)
Thanks @jfsantos , that works!
Great, I'm glad that it helped! By the way, are you using an alternative branch of JuMP to test this? I'm getting started at translating the tests from MATLAB to your conic interface.
I'm using master version of JuMP, although release version would work. The interface I'm working on right now (that @joehuchette got started) is just the standard LP interface, not the conic interface. I've just got it working so I'm about to start implementing the conic interface. JuMP doesn't and probably won't use the conic interface, but CVX.jl will.
Alright, scratch it then. I mixed things up! None of the MATLAB examples for ECOS are LPs, so I'll wait for the conic interface.
Are there any QPs or SOCPs in the test set? We can use JuMP to model those.
Yes, there's a portfolio optimization problem written as a SOCP. I'll install Gurobi here and test it with JuMP for the time being. Thanks!
OK, so I have LP-as-conic-form done, now the more mind bending part of doing SOC :+1:
@mlubin or @joehuchette , if you are bored, can you add the generic methods to MathProgBase and bump the version?
Added, I'll bump it now.
Victory! Working up to :SOC cones, not worrying about rotated SOC right now. Main issues to resolve:
Now working on https://github.com/cvxgrp/CVX.jl/pull/19
OK done as much with CVX as I can figure out. Once this is a bit more robust I think it can be merged. Add some docs and maybe some more tests, then we can probably move to JuliaOpt
@IainNZ, the conic interface was meant to be flexible on the modeling side, and it's expected that the solver interfaces will likely need to maintain permutation vectors to put the cones into the expected order.
Righto then, shouldn't be too painful. Its been pretty good so far
OK I think I'm done! Almost ready for merge...
OK @jfsantos can you merge this. After you do, I'll add you as a (temporary) admin of JuliaOpt, which will allow you to transfer this package to JuliaOpt in the Settings page. We will then figure how to provide a binary on OSX, then announce it to the world.
We'd also love for you to join us in JuliaOpt if you're interested :)
Merged! Thank you very much for doing this.
I'm interested in joining JuliaOpt, thanks! After we move this repository to the organization you can downgrade my status from admin to something less "dangerous" :)
OK, you are now an "owner" of JuliaOpt. Let me know when you've moved it!
I think it is done! Travis still didn't catch up with the change, so let's wait for a few minutes to make sure everything is fine.
Fixed it, nice!
Don't merge yet, just keep open PR to easily track progress.
@mlubin @joehuchette @madeleineudell @karanveerm