Conic optimization is a generalization of linear optimization, allowing constraints of the type

$x^t \in \K_t,$

where $$x^t$$ is a subset of the problem variables and $$\K_t$$ is a convex cone. Since the set $$\real^n$$ of real numbers is also a convex cone, we can simply write a compound conic constraint $$x\in \K$$ where $$\K=\K_1\times\cdots\times\K_l$$ is a product of smaller cones and $$x$$ is the full problem variable.

MOSEK can solve conic quadratic optimization problems of the form

$\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, \\ & & & x \in \K, & & \end{array}\end{split}$

where the domain restriction, $$x \in \K$$, implies that all variables are partitioned into convex cones

$x = (x^0, x^1, \ldots , x^{p-1}),\quad \mbox{with } x^t \in \K_t \subseteq \real^{n_t}.$

For convenience, a user defining a conic quadratic problem only needs to specify subsets of variables $$x^t$$ belonging to quadratic cones. These are:

$\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, the following constraint:

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

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

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

Furthermore, each variable may belong to one cone at most. The constraint $$x_i - x_j = 0$$ would however allow $$x_i$$ and $$x_j$$ to belong to different cones with same effect.

6.3.1 Example CQO1¶

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

(1)$\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}$

Setting up the linear part

The linear parts (constraints, variables, objective) are set up using exactly the same methods 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 task, retrieving the solution and so on.

Setting up the conic constraints

A cone is defined using the function Task.appendcone:

      csub[0] = 3;
csub[1] = 0;
csub[2] = 1;
0.0, /* For future use only, can be set to 0.0 */
csub);


The first argument selects the type of quadratic cone, in this case either conetype.quad for a quadratic cone or conetype.rquad for a rotated quadratic cone. The second parameter is currently ignored and passing 0.0 will work.

The last argument is a list of indexes of the variables appearing in the cone.

Variants of this method are available to append multiple cones at a time.

Source code

Listing 7 Source code solving problem (1). Click here to download.
package com.mosek.example;

import mosek.*;

public class cqo1 {
static final int numcon = 1;
static final int numvar = 6;

public static void main (String[] args) throws java.lang.Exception {
// Since the value infinity is never used, we define
// 'infinity' symbolic purposes only
double infinity = 0;

mosek.boundkey[] bkc    = { mosek.boundkey.fx };
double[] blc = { 1.0 };
double[] buc = { 1.0 };

mosek.boundkey[] bkx
= {mosek.boundkey.lo,
mosek.boundkey.lo,
mosek.boundkey.lo,
mosek.boundkey.fr,
mosek.boundkey.fr,
mosek.boundkey.fr
};
double[] blx = { 0.0,
0.0,
0.0,
-infinity,
-infinity,
-infinity
};
double[] bux = { +infinity,
+infinity,
+infinity,
+infinity,
+infinity,
+infinity
};

double[] c   = { 0.0,
0.0,
0.0,
1.0,
1.0,
1.0
};

double[][] aval   = {
{1.0},
{1.0},
{2.0}
};
int[][]    asub   = {
{0},
{0},
{0}
};

int[] csub = new int[3];
double[] xx  = new double[numvar];
// create a new environment object
try (Env  env  = new Env();
// Directs the log task stream to the user specified
mosek.streamtype.log,
new mosek.Stream()
{ public void stream(String msg) { System.out.print(msg); }});

/* Give MOSEK an estimate of the size of the input data.
This is done to increase the speed of inputting data.
However, it is optional. */
/* Append 'numcon' empty constraints.
The constraints will initially have no bounds. */

/* Append 'numvar' variables.
The variables will initially be fixed at zero (x=0). */

/* Optionally add a constant term to the objective. */
for (int j = 0; j < numvar; ++j) {
/* Set the linear term c_j in the objective.*/
/* Set the bounds on variable j.
blx[j] <= x_j <= bux[j] */
}

for (int j = 0; j < aval.length; ++j)
/* Input column j of A */
asub[j],               /* Row index of non-zeros in column j.*/
aval[j]);              /* Non-zero Values of column j. */

/* Set the bounds on constraints.
for i=1, ...,numcon : blc[i] <= constraint i <= buc[i] */
for (int i = 0; i < numcon; ++i)

csub[0] = 3;
csub[1] = 0;
csub[2] = 1;
0.0, /* For future use only, can be set to 0.0 */
csub);

csub[0] = 4;
csub[1] = 5;
csub[2] = 2;

System.out.println ("optimize");
/* Solve the problem */
System.out.println (" Mosek warning:" + r.toString());
// Print a summary containing information
// about the solution for debugging purposes

mosek.solsta solsta[] = new mosek.solsta[1];

/* Get status information about the solution */

xx);

switch (solsta[0]) {
case optimal:
case near_optimal:
System.out.println("Optimal primal solution\n");
for (int j = 0; j < numvar; ++j)
System.out.println ("x[" + j + "]:" + xx[j]);
break;
case dual_infeas_cer:
case prim_infeas_cer:
case near_dual_infeas_cer:
case near_prim_infeas_cer:
System.out.println("Primal or dual infeasibility.\n");
break;
case unknown:
System.out.println("Unknown solution status.\n");
break;
default:
System.out.println("Other solution status");
break;
}
} catch (mosek.Exception e) {
System.out.println ("An error/warning was encountered");
System.out.println (e.toString());
throw e;
}
}
}