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

sumsquares makes both a SOC and RSOC constraint #677

Closed
ericphanson opened this issue May 20, 2024 · 0 comments · Fixed by #678
Closed

sumsquares makes both a SOC and RSOC constraint #677

ericphanson opened this issue May 20, 2024 · 0 comments · Fixed by #678

Comments

@ericphanson
Copy link
Collaborator

ericphanson commented May 20, 2024

I believe this could be a single RSOC constraint instead, but we would need to add an atom for it. I'm not sure how much this matters in practice.

julia> using Convex

julia> using Convex: MOI

julia> problem = minimize(sumsquares(Variable(2)));

julia> context = Convex.Context(problem, MOI.Utilities.Model{Float64});

julia> print(context.model)
Minimize ScalarAffineFunction{Float64}:
 0.0 + 1.0 v[1]

Subject to:

VectorAffineFunction{Float64}-in-SecondOrderCone
 ┌              ┐
 │0.0 + 1.0 v[2]│
 │0.0 + 1.0 v[3]│
 │0.0 + 1.0 v[4]│
 └              ┘  SecondOrderCone(3)

VectorAffineFunction{Float64}-in-RotatedSecondOrderCone
 ┌              ┐
 │0.0 + 1.0 v[1]│
 │0.5           │
 │0.0 + 1.0 v[2]│
 └              ┘  RotatedSecondOrderCone(3)

(This is since sumsquares is implemented by squaring norm, so we first create the SOC for the norm, then the RSOC for the result of norm.)

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

Successfully merging a pull request may close this issue.

1 participant