oxfordcontrol/TRS.jl

Python integration

wielandbrendel opened this issue · 7 comments

This package looks great! Are there any plans to combine this with your osqp package (which I use and love a lot) or to release Python bindings? I am currently working on a trust region optimisation problem and so can't use osqp.

I will leave it to @nrontsis to answer about bindings and/or integration with other packages. However, if the reason for not using OSQP in your trust region problem is the presence of a 2-norm constraint, then maybe you would be interested in the COSMO package instead.

Great, thanks for the quick response and the hint, the COSMO package would indeed fit the bill. I'll definitely ask for python bindings there.

@wielandbrendel can you give a few more details about the problems you are trying to solve? COSMO.jl would be particularly suitable for solving (sub)problems of the form:

minimize    ½x'Px + q'x
subject to  ‖x‖ ≤ r
            Ax ≤ b

when the problem is convex, i.e. when P is positive (semi)definite.

However, if you simply want to solve (in either the convex or the non-convex case):

minimize    ½x'Px + q'x
subject to  ‖x‖ ≤ r

or

minimize    ½x'Px + q'x
subject to  ‖x‖ ≤ r
            Ax = b

then a specialised trust region solver (like this one) will likely be faster and more accurate.

Thanks for your help! My problem is of the form

minimize    1/2 x'x - q'x
subject to  ‖x‖ ≤ r
            n'x = 0
            min ≤ x ≤ max

where min, max are vectors of the same size as x. The solver should be easy to distribute (one reason I love osqp) and should be able to robustly and quickly solve the optimisation problem for dimensions between 1.000 and 100.000 (< 1 second with warm start). Accuracy of the solution is a little less important, but I have to solve that problem thousands of times. Any ideas are highly appreciated!

I would suggest either COSMO in Julia, or SCS in Python. SCS it has its own Python interface, or it can be used through CVXPy.

Both solvers should work well with large problems, support warm starting, etc. Everything linked above is also either MIT or Apache licensed. The COSMO solver would perhaps be a bit better for your problem since it supports quadratic objectives directly, whereas SCS / CVPy will reformulate the objective into a second-order cone constraint using an epigraphical upper bound.

We don't have any Python support for COSMO yet, but you can call COSMO via the Julia JuMP modelling package. It is possible (I do not know) that JuMP has some mechanism for using it via Python.

Following @goulart-paul's answer, this package is not suitable for your problem, due to the presence of the linear inequality constraints min ≤ x ≤ max. Hence, I am closing the issue. Feel free to continue the chat (especially regarding Python bindings etc) in the issue that you opened in COSMO's repo.

Thanks for all your precious hints and your valuable time!