# Chambolle-Pock algorithm

In mathematics, the Chambolle-Pock algorithm is an algorithm used to solve convex optimization problems. It was introduced by Antonin Chambolle and Thomas Pock in 2011 and has since become a widely used method in various fields, including image processing, computer vision, and signal processing.
The Chambolle-Pock algorithm is specifically designed to efficiently solve convex optimization problems that involve the minimization of a non-smooth cost function composed of a data fidelity term and a regularization term. This is a typical configuration that commonly arises in ill-posed imaging inverse problems such as image reconstruction, denoising and inpainting.
The algorithm is based on a primal-dual formulation, which allows for simultaneous updates of primal and dual variables. By employing the proximal operator, the Chambolle-Pock algorithm efficiently handles non-smooth and non-convex regularization terms, such as the total variation, specific in imaging framework.

## Problem statement

Let be ${\mathcal {X}},{\mathcal {Y}}$ two real vector spaces equipped with an inner product $\langle \cdot ,\cdot \rangle$ and a norm $\lVert \,\cdot \,\rVert =\langle \cdot ,\cdot \rangle ^{\frac {1}{2}}$. From up to now, a function $F$ is called simple if its proximal operator ${\text{prox}}_{\tau F}$ has a closed-form representation or can be accurately computed, for $\tau >0$, where ${\text{prox}}_{\tau F}$ is referred to
    $x={\text{prox}}_{\tau F}({\tilde {x}})={\text{arg }}\min _{x'\in {\mathcal {X}}}\left\{{\frac {\lVert x'-{\tilde {x}}\rVert ^{2}}{2\tau }}+F(x')\right\}$
Consider the following constrained primal problem:
    $\min _{x\in {\mathcal {X}}}F(Kx)+G(x)$
where $K:{\mathcal {X}}\rightarrow {\mathcal {Y}}$ is a bounded linear operator, $F:{\mathcal {Y}}\rightarrow [0,+\infty ),G:{\mathcal {X}}\rightarrow [0,+\infty )$ are convex, lower semicontinuous and simple.
The minimization problem has its dual corresponding problem as
    $\max _{y\in {\mathcal {Y}}}-\left(G^{*}(-K^{*}y)+F^{*}(y)\right)$
where $F^{*},G^{*}$ and $K^{*}$ are the dual map of $F,G$ and $K$, respectively.
Assume that the primal and the dual problems have at least a solution $({\hat {x}},{\hat {y}})\in {\mathcal {X}}\times {\mathcal {Y}}$, that means they satisfies
${\begin{aligned}K{\hat {x}}&\in \partial F^{*}({\hat {y}})\\-(K^{*}{\hat {y}})&\in \partial G({\hat {x}})\end{aligned}}$
where $\partial F^{*}$ and $\partial G$ are the subgradient of the convex functions $F^{*}$ and $G$, respectively.
The Chambolle-Pock algorithm solves the so-called saddle-point problem
    $\min _{x\in {\mathcal {X}}}\max _{y\in {\mathcal {Y}}}\langle Kx,y\rangle +G(x)-F^{*}(y)$
which is a primal-dual formulation of the nonlinear primal and dual problems stated before.

## Algorithm

The Chambolle-Pock algorithm primarily involves iteratively alternating between ascending in the dual variable $y$ and descending in the primal variable $x$ using a gradient-like approach, with step sizes $\sigma$ and $\tau$ respectively, in order to simultaneously solve the primal and the dual problem. Furthermore, an over-relaxation technique is employed for the primal variable with the parameter $\theta$.
* "←" denotes assignment. For instance, "largest ← item" means that the value of largest changes to the value of item.
* "return" terminates the algorithm and outputs the following value.
Chambolle and Pock proved that the algorithm converges if $\theta =1$ and $\tau \sigma \lVert K\rVert ^{2}\leq 1$, sequentially and with ${\mathcal {O}}(1/N)$ as rate of convergence for the primal-dual gap. This has been extended by S. Banert et al. to hold whenever $\theta >1/2$ and $\tau \sigma \lVert K\rVert ^{2}<4/(1+2\theta )$.
The semi-implicit Arrow-Hurwicz method coincides with the particular choice of $\theta =0$ in the Chambolle-Pock algorithm.

## Acceleration

There are special cases in which the rate of convergence has a theoretical speed up. In fact, if $G$, respectively $F^{*}$, is uniformly convex then $G^{*}$, respectively $F$, has a Lipschitz continuous gradient. Then, the rate of convergence can be improved to ${\mathcal {O}}(1/N^{2})$, providing a slightly changes in the Chambolle-Pock algorithm. It leads to an accelerated version of the method and it consists in choosing iteratively $\tau _{n},\sigma _{n}$, and also $\theta _{n}$, instead of fixing these values.
In case of $G$ uniformly convex, with $\gamma >0$ the uniform-convexity constant, the modified algorithm becomes
* "←" denotes assignment. For instance, "largest ← item" means that the value of largest changes to the value of item.
* "return" terminates the algorithm and outputs the following value.
Moreover, the convergence of the algorithm slows down when $L$, the norm of the operator $K$, cannot be estimated easily or might be very large. Choosing proper preconditioners $T$ and $\Sigma$, modifying the proximal operator with the introduction of the induced norm through the operators $T$ and $\Sigma$, the convergence of the proposed preconditioned algorithm will be ensured.

## Application

A typical application of this algorithm is in the image denoising framework, based on total variation. It operates on the concept that signals containing excessive and potentially erroneous details exhibit a high total variation, which represents the integral of the absolute value gradient of the image. By adhering to this principle, the process aims to decrease the total variation of the signal while maintaining its similarity to the original signal, effectively eliminating unwanted details while preserving crucial features like edges. In the classical bi-dimensional discrete setting, consider ${\mathcal {X}}=\mathbb {R} ^{NM}$, where an element $u\in {\mathcal {X}}$ represents an image with the pixels values collocated in a Cartesian grid $N\times M$.
Define the inner product on ${\mathcal {X}}$ as
    $\langle u,v\rangle _{\mathcal {X}}=\sum _{i,j}u_{i,j}v_{i,j},\quad u,v\in {\mathcal {X}}$
that induces an $L^{2}$ norm on ${\mathcal {X}}$, denoted as $\lVert \,\cdot \,\rVert _{2}$.
Hence, the gradient of $u$ is computed with the standard finite differences,
    $\left(\nabla u\right)_{i,j}=\left({\begin{aligned}\left(\nabla u\right)_{i,j}^{1}\\\left(\nabla u\right)_{i,j}^{2}\end{aligned}}\right)$
which is an element of the space ${\mathcal {Y}}={\mathcal {X}}\times {\mathcal {X}}$, where
    ${\begin{aligned}&\left(\nabla u\right)_{i,j}^{1}=\left\{{\begin{aligned}&{\frac {u_{i+1,j}-u_{i,j}}{h}}&{\text{ if }}i<M\\&0&{\text{ if }}i=M\end{aligned}}\right.,\\&\left(\nabla u\right)_{i,j}^{2}=\left\{{\begin{aligned}&{\frac {u_{i,j+1}-u_{i,j}}{h}}&{\text{ if }}j<N\\&0&{\text{ if }}j=N\end{aligned}}\right.\end{aligned}}$
On ${\mathcal {Y}}$ is defined an $L^{1}-$ based norm as
    $\lVert p\rVert _{1}=\sum _{i,j}{\sqrt {\left(p_{i,j}^{1}\right)^{2}+\left(p_{i,j}^{2}\right)^{2}}},\quad p\in {\mathcal {Y}}.$
Then, the primal problem of the ROF model, proposed by Rudin, Osher, and Fatemi, is given by
    $h^{2}\min _{u\in {\mathcal {X}}}\lVert \nabla u\rVert _{1}+{\frac {\lambda }{2}}\lVert u-g\rVert _{2}^{2}$
where $u\in {\mathcal {X}}$ is the unknown solution and $g\in {\mathcal {X}}$ the given noisy data, instead $\lambda$ describes the trade-off between regularization and data fitting.
The primal-dual formulation of the ROF problem is formulated as follow
    $\min _{u\in {\mathcal {X}}}\max _{p\in {\mathcal {Y}}}-\langle u,{\text{div}}\,p\rangle _{\mathcal {X}}+{\frac {\lambda }{2}}\lVert u-g\rVert _{2}^{2}-\delta _{P}(p)$
where the indicator function is defined as
    $\delta _{P}(p)=\left\{{\begin{aligned}&0,&{\text{if }}p\in P\\&+\infty ,&{\text{if }}p\notin P\end{aligned}}\right.$
on the convex set $P=\left\{p\in {\mathcal {Y}}\,:\,\max _{i,j}{\sqrt {\left(p_{i,j}^{1}\right)^{2}+\left(p_{i,j}^{2}\right)^{2}}}\leq 1\right\},$ which can be seen as $L^{\infty }$ unitary balls with respect to the defined norm on ${\mathcal {Y}}$.
Observe that the functions involved in the stated primal-dual formulation are simple, since their proximal operator can be easily computed${\begin{aligned}p&={\text{prox}}_{\sigma F^{*}}({\tilde {p}})&\iff p_{i,j}&={\frac {{\tilde {p}}_{i,j}}{\max\{1,|{\tilde {p}}_{i,j}|\}}}\\u&={\text{prox}}_{\tau G}({\tilde {u}})&\iff u_{i,j}&={\frac {{\tilde {u}}_{i,j}+\tau \lambda g_{i,j}}{1+\tau \lambda }}\end{aligned}}$The image total-variation denoising problem can be also treated with other algorithms such as the alternating direction method of multipliers (ADMM), projected (sub)-gradient or fast iterative shrinkage thresholding.

## Implementation

* The Manopt.jl package implements the algorithm in Julia
* Gabriel Peyré implements the algorithm in MATLAB, Julia, R and Python
* In the Operator Discretization Library (ODL), a Python library for inverse problems, chambolle_pock_solver implements the method.