# 6.5 Conic Exponential Optimization¶

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 primal/dual exponential cones.

MOSEK supports two exponential cones, namely:

• Primal exponential cone:

$\EXP = \left\lbrace x \in \real^3: x_0 \geq x_1 \exp(x_2/x_1),\ x_0,x_1\geq 0 \right\rbrace.$
• Dual exponential cone:

$\EXP^* = \left\lbrace s \in \real^3: s_0 \geq -s_2 e^{-1} \exp(s_1/s_2),\ s_2\leq 0,s_0\geq 0 \right\rbrace.$

For example, consider the following constraint:

$(x_4, x_0, x_2) \in \EXP$

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

$x_4 \geq x_0\exp(x_2/x_0),\ x_0,x_4\geq 0.$

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

## 6.5.1 Example CEO1¶

Consider the following basic conic exponential problem which involves some linear constraints and an exponential inequality:

(6.15)$\begin{split}\begin{array} {lrcl} \mbox{minimize} & x_0 + x_1 & & \\ \mbox{subject to} & x_0+x_1+x_2 & = & 1, \\ & x_0 & \geq & x_1\exp(x_2/x_1), \\ & x_0, x_1 & \geq & 0. \end{array}\end{split}$

The affine conic form of (6.15) is:

(6.16)$\begin{split}\begin{array} {lrcl} \mbox{minimize} & x_0 + x_1 & & \\ \mbox{subject to} & x_0+x_1+x_2 & = & 1, \\ & Ix & \in & \EXP, \\ & x & \in & \real^3. \end{array}\end{split}$

where $$I$$ is the $$3\times 3$$ identity matrix.

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

In order to append the conic constraints we first input the sparse identity matrix $$\afef$$ as indicated by (6.16).

The affine conic constraint is then appended using the function Task.appendacc, with the primal exponential domain and the list of $$\afef$$ rows, in this case consisting of all rows in their natural order.

      /* Create a 3x3 identity matrix F */
task.putafefentrylist(new long[]{0, 1, 2},         /* Rows */
new int[]{0, 1, 2},          /* Columns */
new double[]{1.0, 1.0, 1.0});

/* Exponential cone (x(0),x(1),x(2)) \in EXP  */
new long[]{0, 1, 2},     /* Rows from F */
null);                   /* Unused */


The first argument selects the domain, which must be appended before being used, and must have the dimension matching the number of affine expressions appearing in the constraint. Variants of this method are available to append multiple ACCs at a time. It is also possible to define the matrix $$\afef$$ using a variety of methods (row after row, column by column, individual entries, etc.) similarly as for the linear constraint matrix $$A$$.

For a more thorough exposition of the affine expression storage (AFE) matrix $$\afef$$ and vector $$\afeg$$ see Sec. 6.2 (From Linear to Conic Optimization).

Source code

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

import mosek.*;

public class ceo1 {
static final int numcon = 1;
static final int numvar = 3;

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.fr,
mosek.boundkey.fr,
mosek.boundkey.fr
};
double[] blx = { -infinity,
-infinity,
-infinity
};
double[] bux = { +infinity,
+infinity,
+infinity
};

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

double[] a   = { 1.0,
1.0,
1.0
};
int[] asub   = {0, 1, 2};
int[] csub   = new int[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); }});

/* Append 'numcon' empty constraints.
The constraints will initially have no bounds. */

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

/* Define the linear part of the problem */

/* Add a conic constraint */
/* Create a 3x3 identity matrix F */
task.putafefentrylist(new long[]{0, 1, 2},         /* Rows */
new int[]{0, 1, 2},          /* Columns */
new double[]{1.0, 1.0, 1.0});

/* Exponential cone (x(0),x(1),x(2)) \in EXP  */
new long[]{0, 1, 2},     /* Rows from F */
null);                   /* Unused */

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 */

double[] xx  = task.getxx(mosek.soltype.itr); // Interior solution.

switch (solsta[0]) {
case 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:
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;
}
}
}