# Modelling of SOCP constraint and solving through CPLEX

Hello all, I am trying to implement and solve the following SOCP constraint through CPLEX solver

``````(cij)^2 + (sij)^2 <= cii*cjj
``````

through Rotated Second Order cone as follows:

``````nSc = 10
nTP = 24
nBus = 34
nLines = 33
@variables(acopf,begin
(c_ii[i=1:nSc, j=1:nTP,k=1:nBus])
(c_ij[i=1:nSc, j=1:nTP,k=1:nLines])
(s_ij[i=1:nSc, j=1:nTP,k=1:nLines])
end

for s in 1:nSc
for t in 1:nTP
for i in 1:nLines
aux_var = [sqrt(2)*cij[s,t,i],sqrt(2)*sij[s,t,i]]
@constraint(acopf,[cii[s,t,i]; cii[s,t,i]; aux_var] in RotatedSecondOrderCone())
end
end
end
``````

However, when I tried to solve it, I received the following error.

LoadError: Constraints of type MathOptInterface.VectorAffineFunction{Float64}-in-MathOptInterface.RotatedSecondOrderCone are not supported by the solver.

Definitely, there is something wrong in the implementation of the constraint. Can someone tell where is the mistake and how to implement this constraint?

How did you define `acopf`? Did you try `adopt = Model(CPLEX.Optimizer)`?

Otherwise, just write it as the quadratic form.

``````@constraint(acopf, 2 * cii[s,t,i] * cii[s,t,i] >= sum(x^2 for x in aux_var)
``````