# 6.5 Conic Exponential Optimization¶

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 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}.$

In this tutorial we describe how to use the primal exponential cone defined as:

$\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.$

MOSEK also supports the 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 other types of cones supported by MOSEK see Sec. 6.3 (Conic Quadratic Optimization), Sec. 6.4 (Power Cone Optimization), Sec. 6.6 (Semidefinite Optimization). See Task.appendcone for a list and definitions of available cone types. Different cone types can appear together in one optimization problem.

For example, the following constraint:

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

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.$

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.5.1 Example CEO1¶

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

(6.9)$\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 conic form of (6.9) is:

(6.10)$\begin{split}\begin{array} {lrcl} \mbox{minimize} & x_0 + x_1 & & \\ \mbox{subject to} & x_0+x_1+x_2 & = & 1, \\ & (x_0,x_1,x_2) & \in & \EXP, \\ & x & \in & \real^3. \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;
csub = 1;
csub = 2;
task.appendcone(mosek.conetype.pexp,
0.0, /* For future use only, can be set to 0.0 */
csub);


The first argument selects the type of exponential cone, that is conetype.pexp. 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 6.6 Source code solving problem (6.9). Click here to download.
using System;

namespace mosek.example
{
class msgclass : mosek.Stream
{
string prefix;
public msgclass (string prfx)
{
prefix = prfx;
}

public override void streamCB (string msg)
{
Console.Write ("{0}{1}", prefix, msg);
}
}

public class ceo1
{
public static void Main ()
{
const int numcon = 1;
const int numvar = 3;

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

// Make mosek environment.
using (mosek.Env env = new mosek.Env())
{
// Create a task object.
using (mosek.Task task = new mosek.Task(env, 0, 0))
{
// Directs the log task stream to the user specified
// method msgclass.streamCB
task.set_Stream (mosek.streamtype.log, new msgclass (""));

/* Append 'numcon' empty constraints.
The constraints will initially have no bounds. */
task.appendcons(numcon);

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

/* Set up the linear part of the problem */
task.putcslice(0, numvar, c);
task.putarow(0, asub, a);
task.putconbound(0, bkc, blc, buc);
task.putvarboundslice(0, numvar, bkx, blx, bux);

/* Define the exponential cone */
csub = 0;
csub = 1;
csub = 2;
task.appendcone(mosek.conetype.pexp,
0.0, /* For future use only, can be set to 0.0 */
csub);

task.putobjsense(mosek.objsense.minimize);
task.optimize();

// Print a summary containing information
// about the solution for debugging purposes
task.solutionsummary(mosek.streamtype.msg);

mosek.solsta solsta;
/* Get status information about the solution */
task.getsolsta(mosek.soltype.itr, out solsta);

double[] xx  = new double[numvar];

task.getxx(mosek.soltype.itr, // Basic solution.
xx);

switch (solsta)
{
case mosek.solsta.optimal:
Console.WriteLine ("Optimal primal solution\n");
for (int j = 0; j < numvar; ++j)
Console.WriteLine ("x[{0}]: {1}", j, xx[j]);
break;
case mosek.solsta.dual_infeas_cer:
case mosek.solsta.prim_infeas_cer:
Console.WriteLine("Primal or dual infeasibility.\n");
break;
case mosek.solsta.unknown:
Console.WriteLine("Unknown solution status.\n");
break;
default:
Console.WriteLine("Other solution status");
break;
}
}
}
}
}
}