Gurobi SOC Constraint


#1

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.


#2

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 http://www.juliaopt.org/JuMP.jl/0.16/installation.html#getting-solvers.


#3

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


#4

After trying several times to use this hint (http://www.juliaopt.org/JuMP.jl/0.16/refmodel.html#second-order-cone-constraints), 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.


#5

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


#6

My variables are

Rl , Xl and Sl are constants.


#7

The constraints are:


#8

The constraint I am having issues with is:


#9

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.


#10

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


#11

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.


#12

See also https://github.com/JuliaOpt/Convex.jl/blob/31960219657a17d2b4d826282c00935a9f2f8e97/src/atoms/second_order_cone/quadoverlin.jl.


#13

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.