# Gurobi SOC Constraint

I am having issues using Gurobi Solver for my SOC formulation. Following are my constraints:

I am getting an error ERROR: LoadError: MethodError: no method matching NonlinearModel(::Gurobi.GurobiSolver)

The mathematical form of constraints is:

How can I solve this issue? I will appreciate any help.

Assuming that is a variable and not a constant, the first of those constraints is a non-convex quadratic constraint. Gurobi canât handle general nonlinear models. See the table at Installation Guide â JuMP -- Julia for Mathematical Optimization 0.16 documentation.

Thanks for the reply. is a constant. The problem is with the last constraint. It works with Ipopt Solver but by using @NLconstraint command.

After trying several times to use this hint (Models â JuMP -- Julia for Mathematical Optimization 0.16 documentation), I think that my main problem is that I donât understand how the last constraint can be represented in terms of norm()âŚ Is there any trick or reformulation that can help me wit this?

Thank yâall again.

What are the variables in that constraint / could you provide a minimal code example?

My variables are

Rl , Xl and Sl are constants.

The constraints are:

The constraint I am having issues with is:

The ârotated second-order cone constraintâ is a convex constraint of the form y*z >= ||x||^2, y>=0, z>=0. It appears that your constraint is of this form. I donât know if Gurobi supports this, but if it does, then probably it will help Gurobi recognize it if you move the âaâ variable to the other side of the inequality.

If Gurobi doesnât support it, then you can convert it to a standard second-order cone constraint by changing variables: let y=u+v and z=u-v.

[Please do not use images; instead, copy the code and âquoteâ it using backticks (`) or the â</>â button.]

The `@constraint` call should not throw the error you originally specified; the division by the `a` variable should fail.

``````using JuMP, Gurobi
m = Model(solver = GurobiSolver())
@variables m begin
fp
fq
a
v
end
@constraint(m, (fp^2 + fq^2) / a^2 <= v)
``````

results in

``````/(::Int64,::JuMP.GenericQuadExpr{Float64,JuMP.Variable}) is not defined. Are you trying to build a nonlinear problem? Make sure you use @NLconstraint/@NLobjective.

``````

while

``````using JuMP, Gurobi
m = Model(solver = GurobiSolver())
@variables m begin
fp
fq
a
v
end
@NLconstraint(m, (fp^2 + fq^2) / a^2 <= v)
solve(m)
``````

does result in the error you reported originally. Please do provide a minimal example right off the bat in the future; all of the back and forth above would have been unnecessary.

The constraint is indeed convex since `a` and `v` are also constrained to be positive; this is a rotated Lorentz cone constraint, as @Stephen_Vavasis mentioned.

Thank yâall for your help and suggestions. It is working now by implementing the suggestion mentioned by @Stephen_Vavasis. I appreciate your help.

I will be more specific in future and thanks again everyone.

1 Like