cvxgrp / qcml

A Python parser for generating Python/C/Matlab solver interfaces
Other
42 stars 9 forks source link

Issue building with ECOS #53

Closed dgrnbrg closed 7 years ago

dgrnbrg commented 7 years ago

Hello, I'm trying to build qcml to work with ECOS, and I'm unable to get the ECOS tests to pass. The error I get is:

$ cc -O3 main.c -L~/ecos -I~/ecos/include -I~/ecos/external/SuiteSparse_config -lecos -lm test_problem.o qcml_utils.o -o main
main.c:27:34: error: too few arguments to function call, expected 16, have 15
        data->c, data->h, data->b);
                                 ^
~/ecos/include/ecos.h:258:1: note: 'ECOS_setup' declared here
pwork* ECOS_setup(idxint n, idxint m, idxint p, idxint l, idxint ncones, idxint* q, idxint nex,
^
1 error generated.

After digging into the code and comparing the function signature & invocation, it looks like ECOS_setup has an additional parameter, idxint nex, which isn't supplied by the code that qcml generates. Do you have any suggestions for how to fix this?

Thank you!

adomahidi commented 7 years ago

This is the number of exponential cones in the problem, you should be able to safely put this to 0 when using qcml, or build ecos with the EXPCONE symbol undefined.

dgrnbrg commented 7 years ago

I commented out the definition of EXPCONE in ecos's include/glblopts.h, but the nex still appears in the signature of ECOS_setup. Is there a different way to disable EXPCONE, or to change qcml to automatically generate the 0 in the argument there?

dgrnbrg commented 7 years ago

Ah, I found where I can change these files to fix it and make the tests pass: examples/lasso.py, src/test/test_problems.py, src/test/test_restricted_multiplication.py. Would you like a pull request with these tests fixed like this?

Also, do the C interface tests validate that the solutions found by ECOS make sense?

echu commented 7 years ago

Ah, yes, a PR would be fantastic!

What do you mean by "make sense"? Like, the solution respects the constraints?

Eric On Mon, May 22, 2017 at 12:09 PM David Greenberg notifications@github.com wrote:

Ah, I found where I can change these files to fix it and make the tests pass: examples/lasso.py, src/test/test_problems.py, src/test/test_restricted_multiplication.py. Would you like a pull request with these tests fixed like this?

Also, do the C interface tests validate that the solutions found by ECOS make sense?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cvxgrp/qcml/issues/53#issuecomment-303192487, or mute the thread https://github.com/notifications/unsubscribe-auth/AADN0ZsiBt1HTKqc3RwJU23sO6Vlda8qks5r8d2EgaJpZM4NiuHV .

dgrnbrg commented 7 years ago

By "make sense", I mean are any of the problems ones with known solutions where the test validates that the discovered solution/objective value is within a bound of the expected result? I was just referred to this tool by a researcher who's previously used CVXGRP optimizers, and as a developer, I'm really excited to do low-thousand dimensional optimizations in my Rust programs. On a related note, would you accept a contribution adding a Rust code generation backend?

echu commented 7 years ago

Ah, we have a separate suite of tests for the ECOS solver, but it's not in this repo. They are in the ECOS repo itself. The unit tests in that repo were generated with this tool.

I'm trying to figure out how to host some sort of open source CI/CD playground for these solvers: a matrix of problems (likely created by CVXPY) that the community submit and the solvers used to solve them.

Should be a sort of solver shootout, but I don't have time to get that done. :)

I'd be happy to accept a Rust codegen backend. I'm not sure my code is that transparent (I would possibly do things differently if I did it again), but happy to accept any PRs.

My fantasy is an LLVM backend for both the transformations and the solver, but generating solvers is nontrivial. On Mon, May 22, 2017 at 12:16 PM David Greenberg notifications@github.com wrote:

By "make sense", I mean are any of the problems ones with known solutions where the test validates that the discovered solution/objective value is within a bound of the expected result? I was just referred to this tool by a researcher who's previously used CVXGRP optimizers, and as a developer, I'm really excited to do low-thousand dimensional optimizations in my Rust programs. On a related note, would you accept a contribution adding a Rust code generation backend?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/cvxgrp/qcml/issues/53#issuecomment-303193904, or mute the thread https://github.com/notifications/unsubscribe-auth/AADN0bGeZpiPkcid9HLW0A3qvNsvqutMks5r8d7xgaJpZM4NiuHV .

dgrnbrg commented 7 years ago

A solver shootout sounds awesome! I'm going to close this issue in favor of the PR I just did--it solves this problem.