How do I model a combination of polynomial and SOC constraints?

I have a problem consisting of both polynomial constraints (using the PolyJuMP), with nonnegativity requirements on a certain domain, which should be able to be handled using the SumOfSquares package and several second-order conic constraints. In short, I am having trouble including all the constraints and finding a solver to recognize the structure and start working. Specifically, I create two polynomial variables and both a nonnegativity and SOC constraint:

using JuMP
using PolyJuMP

using LinearAlgebra

using SumOfSquares
using DynamicPolynomials

model = SOSModel(CSDP.Optimizer)

# Variables
@polyvar xvar yvar
X = monomials([x, y], 0:2)
poly = @variable(model, poly, Poly(X))

domain = @set yvar == 1

# Nonnegativity constraint on domain
@constraint(model, poly >= 0, domain = domain)

poly_dx = differentiate(poly, xvar)
poly_dy = differentiate(poly, yvar)

poly_dx_val = poly_dx(1, 1)
poly_dy_val = poly_dy(1, 1)

term_val = norm([1; poly_dx_val; poly_dy_val])

obj_var = @variable(model, obj_var)

# SOC constraint
@constraint(model, obj_var >= term_val)

@objective(model, Min, obj_var)

However, I get a

LoadError: MathOptInterface.UnsupportedNonlinearOperator: The nonlinear operator `:norm` is not supported by the model.

As an alternative, I made the constraint more explicit:

term_val_sq = 1 + (poly_dx_val)^2 + (poly_dy_val)^2
@constraint(model, 0 >= term_val_sq - (obj_var^2))
@constraint(model, obj_var >= 0)

In that case I get the error

ERROR: LoadError: MathOptInterface.UnsupportedConstraint{MathOptInterface.ScalarQuadraticFunction{Float64}, MathOptInterface.GreaterThan{Float64}}: `MathOptInterface.ScalarQuadraticFunction{Float64}`-in-`MathOptInterface.GreaterThan{Float64}` constraint is not supported by the model: Unable to transform a quadratic constraint into a second-order 
cone constraint because the quadratic constraint is not strongly convex.

even though the constraint should be convex. Any ideas on why I get these errors? Is there another optimizer backend which may work?

Hi @Khr, welcome to the forum.

To create an SOC constraint, you need to use the SecondOrderCone() syntax (Constraints · JuMP).

Here’s how I’d write your model:

using CSDP
using DynamicPolynomials
using JuMP
using LinearAlgebra
using PolyJuMP
using SumOfSquares
model = SOSModel(CSDP.Optimizer)
@polyvar(x, y)
X = monomials([x, y], 0:2)
poly = @variable(model, poly, Poly(X))
@constraint(model, poly >= 0, domain = @set(y == 1))
poly_dx = differentiate(poly, x)
poly_dy = differentiate(poly, y)
@variable(model, t)
@constraint(model, [t, 1, poly_dx(1, 1), poly_dy(1, 1)] in SecondOrderCone())
@objective(model, Min, t)
optimize!(model)
solution_summary(model)

Thank you very much, that seems to have done the trick.

1 Like