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, 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())

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.


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, 
        (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

Thank you very much :slight_smile: