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

*R*_{l} , *X*_{l} and *S*_{l} are constants.

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.
in /(::Int64, ::JuMP.GenericQuadExpr{Float64,JuMP.Variable}) at /Users/twan/code/julia/RigidBodyDynamics/v0.5/JuMP/src/operators.jl:639
```

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