\section{Decoding Algorithms}%
\label{sec:Decoding Algorithms}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Proximal Decoding}%
\label{sub:Alg Proximal Decoding}

\begin{frame}[t]
    \frametitle{Proximal Decoding: General Idea \cite{proximal_paper}}

    \vspace*{-0.3cm}

    \begin{itemize}
        \item MAP rule:
            \begin{align*}
                \hat{\boldsymbol{x}}
                    &= \argmax_{\tilde{\boldsymbol{x}}\in\mathbb{R}^n}
                        f_{\boldsymbol{Y}}\left( \boldsymbol{y} | \tilde{\boldsymbol{x}} \right)
                        f_{\boldsymbol{X}}\left( \tilde{\boldsymbol{x}} \right)\\
                    &= \argmax_{\tilde{\boldsymbol{x}}\in\mathbb{R}^n}
                        e^{-L\left( \boldsymbol{y} | \tilde{\boldsymbol{x}}\right)}
                        f_{\boldsymbol{X}}\left( \tilde{\boldsymbol{x}} \right),
                    \hspace{5mm} L\left( \boldsymbol{y} | \tilde{\boldsymbol{x}} \right)
                        = - \ln\left( f_{\boldsymbol{Y}}
                            \left( \boldsymbol{y} | \tilde{\boldsymbol{x}} \right)  \right)
            \end{align*}
        \item Approximation of prior PDF:
            \begin{align*}
                f_{\boldsymbol{X}}\left( \tilde{\boldsymbol{x}} \right)
                    = \frac{1}{\left| \mathcal{C} \right| }
                        \sum_{\boldsymbol{c} \in \mathcal{C} }
                        \delta\left( \tilde{\boldsymbol{x}} - \left( -1 \right)^{\boldsymbol{c}}
                            \right) 
                    \approx \frac{1}{Z} e^{-\gamma h\left( \tilde{\boldsymbol{x}} \right) }
            \end{align*}
        \item Code constraint polynomial:
            \begin{minipage}[c]{0.56\textwidth}
                \raggedright
                
                \begin{align*}
                h\left( \tilde{\boldsymbol{x}} \right) =
                    \underbrace{\sum_{i=1}^{n} \left( \tilde{x}_i^2 - 1 \right)^2}_{\text{Bipolar
                        constraint}}
                    + \underbrace{\sum_{j=1}^{m} \left[ \left(
                        \prod_{i\in N_v\left( j \right)} \tilde{x}_i\right) -1 \right]^2}
                            _{\text{Parity constraint}},
                \end{align*}
            \end{minipage}%
            \begin{minipage}[c]{0.4\textwidth}
                \raggedleft
                \begin{flalign*}
                    \mathcal{I} &:= \left[1\text{ : }n\right],
                    \hspace{2mm} \mathcal{J} := \left[1\text{ : }m\right] \\
                    N_v\left( j \right) &:= \left\{i | i\in \mathcal{I},
                        \boldsymbol{H}_{j,i} = 1
                \right\}, j\in\mathcal{J}\\
                \end{flalign*}
            \end{minipage}
            \hfill
    \end{itemize}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]
    \frametitle{Proximal Decoding: General Idea}

    \begin{itemize}
        \item Objective function:
            \begin{align*}
                g\left( \tilde{\boldsymbol{x}} \right)
                    = L\left( \boldsymbol{y} | \tilde{\boldsymbol{x}} \right)
                    + \gamma h\left( \tilde{\boldsymbol{x}} \right)
            \end{align*}
            \note{Notational difference between $f$ and $f_X$ or $f_Y$}
        \item Proximal operator \cite{proximal_algorithms}:
            \begin{align*}
                \text{prox}_{\gamma h} \left( \tilde{\boldsymbol{x}} \right) &\equiv
                    \argmin_{\boldsymbol{t}\in\mathbb{R}^n} \left(
                        \gamma h\left( \boldsymbol{t} \right) + \frac{1}{2} \lVert \boldsymbol{t}
                            - \tilde{\boldsymbol{x}} \rVert^2  \right)\\
                        &\approx \tilde{\boldsymbol{x}}
                            - \gamma \nabla h\left( \tilde{\boldsymbol{x}} \right),
                        \hspace{5mm} \gamma \text{ small}
            \end{align*}
        \item Iterative decoding process:
            \begin{align*}
                \boldsymbol{r} &\leftarrow \boldsymbol{s}
                    - \omega \nabla L\left( \boldsymbol{y} | \boldsymbol{s}
                    \right), \hspace{5mm} \omega > 0
                    \hspace{10mm} \text{``Gradient descent step''}\\
                \boldsymbol{s} &\leftarrow \boldsymbol{r}
                    - \gamma \nabla h\left( \boldsymbol{r}
                    \right), \hspace{9mm} \gamma > 0
                    \hspace{10mm} \text{``Code proximal step''}
            \end{align*}
    \end{itemize}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t, fragile]
    \frametitle{Proximal Decoding: Algorithm}
    \begin{itemize}
        \item Iterative decoding algorithm \cite{proximal_paper}:
    \end{itemize}
            
    \vspace{2mm}
    \begin{algorithm}[caption={}, label={}]
$\boldsymbol{s} \leftarrow \boldsymbol{0}$
for $K$ iterations do
    $\boldsymbol{r} \leftarrow \boldsymbol{s} - \omega \nabla L \left( \boldsymbol{y} \mid \boldsymbol{s} \right) $
    $\boldsymbol{s} \leftarrow \boldsymbol{r} - \gamma \nabla h\left( \boldsymbol{r} \right) $
    $\boldsymbol{\hat{x}} \leftarrow \text{sign}\left( \boldsymbol{s} \right) $
    if $\boldsymbol{H}\boldsymbol{\hat{c}} = \boldsymbol{0}$ do
        return $\boldsymbol{\hat{c}}$
    end if
end for
return $\boldsymbol{\hat{c}}$
    \end{algorithm}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{LP Decoding}%
\label{sub:LP Decoding}

\begin{frame}[t]
    \frametitle{LP Decoding \cite{feldman_paper}}

    \begin{itemize}
        \item General reformulation of ML decoding as a linear program (LP)
%        \item Codeword polytope:
%            \begin{align*}
%                \text{poly}\left( \mathcal{C} \right) =
%                    \left\{
%                        \sum_{\boldsymbol{c}\in\mathcal{C}}\alpha_{\boldsymbol{c}}
%                            \boldsymbol{c} : \alpha_{\boldsymbol{c}} \ge  0,
%                        \sum_{\boldsymbol{c}\in\mathcal{C}}\alpha_{\boldsymbol{c}} = 1
%                    \right\},
%                    \hspace{5mm} \alpha_{\boldsymbol{c}} \in \mathbb{R}_{\ge 0}
%            \end{align*}
        \item Cost function:
            \begin{align*}
                \boldsymbol{\gamma}^{T} \boldsymbol{c} = \sum_{i=1}^{n}
                    \gamma_i c_i,
                \hspace{5mm}\gamma_i = \ln\left(
                    \frac{p_{Y_i \mid C_i}\left( y_i | c_i = 0 \right) }
                    {p_{Y_i \mid C_i}\left(y_i | c_i=1 \right) } \right)
            \end{align*}
        \item Exact \textit{integer linear programming} (ILP) formulation of ML decoding:
            \begin{align*}
                &\text{minimize } \boldsymbol{\gamma}^\text{T} \tilde{\boldsymbol{c}}\\
                &\text{subject to } \boldsymbol{c}\in \mathcal{C}
            \end{align*}
        \item Goal: relaxation of constraints to make a practical solution to the problem feasible
    \end{itemize}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]
    \frametitle{LP Relaxation: Motivation}

    \vspace*{-1cm}

    \begin{gather*}
%        \boldsymbol{G} =
%            \begin{bmatrix}
%                0 & 1 & 1
%            \end{bmatrix} \hspace{1cm}
        \boldsymbol{H} =
            \begin{bmatrix}
                1 & 1 & 1\\
                0 & 1 & 1
            \end{bmatrix} \hspace{1cm}
%            \\[1em]
        \mathcal{C} = \left\{ \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix},
            \begin{bmatrix} 0 \\ 1 \\ 1 \end{bmatrix}   \right\} 
    \end{gather*}%

    \vspace*{-5mm}

    \begin{figure}[H]
        \centering

        \begin{subfigure}[c]{0.4\textwidth}
            \centering

            \tikzstyle{codeword} = [color=KITblue, fill=KITblue,
                                draw, circle, inner sep=0pt, minimum size=4pt]

            \tdplotsetmaincoords{60}{25}
            \begin{tikzpicture}[scale=0.9, tdplot_main_coords]
                % Cube

                \coordinate (p000) at (0, 0, 0);
                \coordinate (p001) at (0, 0, 2);
                \coordinate (p010) at (0, 2, 0);
                \coordinate (p011) at (0, 2, 2);
                \coordinate (p100) at (2, 0, 0);
                \coordinate (p101) at (2, 0, 2);
                \coordinate (p110) at (2, 2, 0);
                \coordinate (p111) at (2, 2, 2);

                \draw[] (p000) -- (p100);
                \draw[] (p100) -- (p101);
                \draw[] (p101) -- (p001);
                \draw[] (p001) -- (p000);

                \draw[dashed] (p010) -- (p110);
                \draw[]       (p110) -- (p111);
                \draw[]       (p111) -- (p011);
                \draw[dashed] (p011) -- (p010);

                \draw[dashed] (p000) -- (p010);
                \draw[]       (p100) -- (p110);
                \draw[]       (p101) -- (p111);
                \draw[]       (p001) -- (p011);

                % Polytope Vertices

                \node[codeword] (c000) at (p000) {};
                \node[codeword] (c011) at (p011) {};
                
                % Polytope Annotations

                \node[color=KITblue, below=0cm of c000] {$\left( 0, 0, 0 \right) $};
                \node[color=KITblue, above=0cm of c011] {$\left( 0, 1, 1 \right) $};
            \end{tikzpicture}
        
            \caption{Set of all codewords $\mathcal{C}$}
            \label{fig:lp:poly:exact_ilp}
        \end{subfigure}%
        \begin{subfigure}[c]{0.16\textwidth}
            \centering
            \begin{tikzpicture}
                \node (relaxation) at (0, 0) {Relaxation};

                \draw (-1.5, 0) -- (relaxation);
                \draw[->] (relaxation) -- (1.5, 0);
            \end{tikzpicture}
        \end{subfigure}%
        \begin{subfigure}[c]{0.4\textwidth}
            \centering

            \tikzstyle{codeword} = [color=KITblue, fill=KITblue,
                                draw, circle, inner sep=0pt, minimum size=4pt]

            \tdplotsetmaincoords{60}{25}
            \begin{tikzpicture}[scale=0.9, tdplot_main_coords]
                % Cube

                \coordinate (p000) at (0, 0, 0);
                \coordinate (p001) at (0, 0, 2);
                \coordinate (p010) at (0, 2, 0);
                \coordinate (p011) at (0, 2, 2);
                \coordinate (p100) at (2, 0, 0);
                \coordinate (p101) at (2, 0, 2);
                \coordinate (p110) at (2, 2, 0);
                \coordinate (p111) at (2, 2, 2);

                \draw[] (p000) -- (p100);
                \draw[] (p100) -- (p101);
                \draw[] (p101) -- (p001);
                \draw[] (p001) -- (p000);

                \draw[dashed] (p010) -- (p110);
                \draw[]       (p110) -- (p111);
                \draw[]       (p111) -- (p011);
                \draw[dashed] (p011) -- (p010);

                \draw[dashed] (p000) -- (p010);
                \draw[]       (p100) -- (p110);
                \draw[]       (p101) -- (p111);
                \draw[]       (p001) -- (p011);

                % Polytope Vertices

                \node[codeword] (c000) at (p000) {};
                \node[codeword] (c011) at (p011) {};
                
                % Polytope Edges

                \draw[line width=1pt, color=KITblue] (c000) -- (c011);
                
                % Polytope Annotations

                \node[color=KITblue, below=0cm of c000] {$\left( 0, 0, 0 \right) $};
                \node[color=KITblue, above=0cm of c011] {$\left( 0, 1, 1 \right) $};
            \end{tikzpicture}
        
            \caption{Codeword polytope $\text{poly}\left( \mathcal{C} \right) $}
            \label{fig:lp:poly:exact}
        \end{subfigure}
    \end{figure}

%    \vspace*{-5mm}

    \begin{align*}
        \text{poly}\left( \mathcal{C} \right) =
            \left\{
                \sum_{\boldsymbol{c}\in\mathcal{C}}\alpha_{\boldsymbol{c}}
                    \boldsymbol{c} : \alpha_{\boldsymbol{c}} \ge  0,
                \sum_{\boldsymbol{c}\in\mathcal{C}}\alpha_{\boldsymbol{c}} = 1
            \right\},
            \hspace{5mm} \alpha_{\boldsymbol{c}} \in \mathbb{R}_{\ge 0}
    \end{align*}
\end{frame}

\begin{frame}[t]
    \frametitle{LP Relaxation}
  
    \vspace*{-1cm}

    \begin{figure}[H]
        \centering
   
        \begin{subfigure}[c]{0.48\textwidth}
            \centering

            \begin{minipage}{\textwidth}
                \centering
            
                \tikzstyle{codeword} = [color=KITblue, fill=KITblue,
                                    draw, circle, inner sep=0pt, minimum size=4pt]

                \tdplotsetmaincoords{60}{25}
                \begin{tikzpicture}[scale=0.7, tdplot_main_coords]
                    % Cube

                    \coordinate (p000) at (0, 0, 0);
                    \coordinate (p001) at (0, 0, 2);
                    \coordinate (p010) at (0, 2, 0);
                    \coordinate (p011) at (0, 2, 2);
                    \coordinate (p100) at (2, 0, 0);
                    \coordinate (p101) at (2, 0, 2);
                    \coordinate (p110) at (2, 2, 0);
                    \coordinate (p111) at (2, 2, 2);

                    \draw[] (p000) -- (p100);
                    \draw[] (p100) -- (p101);
                    \draw[] (p101) -- (p001);
                    \draw[] (p001) -- (p000);

                    \draw[dashed] (p010) -- (p110);
                    \draw[]       (p110) -- (p111);
                    \draw[]       (p111) -- (p011);
                    \draw[dashed] (p011) -- (p010);

                    \draw[dashed] (p000) -- (p010);
                    \draw[]       (p100) -- (p110);
                    \draw[]       (p101) -- (p111);
                    \draw[]       (p001) -- (p011);

                    % Polytope Vertices

                    \node[codeword] (c000) at (p000) {};
                    \node[codeword] (c101) at (p101) {};
                    \node[codeword] (c110) at (p110) {};
                    \node[codeword] (c011) at (p011) {};

                    % Polytope Edges & Faces

                    \draw[line width=1pt, color=KITblue] (c000) -- (c101);
                    \draw[line width=1pt, color=KITblue] (c000) -- (c110);
                    \draw[line width=1pt, color=KITblue] (c000) -- (c011);

                    \draw[line width=1pt, color=KITblue] (c101) -- (c110);
                    \draw[line width=1pt, color=KITblue] (c101) -- (c011);

                    \draw[line width=1pt, color=KITblue] (c011) -- (c110);
                    
                    \fill[KITblue, opacity=0.15] (p000) -- (p101) -- (p011) -- cycle;
                    \fill[KITblue, opacity=0.15] (p000) -- (p110) -- (p101) -- cycle;
                    \fill[KITblue, opacity=0.15] (p110) -- (p011) -- (p101) -- cycle;

                    % Polytope Annotations

                    \node[color=KITblue, below=0cm of c000]    {$\left( 0, 0, 0 \right) $};
                    \node[color=KITblue, right=0.07cm of c101] {$\left( 1, 0, 1 \right) $};
                    \node[color=KITblue, right=0cm of c110]    {$\left( 1, 1, 0 \right) $};
                    \node[color=KITblue, above=0cm of c011]    {$\left( 0, 1, 1 \right) $};

                    \node[color=KITblue, align=center] at (-4,1)
                        {$j=1$\\ $\left( c_1 + c_2+ c_3 = 0 \right) $};
                \end{tikzpicture}
            \end{minipage}

            \vspace{5mm}

            \begin{minipage}{\textwidth}
                \centering

                \tikzstyle{codeword} = [color=KITblue, fill=KITblue,
                                    draw, circle, inner sep=0pt, minimum size=4pt]

                \tdplotsetmaincoords{60}{25}
                \begin{tikzpicture}[scale=0.7, tdplot_main_coords]
                    % Cube

                    \coordinate (p000) at (0, 0, 0);
                    \coordinate (p001) at (0, 0, 2);
                    \coordinate (p010) at (0, 2, 0);
                    \coordinate (p011) at (0, 2, 2);
                    \coordinate (p100) at (2, 0, 0);
                    \coordinate (p101) at (2, 0, 2);
                    \coordinate (p110) at (2, 2, 0);
                    \coordinate (p111) at (2, 2, 2);

                    \draw[] (p000) -- (p100);
                    \draw[] (p100) -- (p101);
                    \draw[] (p101) -- (p001);
                    \draw[] (p001) -- (p000);

                    \draw[dashed] (p010) -- (p110);
                    \draw[]       (p110) -- (p111);
                    \draw[]       (p111) -- (p011);
                    \draw[dashed] (p011) -- (p010);

                    \draw[dashed] (p000) -- (p010);
                    \draw[]       (p100) -- (p110);
                    \draw[]       (p101) -- (p111);
                    \draw[]       (p001) -- (p011);

                    % Polytope Vertices

                    \node[codeword] (c000) at (p000) {};
                    \node[codeword] (c011) at (p011) {};
                    \node[codeword] (c100) at (p100) {};
                    \node[codeword] (c111) at (p111) {};

                    % Polytope Edges & Faces

                    \draw[line width=1pt, color=KITblue] (c000) -- (c011);
                    \draw[line width=1pt, color=KITblue] (c000) -- (c100);
                    \draw[line width=1pt, color=KITblue] (c100) -- (c111);
                    \draw[line width=1pt, color=KITblue] (c111) -- (c011);

                    \fill[KITblue, opacity=0.2] (p000) -- (p100) -- (p111) -- (p011) -- cycle;

                    % Polytope Annotations

                    \node[color=KITblue, below=0cm of c000] {$\left( 0, 0, 0 \right) $};
                    \node[color=KITblue, above=0cm of c011] {$\left( 0, 1, 1 \right) $};
                    \node[color=KITblue, below=0cm of c100] {$\left( 1, 0, 0 \right) $};
                    \node[color=KITblue, above=0cm of c111] {$\left( 1, 1, 1 \right) $};

                    \node[color=KITblue, align=center] at (-4,1)
                        {$j=2$\\ $\left(c_2 + c_3 = 0\right)$};
                \end{tikzpicture}
            \end{minipage}

            \caption{Local codeword polytopes $\mathcal{P}_{d_j}$ of the check nodes}
            \label{fig:lp:poly:local}
        \end{subfigure}%
        \begin{subfigure}[c]{0.18\textwidth}
            \centering
            \begin{tikzpicture}
                \draw[densely dashed] (0, -2) -- (0, 2);
                \draw[densely dashed] (-0.5, -2) -- (0, -2);
                \draw[densely dashed] (-0.5, 2) -- (0, 2);
                
                \node (intersection) at (1.5, 0) {Intersection};

                \draw[densely dashed] (0, 0) -- (intersection);
                \draw[densely dashed, ->] (intersection) -- (3,0);
            \end{tikzpicture}
        \end{subfigure}%
        \begin{subfigure}[c]{0.32\textwidth}
            \centering
        
            \vspace*{1.5cm}
            \tikzstyle{codeword} = [color=KITblue, fill=KITblue,
                                draw, circle, inner sep=0pt, minimum size=4pt]
            \tikzstyle{pseudocodeword} = [color=KITred, fill=KITred,
                                draw, circle, inner sep=0pt, minimum size=4pt]

            \tdplotsetmaincoords{60}{25}
            \begin{tikzpicture}[scale=0.9, tdplot_main_coords]
                % Cube

                \coordinate (p000) at (0, 0, 0);
                \coordinate (p001) at (0, 0, 2);
                \coordinate (p010) at (0, 2, 0);
                \coordinate (p011) at (0, 2, 2);
                \coordinate (p100) at (2, 0, 0);
                \coordinate (p101) at (2, 0, 2);
                \coordinate (p110) at (2, 2, 0);
                \coordinate (p111) at (2, 2, 2);

                \draw[] (p000) -- (p100);
                \draw[] (p100) -- (p101);
                \draw[] (p101) -- (p001);
                \draw[] (p001) -- (p000);

                \draw[dashed] (p010) -- (p110);
                \draw[]       (p110) -- (p111);
                \draw[]       (p111) -- (p011);
                \draw[dashed] (p011) -- (p010);

                \draw[dashed] (p000) -- (p010);
                \draw[]       (p100) -- (p110);
                \draw[]       (p101) -- (p111);
                \draw[]       (p001) -- (p011);

                % Polytope Vertices

                \node[codeword] (c000) at (p000) {};
                \node[codeword] (c011) at (p011) {};
                \node[pseudocodeword] (cpseudo) at (2, 1, 1) {};
 
                % Polytope Edges & Faces
                
                \draw[line width=1pt, color=KITblue] (c000) -- (c011);
                \draw[line width=1pt, color=KITred] (cpseudo) -- (c000);
                \draw[line width=1pt, color=KITred] (cpseudo) -- (c011);

                \fill[KITred, opacity=0.2] (p000) -- (p011) -- (2,1,1) -- cycle;

                % Polytope Annotations

                \node[color=KITblue, below=0cm of c000]   {$\left( 0, 0, 0 \right) $};
                \node[color=KITblue, above=0cm of c011] {$\left( 0, 1, 1 \right) $};
                \node[color=KITred, right=0cm of cpseudo]
                    {$\left( 1, \frac{1}{2}, \frac{1}{2} \right) $};
            \end{tikzpicture}
           
            \vspace*{-5mm}

            \begin{gather*}
                \boldsymbol{T}_j\tilde{\boldsymbol{c}} \in \mathcal{P}_{d_j}, \hspace{2mm}
                \forall j\in \mathcal{J} \\[0.5em]
                    \boldsymbol{T}_j \in \mathbb{F}_2^{d_j \times n}
            \end{gather*}
        
            \vspace*{-2mm}

            \caption{Relaxed codeword polytope $\overline{Q}$}
            \label{fig:lp:poly:relaxed}
        \end{subfigure}
    \end{figure}
\end{frame}


\begin{frame}[t]
    \frametitle{LP Relaxation}
  
    \vspace{-5mm}

    \begin{figure}[H]
        \centering

        \begin{subfigure}[t]{0.3\textwidth}
            \centering
            \tikzstyle{codeword} = [color=KITblue, fill=KITblue,
                                draw, circle, inner sep=0pt, minimum size=4pt]
            \tdplotsetmaincoords{60}{25}
            \begin{tikzpicture}[scale=0.8, tdplot_main_coords]
                % Cube

                \coordinate (p000) at (0, 0, 0);
                \coordinate (p001) at (0, 0, 2);
                \coordinate (p010) at (0, 2, 0);
                \coordinate (p011) at (0, 2, 2);
                \coordinate (p100) at (2, 0, 0);
                \coordinate (p101) at (2, 0, 2);
                \coordinate (p110) at (2, 2, 0);
                \coordinate (p111) at (2, 2, 2);

                \draw[] (p000) -- (p100);
                \draw[] (p100) -- (p101);
                \draw[] (p101) -- (p001);
                \draw[] (p001) -- (p000);

                \draw[dashed] (p010) -- (p110);
                \draw[]       (p110) -- (p111);
                \draw[]       (p111) -- (p011);
                \draw[dashed] (p011) -- (p010);

                \draw[dashed] (p000) -- (p010);
                \draw[]       (p100) -- (p110);
                \draw[]       (p101) -- (p111);
                \draw[]       (p001) -- (p011);

                % Polytope Vertices

                \node[codeword] (c000) at (p000) {};
                \node[codeword] (c011) at (p011) {};
                
                % Polytope Annotations

                \node[color=KITblue, below=0cm of c000] {$\left( 0, 0, 0 \right) $};
                \node[color=KITblue, above=0cm of c011] {$\left( 0, 1, 1 \right) $};
            \end{tikzpicture}

            \begin{align*}
                \text{minimize}\hspace{2mm} &\boldsymbol{\gamma}^\text{T} \boldsymbol{c} \\
                \text{subject to}\hspace{2mm} &\boldsymbol{c} \in \mathcal{C}
            \end{align*}

            \caption{\textit{Integer linear program} (ILP)}
        \end{subfigure}%
        \hfill%
        \begin{subfigure}[t]{0.3\textwidth}
            \centering
            \tikzstyle{codeword} = [color=KITblue, fill=KITblue,
                                draw, circle, inner sep=0pt, minimum size=4pt]
            \tdplotsetmaincoords{60}{25}
            \begin{tikzpicture}[scale=0.8, tdplot_main_coords]
                % Cube

                \coordinate (p000) at (0, 0, 0);
                \coordinate (p001) at (0, 0, 2);
                \coordinate (p010) at (0, 2, 0);
                \coordinate (p011) at (0, 2, 2);
                \coordinate (p100) at (2, 0, 0);
                \coordinate (p101) at (2, 0, 2);
                \coordinate (p110) at (2, 2, 0);
                \coordinate (p111) at (2, 2, 2);

                \draw[] (p000) -- (p100);
                \draw[] (p100) -- (p101);
                \draw[] (p101) -- (p001);
                \draw[] (p001) -- (p000);

                \draw[dashed] (p010) -- (p110);
                \draw[]       (p110) -- (p111);
                \draw[]       (p111) -- (p011);
                \draw[dashed] (p011) -- (p010);

                \draw[dashed] (p000) -- (p010);
                \draw[]       (p100) -- (p110);
                \draw[]       (p101) -- (p111);
                \draw[]       (p001) -- (p011);

                % Polytope Vertices

                \node[codeword] (c000) at (p000) {};
                \node[codeword] (c011) at (p011) {};
                
                % Polytope Edges

                \draw[line width=1pt, color=KITblue] (c000) -- (c011);
                
                % Polytope Annotations

                \node[color=KITblue, below=0cm of c000] {$\left( 0, 0, 0 \right) $};
                \node[color=KITblue, above=0cm of c011] {$\left( 0, 1, 1 \right) $};
            \end{tikzpicture}

            \begin{align*}
                \text{minimize}\hspace{2mm} &\boldsymbol{\gamma}^\text{T} \boldsymbol{c} \\
                \text{subject to}\hspace{2mm} &\tilde{\boldsymbol{c}} \in
                    \text{poly}\left( \mathcal{C} \right) &\
            \end{align*}

            \caption{Motivation}
        \end{subfigure}%
        \hfill%
        \begin{subfigure}[t]{0.3\textwidth}
            \centering
            \tikzstyle{codeword} = [color=KITblue, fill=KITblue,
                                draw, circle, inner sep=0pt, minimum size=4pt]
            \tikzstyle{pseudocodeword} = [color=KITred, fill=KITred,
                                draw, circle, inner sep=0pt, minimum size=4pt]
            \tdplotsetmaincoords{60}{25}
            \begin{tikzpicture}[scale=0.8, tdplot_main_coords]
                % Cube

                \coordinate (p000) at (0, 0, 0);
                \coordinate (p001) at (0, 0, 2);
                \coordinate (p010) at (0, 2, 0);
                \coordinate (p011) at (0, 2, 2);
                \coordinate (p100) at (2, 0, 0);
                \coordinate (p101) at (2, 0, 2);
                \coordinate (p110) at (2, 2, 0);
                \coordinate (p111) at (2, 2, 2);

                \draw[] (p000) -- (p100);
                \draw[] (p100) -- (p101);
                \draw[] (p101) -- (p001);
                \draw[] (p001) -- (p000);

                \draw[dashed] (p010) -- (p110);
                \draw[]       (p110) -- (p111);
                \draw[]       (p111) -- (p011);
                \draw[dashed] (p011) -- (p010);

                \draw[dashed] (p000) -- (p010);
                \draw[]       (p100) -- (p110);
                \draw[]       (p101) -- (p111);
                \draw[]       (p001) -- (p011);

                % Polytope Vertices

                \node[codeword] (c000) at (p000) {};
                \node[codeword] (c011) at (p011) {};
                \node[pseudocodeword] (cpseudo) at (2, 1, 1) {};
 
                % Polytope Edges & Faces
                
                \draw[line width=1pt, color=KITblue] (c000) -- (c011);
                \draw[line width=1pt, color=KITred] (cpseudo) -- (c000);
                \draw[line width=1pt, color=KITred] (cpseudo) -- (c011);

                \fill[KITred, opacity=0.2] (p000) -- (p011) -- (2,1,1) -- cycle;

                % Polytope Annotations

                \node[color=KITblue, below=0cm of c000]   {$\left( 0, 0, 0 \right) $};
                \node[color=KITblue, above=0cm of c011] {$\left( 0, 1, 1 \right) $};
                \node[color=KITred, right=0cm of cpseudo]
                    {$\left( 1, \frac{1}{2}, \frac{1}{2} \right) $};
            \end{tikzpicture}
            
            \begin{align*}
                \text{minimize}\hspace{2mm} &\boldsymbol{\gamma}^\text{T} \tilde{\boldsymbol{c}} \\
                \text{subject to}\hspace{2mm} &
                    \boldsymbol{T}_j\tilde{\boldsymbol{c}} \in \mathcal{P}_{d_j}, \hspace{2mm}
                        \forall j\in \mathcal{J}
            \end{align*}

            \caption{\textit{Linear code linear program} (LCLP)}
        \end{subfigure}%
    \end{figure}

    \vspace*{-5.75cm}
    \begin{figure}[H]
        \centering
        
        \begin{subfigure}[t]{0.36\textwidth}
            \centering

            \begin{tikzpicture}
                \node (relaxation) at (0, 0) {Relaxation};

                \draw[->] (-1, -0.25) -- (1, -0.25);
%                \draw (-1.5, 0) -- (relaxation);
%                \draw[->] (relaxation) -- (1.5, 0);
            \end{tikzpicture}
        \end{subfigure}%
        \begin{subfigure}[t]{0.31\textwidth}
            \centering
            \begin{tikzpicture}
                \node (relaxation) at (0, 0) {Relaxation};

                \draw[->] (-1, -0.25) -- (1, -0.25);
%                \draw (-1.5, 0) -- (relaxation);
%                \draw[->] (relaxation) -- (1.5, 0);
            \end{tikzpicture}
        \end{subfigure}%
    \end{figure}

\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{LP Decoding using ADMM}%
\label{sub:LP Decoding using ADMM}


\begin{frame}[t]
    \frametitle{LP Decoding using ADMM}

    \begin{itemize}
        \item Solution using the \textit{alternating direction method of multipliers} (ADMM)
        \item Slight reformulation of the LCLP:
            \begin{align*}
                \begin{aligned}
                    \text{minimize}\hspace{2mm} &\boldsymbol{\gamma}^\text{T}\tilde{\boldsymbol{c}}
                        + \sum_{j\in\mathcal{J}} g_j\left( \boldsymbol{z}_j \right) \\
                    \text{subject to}\hspace{2mm} &
                        \boldsymbol{T}_j\tilde{\boldsymbol{c}} = \boldsymbol{z}_j, \hspace{2mm}
                            \forall j\in \mathcal{J}
                \end{aligned}\hspace{2mm},\hspace{1cm}
                g_j\left( \boldsymbol{t} \right)  := \begin{cases}
                        0, & \boldsymbol{t} \in \mathcal{P}_{d_j} \\
                        +\infty, & \boldsymbol{t} \not\in \mathcal{P}_{d_j}
                    \end{cases}
            \end{align*}
        \item Iterative algorithm:
            \begin{alignat*}{3}
                \tilde{\boldsymbol{c}} &\leftarrow \argmin_{\tilde{\boldsymbol{c}}}
                    \left( \boldsymbol{\gamma}^\text{T}\tilde{\boldsymbol{c}}
                    + \frac{\rho}{2}\sum_{j\in\mathcal{J}} \left\Vert
                        \boldsymbol{T}_j\tilde{\boldsymbol{c}} - \boldsymbol{z}_j
                        + \boldsymbol{u}_j \right\Vert \right) \\
                \boldsymbol{z}_j &\leftarrow \argmin_{\boldsymbol{z}_j}
                    \left( g\left( \boldsymbol{z}_j \right)
                    + \frac{\rho}{2} \left\Vert \boldsymbol{T}_j \tilde{\boldsymbol{c}}
                    - \boldsymbol{z}_j + \boldsymbol{u}_j \right\Vert \right),
                    \hspace{5mm} &&\forall j\in\mathcal{J} \\
                \boldsymbol{u}_j &\leftarrow \boldsymbol{u}_j
                    + \boldsymbol{T}_j\tilde{\boldsymbol{c}} - \boldsymbol{z}_j,
                    \hspace{5mm} &&\forall j\in\mathcal{J}
%                    \left( g\left( \boldsymbol{\boldsymbol{z}_j} \right)
%                    + \frac{\rho}{2} \left\Vert \boldsymbol{T}_j\tilde{\boldsymbol{c}}
%                    - \boldsymbol{z}_j + \boldsymbol{u}_j\right\Vert \right) 
            \end{alignat*}
    \end{itemize} 
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]
    \frametitle{LP Decoding using ADMM}
    
    \begin{itemize}
        \item Simplified rules%
            \footnote{$\left( \boldsymbol{z}_j \right)_i $ is a slight abuse of notation.
            What is actually meant is the component of $\boldsymbol{z}_j$ that is associated
            with the VN $i$, i.e., $\left( \boldsymbol{T}_j^\text{T} \boldsymbol{z}_j \right)_i$.\\
            The same is true for $\left( \boldsymbol{u}_j \right)_i$}%
            :

            \begin{alignat*}{3}
                \tilde{c}_i &\leftarrow \frac{1}{\left| N_v\left( i \right) \right|} \left( 
                    \sum_{j\in N_v\left( i \right) } \Big( \left( \boldsymbol{z}_j \right)_i
                        - \left( \boldsymbol{u}_j \right)_i \Big)
                    - \frac{\gamma_i}{\mu} \right)
                \hspace{5mm} && \forall i\in\mathcal{I} \\
                \boldsymbol{z}_j &\leftarrow \Pi_{\mathcal{P}_{d_j}}\left(
                    \boldsymbol{T}_j\tilde{\boldsymbol{c}} + \boldsymbol{u}_j \right)
                \hspace{5mm} && \forall j\in\mathcal{J} \\
                \boldsymbol{u}_j &\leftarrow \boldsymbol{u}_j
                    + \boldsymbol{T}_j\tilde{\boldsymbol{c}}
                    - \boldsymbol{z}_j
                \hspace{5mm} && \forall j\in\mathcal{J}
            \end{alignat*}
        \item The main computational effort are the projections
            $\Pi_{\mathcal{P}_{d_j}}, \hspace{1mm} j\in\mathcal{J}$. Many
            different approaches exist, e.g., \cite{original_admm},
            \cite{efficient_lp_dec_admm}, \cite{lautern}.
        \item The approach chosen here is the one described in \cite{lautern}
    \end{itemize}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t, fragile]
    \frametitle{Comparison of Proximal Decoding and \\LP Decoding using ADMM}
   
    \vspace*{-0.75cm}

    \begin{itemize}
        \item Both algorithms can be understood as message passing algorithms
    \end{itemize}
    
    \vspace*{-0.25cm}

    \begin{figure}[h]
        \centering

        \begin{subfigure}{0.48\textwidth}
            \centering
            
            \begin{algorithm}[caption={}, label={},]
Initialize $\boldsymbol{r}, \boldsymbol{s}, \omega, \gamma$
while stopping critierion unfulfilled do
    for j in $\mathcal{J}$ do
        $p_j \leftarrow \prod_{i\in N_c\left( j \right) } r_i $
        $\textcolor{KITblue}{M_{j\to} \leftarrow p_j^2 - p_j}$|\Suppressnumber|
|\vspace{0.7mm}\Reactivatenumber|
    end for
    for i in $\mathcal{I}$ do
        $s_i \leftarrow s_i + \gamma \left[ 4\left( s_i^2 - 1 \right)s_i
            \phantom{\frac{4}{s_i}}\right.$|\Suppressnumber|
                     |\Reactivatenumber|$\left.+ \frac{4}{s_i}\sum_{j\in N_v\left( i \right) }
                        M_{j\to} \right] $
        $r_i \leftarrow r_i + \omega \left( s_i - y_i \right)$
    end for
end while
            \end{algorithm}
        \end{subfigure}%
        \hfill
        \begin{subfigure}{0.48\textwidth}
            \centering
            
            \begin{algorithm}[caption={}, label={},]
Initialize $\tilde{\boldsymbol{c}}, \boldsymbol{z}, \boldsymbol{u}, \boldsymbol{\gamma}, \rho$
while stopping criterion unfulfilled do
    for j in $\mathcal{J}$ do
        $\boldsymbol{z}_j \leftarrow \Pi_{P_{d_j}}\left(
            \boldsymbol{T}_j\tilde{\boldsymbol{c}} + \boldsymbol{u}_j\right)$
        $\boldsymbol{u}_j \leftarrow \boldsymbol{u}_j + \boldsymbol{T}_j\tilde{\boldsymbol{c}}
            - \boldsymbol{z}_j$
        $\textcolor{KITblue}{M_{j\to i} \leftarrow \left( z_j \right)_i - \left( u_j \right)_i,
            \hspace{3mm} \forall i \in N_c\left( j \right)}$
    end for
    for i in $\mathcal{I}$ do
        $\tilde{c}_i \leftarrow \frac{1}{d_i}
            \left(\sum_{j\in N_v\left( i \right) } M_{j\to i}
                - \frac{\gamma_i}{\mu} \right)$|\Suppressnumber|
|\vspace{7mm}\Reactivatenumber|
    end for
end while
            \end{algorithm}
        \end{subfigure}%
    \end{figure}%
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\begin{frame}[t]
%    \frametitle{LP Relaxation}
%
%    \begin{minipage}[c]{0.6\linewidth}
%        \begin{itemize}
%            \item Set of all variable nodes incident to a check node:
%                \begin{align*}
%                    N\left( j \right) \equiv \left\{
%                        i | i\in \mathcal{I},
%                        \boldsymbol{H}_{j,i} = 1
%                    \right\},
%                    j \in \mathcal{J}
%                \end{align*}
%                \begin{align*}
%                    S \subseteq N\left( j \right), \left| S \right| \text{odd}
%                \end{align*}
%            \item Relaxed polytope representation:
%                \begin{align*}
%                    \sum_{i\in \left( N\left( j \right) \setminus S\right) } f_i
%                        + \sum_{i\in S} \left( 1 - f_i \right) \ge 1
%                \end{align*}
%                ``$\boldsymbol{f}$ is separated by at least one bitflip
%                from all illegal configurations''
%        \end{itemize}
%    \end{minipage}%
%    \hfill%
%    \begin{minipage}[c]{0.4\linewidth}
%        \begin{figure}[H]
%            \centering
%
%            \tikzstyle{codeword} = [color=KITblue, fill=KITblue,
%                                    draw, circle, inner sep=0pt, minimum size=4pt]
%
%            \tdplotsetmaincoords{60}{245}
%            \begin{tikzpicture}[scale=1, transform shape, tdplot_main_coords]
%                % Cube
%
%                \draw[dashed] (0, 0, 0) -- (2, 0, 0);
%                \draw[dashed] (2, 0, 0) -- (2, 0, 2);
%                \draw[] (2, 0, 2) -- (0, 0, 2);
%                \draw[] (0, 0, 2) -- (0, 0, 0);
%
%                \draw[] (0, 2, 0) -- (2, 2, 0);
%                \draw[] (2, 2, 0) -- (2, 2, 2);
%                \draw[] (2, 2, 2) -- (0, 2, 2);
%                \draw[] (0, 2, 2) -- (0, 2, 0);
%
%                \draw[] (0, 0, 0) -- (0, 2, 0);
%                \draw[dashed] (2, 0, 0) -- (2, 2, 0);
%                \draw[] (2, 0, 2) -- (2, 2, 2);
%                \draw[] (0, 0, 2) -- (0, 2, 2);
%
%                % Codeword Polytope
%
%                \draw[line width=1pt, color=KITblue] (0, 0, 0) -- (2, 0, 2);
%                \draw[line width=1pt, color=KITblue] (0, 0, 0) -- (2, 2, 0);
%                \draw[line width=1pt, color=KITblue] (0, 0, 0) -- (0, 2, 2);
%
%                \draw[line width=1pt, color=KITblue] (2, 0, 2) -- (2, 2, 0);
%                \draw[line width=1pt, color=KITblue] (2, 0, 2) -- (0, 2, 2);
%
%                \draw[line width=1pt, color=KITblue] (0, 2, 2) -- (2, 2, 0);
%
%                % Polytope Annotations
%
%                \node[codeword, color=KITred] (c111) at (2, 2, 2) {};% {$\left( 0, 0, 0 \right) $};
%                \node[codeword, color=KITred] (c001) at (0, 0, 2) {};% {$\left( 1, 0, 1 \right) $};
%                \node[codeword, color=KITred] (c100) at (2, 0, 0) {};% {$\left( 1, 1, 0 \right) $};
%                \node[codeword, color=KITred] (c010) at (0, 2, 0) {};% {$\left( 0, 1, 1 \right) $};
%
%                \node[color=KITred, left=0cm of c111] {$\left( 1, 1, 1 \right) $};
%                \node[color=KITred, right=0cm of c001] {$\left( 0, 0, 1 \right) $};
%                \node[color=KITred, right=0.35cm of c100] {$\left( 1, 0, 0 \right) $};
%                \node[color=KITred, below=0cm of c010] {$\left( 0, 1, 0 \right) $};
%            \end{tikzpicture}
%            \caption{Relaxed polytope for $n=3$}
%        \end{figure}
%    \end{minipage}
%    \todo{How is this a relaxation and not just an alternative formulation?
%        We have just switched out valid codewords for invalid ones}
%    \todo{Is LP Relaxation relevant as theoretical background?}
%\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\subsection{ADMM}%
%\label{sub:Alg ADMM}
%
%\begin{frame}[t]
%    \frametitle{ADMM Decoding: General Idea}
%
%    \todo{TODO}
%\end{frame}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\begin{frame}[t]
%    \frametitle{ADMM Decoding: Algorithm}
%
%    \todo{TODO}
%\end{frame}

