Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quadform objective does not work with OSQP #709

Closed
a7b opened this issue Oct 29, 2024 · 5 comments
Closed

quadform objective does not work with OSQP #709

a7b opened this issue Oct 29, 2024 · 5 comments
Labels

Comments

@a7b
Copy link

a7b commented Oct 29, 2024

I was trying to solve the following QP using OSQP:

λs = [0, 0.01, 0.1, 1, 10, 100, 200, 300, 1000]
for i in eachindex(λs)
    n = size(mat, 1) - 1
    x = Variable(n)
    constraints = [sum(x) == 100000, x >= 0]
    p = minimize( 1/2 * quadform(x, Σ) - λs[i] * dot(μr, x), constraints)
    solve!(p, OSQP.Optimizer)
end

but I get the error

UnsupportedConstraint: MathOptInterface.VectorAffineFunction{Float64}-in-MathOptInterface.SecondOrderCone constraints are not supported by the
solver you have chosen, and we could not reformulate your model into a
form that is supported.

Both of the constraints can be written in the form required by OSQP but it seems that Convex.jl is unable to do this. It would be nice if this could be fixed.

@odow
Copy link
Member

odow commented Oct 29, 2024

What is the output of import Pkg; Pkg.status()?

@odow
Copy link
Member

odow commented Oct 29, 2024

A smaller example:

julia> begin
           using Convex, OSQP
           x = Variable(2)
           p = minimize(quadform(x, [1 0; 0 1]))
           solve!(p, OSQP.Optimizer)
       end
ERROR: UnsupportedConstraint: `MathOptInterface.VectorAffineFunction{Float64}`-in-`MathOptInterface.SecondOrderCone` constraints are not supported by the
solver you have chosen, and we could not reformulate your model into a
form that is supported.

To fix this error you must choose a different solver.

I expected this to work. I haven't looked at the details yet.

@odow odow changed the title [Feature Request] Support simplex constraints for solving problem with OSQP quadform objective does not work with OSQP Oct 29, 2024
@odow odow added the bug label Oct 29, 2024
@ericphanson
Copy link
Collaborator

I think this is the thing where Convex unconditionally reformulates things, here quadratic to SOC instead of letting MOI do it so it can be appropriate to the solver

@odow
Copy link
Member

odow commented Oct 29, 2024

Oooh. This is actually a duplicate of #384

I'll close this issue to keep the discussion focused on #384

@odow odow closed this as completed Oct 29, 2024
@a7b
Copy link
Author

a7b commented Oct 29, 2024

I see, it is a duplicate. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants