# SOCP modeling in Julia?

Hello friends, I am new to Julia and optimization. I have met a SOCP problem in my research. The model looks like the following

the objective function is a quardratic one. PG(i), alpha(i) here are my variables. I mainly do not know how to model 9e and 9f. I find that for most solvers we cannot use a norm directly in the constraint. What I have tried is move the two norm around and take squares of both side. Ipopt could solve this problem but it does not look quite right. Gurobi can also solve it (by setting Nonconvex parameter to 2) but it says it is a nonconvex problem, and I suppose it should not be. CPLEX just cannot solve it and says it is nonconvex.

I check the documentation and think there is a very standard way to formulate SOCP in Julia, it looks like that the SOCP constraint must be in some form. I try to reformulate in problem in the following form and write the constraint this way

which does not help. Can someone help me with this? Thank you in advance.

Rather than posting latex, post simplified Julia code. Take a read of the first post of PSA: make it easier to help you.

``````# To model ||x||_2 <= t, use
model = Model()
@variable(model, x[1:2])
@variable(model, t)
@constraint(model, [t; x] in SecondOrderCone())
``````
2 Likes

Thank you Oscar! Sorry for not following the posting rule, I will study the rules now. I just also should I also follow the standard form ||X||_2 <= t. Or can I have, for example, some constants on the left side of the inequality or some coefficient in front of the two norm or t? Thank you!

Yes, you can have things like

``````@constraint(model, [2 * t, 1.5 * x[1] + 1, 2, x[2]] in SecondOrderCone())
``````