Second order conic constraints with CPLEX

I have to solve a MISOCP problem with JuMP and CPLEX but I really didn’t understand how to write the constraints with the new syntax in SecondOrderCone().
I need to minimize the squared norm of a vector in which I have my binary optimization variables, e.g.
Min(sum((y[n]-sum(x[n,j]*b[j] for j=1:J))^2 for n=1:N))
where x[n,j] are my binary opt variables and y and b are observed.
I can write the objective function in terms of constraints of the type:

@variable(m,x[n=1:N,j=1:J],Bin)
@variable(m, w[n=1:N]>=0)
@objective(m, Min , sum(w[n] for n=1:N))
for n=1:N
     @constraint(m, [w[n]; y[n]-sum(x[n,j]*b[j] for j=1:J)] in SecondOrderCone())
end

but it doesn’t work.
It says “ERROR: Constraints of type MathOptInterface.VectorAffineFunction{Float64}-in-MathOptInterface.SecondOrderCone are not supported by the solver and there are no bridges that can reformulate it into supported constraints.”

What can I do to solve my problem?

Thank you for your attention.

Giada

There is no need to use SecondOrderCone. Just write out the problem using the quadratic form:

model = Model()
@variable(model, x[1:N, 1:J], Bin)
@objective(model, Min, 
    sum(
        (y[n] - sum(b[j] * x[n, j] for j in 1:J))^2 
        for n in 1:N
    ) 
)

Thank you odow, are you sure it works with binary opt variables?

I tried and it does not work.
It says “The solver does not support an objective function of type MathOptInterface.ScalarQuadraticFunction{Float64}.”

This is fixed on master. Run

] add CPLEX#master

Fantastic!
Thank you very much :slight_smile: