Re: [Gurobi] Implementing SOCP constraints

1,467 views
Skip to first unread message

Christopher Maes

unread,
Dec 1, 2012, 1:19:52 PM12/1/12
to gur...@googlegroups.com
> I have a problem that I'm solving that has an L2-norm in the constraints. It
> arises out of using robust optimization with ellipsoidal uncertainty sets.
>
> The general form of the equation is:
>
> a' x + || D * x || <= b, where D is a diagonal matrix with positive entries
>
> This fits the form of a SOCP constraint, if I'm not mistaken.
> CVX allows you to enter L2-norms directly, for example, and accepts this
> constraint as convex.
> If we reformulate this by changing it to
>
> || D * x || <= b - a' x
>
> and squaring both sides, Gurobi doesn't accept it (Exception: Q matrix is
> not positive semi-definite (PSD)).
> If we work through it by hand, this is true - the Q matrix is D^2 - a.a',
> which is not PSD in general. CVX also doesn't like this form of the
> constraint, for similar reasons.
>
> What is the correct way to implement this constraint in Gurobi using the C++
> interface?

Hi Iain,

I should first note that if your model is already written in CVX, you
can have Gurobi solve it directly. For information on using CVX with
Gurobi see:
http://cvxr.com/cvx/doc/install.html#using-cvx-with-gurobi-or-mosek

If you'd like to use the C++ interface to Gurobi, you can create the
following constraints:
y = D*x,
y'*y <= t^2,
0 <= t,
These constraints imply || D*x || <= t. If you then add the constraint
a'*x + t = b,
you will have || D*x || <= b - a'*x.

The constraint y'*y <= t^2 (with t >= 0) is a second-order cone
constraint accepted by Gurobi. The forms of quadratic constraints that
Gurobi accepts (without transformation) are described in the
documentation for the GRBModel::addQConstr() function:
http://www.gurobi.com/documentation/5.0/reference-manual/node120

Cheers,
Chris
Reply all
Reply to author
Forward
0 new messages