The structure of a typical conic optimization problem is

$\begin{split}\begin{array}{lccccl} \mbox{minimize} & & & c^T x+c^f & & \\ \mbox{subject to} & l^c & \leq & A x & \leq & u^c, \\ & l^x & \leq & x & \leq & u^x, \\ & & & Fx+g & \in & \D, \end{array}\end{split}$

(see Sec. 12 (Problem Formulation and Solutions) for detailed formulations). We recommend Sec. 6.2 (From Linear to Conic Optimization) for a tutorial on how problems of that form are represented in MOSEK and what data structures are relevant. Here we discuss how to set-up problems with the (rotated) quadratic cones.

MOSEK supports two types of quadratic cones, namely:

$\Q^n = \left\lbrace x \in \real^n: x_0 \geq \sqrt{\sum_{j=1}^{n-1} x_j^2} \right\rbrace.$

$\Qr^n = \left\lbrace x \in \real^n: 2 x_0 x_1 \geq \sum_{j=2}^{n-1} x_j^2,\quad x_0\geq 0,\quad x_1 \geq 0 \right\rbrace.$

For example, consider the following constraint:

$(x_4, x_0, x_2) \in \Q^3$

which describes a convex cone in $$\real^3$$ given by the inequality:

$x_4 \geq \sqrt{x_0^2 + x_2^2}.$

For other types of cones supported by MOSEK, see Sec. 15.8 (Supported domains) and the other tutorials in this chapter. Different cone types can appear together in one optimization problem.

## 6.3.1 Example CQO1¶

Consider the following conic quadratic problem which involves some linear constraints, a quadratic cone and a rotated quadratic cone.

(6.7)$\begin{split}\begin{array} {lccc} \mbox{minimize} & x_4 + x_5 + x_6 & & \\ \mbox{subject to} & x_1+x_2+ 2 x_3 & = & 1, \\ & x_1,x_2,x_3 & \geq & 0, \\ & x_4 \geq \sqrt{x_1^2 + x_2^2}, & & \\ & 2 x_5 x_6 \geq x_3^2 & & \end{array}\end{split}$

The two conic constraints can be expressed in the ACC form as shown in (6.8)

(6.8)$\begin{split}\left[\begin{array}{cccccc}0&0&0&1&0&0\\1&0&0&0&0&0\\0&1&0&0&0&0\\0&0&0&0&1&0\\0&0&0&0&0&1\\0&0&1&0&0&0\end{array}\right] \left[\begin{array}{c}x_1\\x_2\\x_3\\x_4\\x_5\\x_6\end{array}\right] + \left[\begin{array}{c}0\\0\\0\\0\\0\\0\end{array}\right] \in \Q^3 \times \Q_r^3.\end{split}$

Setting up the linear part

The linear parts (constraints, variables, objective) are set up exactly the same way as for linear problems, and we refer to Sec. 6.1 (Linear Optimization) for all the details. The same applies to technical aspects such as defining an optimization problem, retrieving the solution and so on.

Setting up the conic constraints

To define the conic constraints, we set the prob.f and prob.g equal to the matrix and vector shown in (6.8). Since g is zero it can be omitted. The domains and dimensions of affine conic constraints are specified using the structure accs.

Listing 6.6 demonstrates how to solve the example (6.7) using MOSEK.

Listing 6.6 Script implementing problem (6.7). Click here to download.
function cqo1()

clear prob;

[r, res] = mosekopt('symbcon');
% Specify the non-conic part of the problem.

prob.c   = [0 0 0 1 1 1];
prob.a   = sparse([1 1 2 0 0 0]);
prob.blc = 1;
prob.buc = 1;
prob.blx = [0 0 0 -inf -inf -inf];
prob.bux = inf*ones(6,1);

% Specify the cones as affine conic constraints.
% Two conic constrains: one with QUAD, one with RQUAD, both of dimension 3

% The matrix such that f * x = [x(4), x(1), x(2), x(5), x(6), x(3)]

prob.f = sparse( 1:6, [4, 1, 2, 5, 6, 3], ones(1, 6) );

% That implies:
%  (x(4), x(1), x(2)) \in QUAD_3
%  (x(5), x(6), x(3)) \in RQUAD_3

% Optimize the problem.

[r,res]=mosekopt('minimize',prob);

% Display the primal solution.

res.sol.itr.xx'


For a step by step introduction to formulating problems with affine conic constraints (ACC) see also Sec. 6.2 (From Linear to Conic Optimization).