-
Notifications
You must be signed in to change notification settings - Fork 3
Cones
Let
-
$x+y \in K$ for every$x,y \in K$ holds -
$\lambda x \in K$ for every$\lambda \geq 0$ and$x \in K$
This notion is surprisingly versatile.
A very simple cone is visualized in the following figure:

In CaΣoS, all cones have a shorthand.
A vector cone is a set
The most simple examples of convex cones are linear subspaces of
The
In three dimensions, the second-order cone resembles an ice cream cone, illustrated in the following figure of a cone in three variables:

The
A matrix cone is a subset of the space of symmetric matrices
One concept that is particularly important to conic programming is the convex cone of all (symmetric) positive semidefinite matrices, defined as the set
Consider for example the matrix
which is positive semidefinite for values of 
The set of positive semi-definite is a closed convex set.
A symmetric matrix
We denote the set of all diagonally dominant matrices as
A symmetric matrix
We denote the set of all scaled diagonally dominant matrices as
Note
A relevant inclusion relationship between the cones of positive semidefinite matrices, diagonally dominant matrices, and scaled diagonally dominant matrices is
A polynomial cone is a subset of the space of polynomials
A multivariate polynomial
where
Notably, a polynomial
where
A polynomial
where
A polynomial
where
We can use the conic framework to rewrite several typical convex sets in terms of conic quadratic formulations. Here are some examples:
For a constraint
we can use the definition of the two-dimensional quadratic cone where
needs to hold. Consequently, the constraint on the absolute value can be rewritten as
In the standard definition of an
the right hand side of the inequality clearly provides the Euclidian norm of
That makes it possible for us to rewrite the inequality
as
All conic and sum-of-squares optimization interfaces expect the user to specify the cones of decision variables and constraints as structures within the option structure. To that extent, each cone type has a shorthand. A structure K describing the cones then consists of fields for each cone type to which the parameters describing the cone(s) are assigned. Cones of dimension zero can be omitted.
This list describes the shorthands and parametrization for the cone types described above.
-
K.lin: number of element-wise constraints; -
K.lor: vector$(d_1, \ldots, d_k)$ of second-order (Lorentz) cone dimensions; -
K.rot: vector$(d_1, \ldots, d_k)$ of rotated second-order (Lorentz) cone dimensions; -
K.sdp: vector$(s_1, \ldots, s_k)$ of positive semidefinite matrix cone dimensions, that is,$\mathcal K = \mathbb S_{s_1}^{+} \times \cdots \times \mathbb S_{s_k}^{+}$ ; the total number of SDP cone constraints is equal to$\sum_i s_i^2$ ; -
K.dd: vector$(s_1, \ldots, s_k)$ of diagonal dominant matrix cone dimensions; -
K.sdd: vector$(s_1, \ldots, s_k)$ of scaled diagonal dominant matrix cone dimensions.
-
K.lin: number of coefficient-wise constraints; -
K.sos: number of sum-of-squares constraints; -
K.dsos: number of diagonally-dominant sum-of-squares constraints; -
K.sdsos: number of scaled-diagonally-dominant sum-of-squares constraints.
Consider Problem CQ01 from the Mosek Documentation:
which can be solved with CaΣoS using the high-level interface (sdpsol).
We start off by defining
x = casadi.SX.sym('x',6);
sdp.x = x;Now we can define the cost function with
sdp.f = x(4) + x(5) + x(6);All constraints now need to be defined in a vector:
sdp.g = [
x(1) + x(2) + 2*x(3); % linear constraints come first
[x(4); x(1); x(2)]; % In quadratic cone
[x(5); x(6); x(3)]; % In rotated quadratic cone
]where we need to define element-wise constraints first. Note that the right hand side of the element-wise constraint needs to be added using bounds:
lbg = 1;
ubg = 1;The second row in sdp.g stems from
This can be rewritten as a conic constraint
i.e. the
The third row describes the constraint
Since
Finally, we need to tell CaΣoS which cone should be used for each column of sdp.g.
opts.Kc = struct('lin', 1, 'lor', 3, 'rot', 3);
Additionally, we need to define linear bounds to the decision variable
opts.Kx = struct('lin', 6);
lbx = [0;0;0;-inf;0;0];
ubx = inf(6, 1);which now allows us to define the solver and obtain the solution
% solver
S = casos.sdpsol('S','mosek',sdp,opts)
% solution
sol = S('lbx',lbx,'ubx',ubx,'lbg',lbg,'ubg',ubg);Complete code:
% example see
% https://docs.mosek.com/latest/toolbox/tutorial-cqo-shared.html
x = casadi.SX.sym('x',6);
sdp.x = x;
sdp.f = x(4) + x(5) +x (6);
sdp.g = [
x(1) + x(2) + 2*x(3);
[x(4); x(1);x(2)];
[x(5); x(6);x(3)];
];
% cones
opts.Kc = struct('lin', 1, 'lor', 3, 'rot', 3);
opts.Kx = struct('lin', 6);
% solver
S = casos.sdpsol('S','mosek',sdp,opts)
% bounds
lbx = [0;0;0;-inf;0;0];
ubx = inf(6, 1);
lbg = 1;
ubg = 1;
% solution
sol = S('lbx',lbx,'ubx',ubx,'lbg',lbg,'ubg',ubg);- Getting started
- Available conic solvers
- Convex and nonconvex sum-of-squares optimization
- Supported vector, matrix, and polynomial cones
- Some practical tipps for sum-of-squares
- Transitioning from other toolboxes
- Example code snippets
If you use CaΣoS, please cite us.