Added first version of proximal implementation details

This commit is contained in:
Andreas Tsouchlos 2023-04-07 16:58:22 +02:00
parent 13b52a5110
commit eeadb9c726
2 changed files with 72 additions and 0 deletions

View File

@ -252,6 +252,67 @@ return $\boldsymbol{\hat{c}}$
\section{Implementation Details}%
\label{sec:prox:Implementation Details}
The algorithm as first implemented in Python because of the fast development
process and straightforward debugging.
They have subsequently been reimplemented in C++ using the Eigen%
\footnote{\url{https://eigen.tuxfamily.org}}
linear algebra library to achieve higher performance.
The focus has been set on a fast implementation, sometimes at the expense of
memory usage.
The evaluation of the simulation results has been wholly realized in Python.
The gradient of the code-constraint polynomial is given by \cite[Sec. 2.3]{proximal_paper}%
%
\begin{align*}
\nabla h\left( \boldsymbol{x} \right) &= \begin{bmatrix}
\frac{\partial}{\partial x_1}h\left( \boldsymbol{x} \right) &
\ldots &
\frac{\partial}{\partial x_n}h\left( \boldsymbol{x} \right) &
\end{bmatrix}^\text{T}, \\[1em]
\frac{\partial}{\partial x_k}h\left( \boldsymbol{x} \right) &= 4\left( x_k^2 - 1 \right) x_k
+ \frac{2}{x_k} \sum_{j\in N_v\left( k \right) }\left(
\left( \prod_{i \in N_c\left( j \right)} x_i \right)^2
- \prod_{i\in N_c\left( j \right) } x_i \right)
.\end{align*}
%
Evidently, the products
$\prod_{i\in N_c\left( j \right) } x_i,\hspace{1mm}\forall i\in \mathcal{J}$
can be precomputed, as they are the same for all components $x_k$ of $\boldsymbol{x}$.
Defining%
%
\begin{align*}
\boldsymbol{p} := \begin{bmatrix}
\prod_{i\in N_c\left( 1 \right) }x_i \\
\vdots \\
\prod_{i\in N_c\left( m \right) }x_i \\
\end{bmatrix}
\hspace{5mm}
\text{and}
\hspace{5mm}
\boldsymbol{v} := \boldsymbol{p}^{\circ 2} - \boldsymbol{p}
,\end{align*}
%
the gradient can be written as%
%
\begin{align*}
\nabla h\left( \boldsymbol{x} \right) =
4\left( \boldsymbol{x}^{\circ 3} - \boldsymbol{x} \right)
+ 2\boldsymbol{x}^{\circ -1} \circ \boldsymbol{H}^\text{T}
\boldsymbol{v}
,\end{align*}
%
enabling the computation of the gradient primarily with element-wise
operations and matrix-vector multiplication.
This is beneficial, as the libraries used for the implementation are
heavily optimized for such calculations (e.g., through vectorization of the
operations).
\todo{Note about how the equation with which the gradient is calculated is
itself similar to a message-passing rule}
The projection $\prod_{\eta}\left( . \right)$ also proves straightforward to
compute, as it amounts to simply clipping each component of the vector onto
$[-\eta, \eta]$ individually.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Results}%

View File

@ -32,6 +32,17 @@ of indexed variables:%
x_{\left[ m:n \right] } &:= \left\{ x_m, x_{m+1}, \ldots, x_{n-1}, x_n \right\}
.\end{align*}
%
In order to designate elemen-twise operations, in particular the\textit{Hadamard product}
and the \textit{Hadamard power}, the operator $\circ$ will be used:%
%
\begin{alignat*}{3}
\boldsymbol{a} \circ \boldsymbol{b}
&:= \begin{bmatrix} a_1 b_1 & \ldots & a_n b_n \end{bmatrix} ^\text{T},
\hspace{5mm} &&\boldsymbol{a}, \boldsymbol{b} \in \mathbb{R}^n, \hspace{2mm} n\in \mathbb{N} \\
\boldsymbol{a}^{\circ k} &:= \begin{bmatrix} a_1^k \ldots a_n^k \end{bmatrix}^\text{T},
\hspace{5mm} &&\boldsymbol{a} \in \mathbb{R}^n, \hspace{2mm}k\in \mathbb{Z}
.\end{alignat*}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%