6.5 Conic Exponential Optimization¶
The structure of a typical conic optimization problem is
(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:
which describes a convex cone in \(\real^3\) given by the inequalities:
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.5.1 Example CEO1¶
Consider the following basic conic exponential problem which involves some linear constraints and an exponential inequality:
The affine conic form of (6.15) is:
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 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
appendafes(task,3)
putafefentrylist(task,
[1, 2, 3], # Rows
[1, 2, 3], # Columns
ones(3))
# Exponential cone (x(0),x(1),x(2)) \in EXP
expdomain = appendprimalexpconedomain(task)
appendacc(task,
expdomain, # Domain
[1, 2, 3], # Rows from F
nothing) # 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
using Mosek
using Printf, SparseArrays
# Create a task
maketask() do task
# Use remote server: putoptserverhost(task,"http://solve.mosek.com:30080")
# Attach a printer to the task
putstreamfunc(task,MSK_STREAM_LOG,msg -> print(msg))
c = [1.0, 1.0, 0.0]
a = [1.0, 1.0, 1.0]
numvar = 3
numcon = 1
# Append 'numcon' empty constraints.
# The constraints will initially have no bounds.
appendcons(task,numcon)
# Append 'numvar' variables.
# The variables will initially be fixed at zero (x=0).
appendvars(task,numvar)
# Set up the linear part of the problem
putcslice(task,1, numvar+1, c)
putarow(task,1, [1, 2, 3], a)
putvarboundsliceconst(task,1, numvar+1, MSK_BK_FR, -Inf, Inf)
putconbound(task,1, MSK_BK_FX, 1.0, 1.0)
# Add a conic constraint
# Create a 3x3 identity matrix F
appendafes(task,3)
putafefentrylist(task,
[1, 2, 3], # Rows
[1, 2, 3], # Columns
ones(3))
# Exponential cone (x(0),x(1),x(2)) \in EXP
expdomain = appendprimalexpconedomain(task)
appendacc(task,
expdomain, # Domain
[1, 2, 3], # Rows from F
nothing) # Unused
# Input the objective sense (minimize/maximize)
putobjsense(task,MSK_OBJECTIVE_SENSE_MINIMIZE)
# Optimize the task
optimize(task)
# Print a summary containing information
# about the solution for debugging purposes
solutionsummary(task,MSK_STREAM_MSG)
prosta = getprosta(task,MSK_SOL_ITR)
solsta = getsolsta(task,MSK_SOL_ITR)
# Output a solution
xx = getxx(task,MSK_SOL_ITR)
if solsta == MSK_SOL_STA_OPTIMAL
println("Optimal solution: $xx")
elseif solsta == MSK_SOL_STA_DUAL_INFEAS_CER
println("Primal or dual infeasibility.")
elseif solsta == MSK_SOL_STA_PRIM_INFEAS_CER
println("Primal or dual infeasibility.")
elseif solsta == MSK_SOL_STA_UNKNOWN
println("Unknown solution status")
else
println("Other solution status")
end
end