\input{template}
\input{macros}

\usepackage{color, graphicx}
\usepackage{amssymb, amsmath}
\usepackage{epsfig}


\begin{document}
\lecture{26}{Primal-Dual Algorithm for Shortest Path Problem}{Arindam Bose}
%% -----------------------------------------------------------------------------
%%                          Beginning of Section 1.
%% -----------------------------------------------------------------------------

\section{Overview}
In the previous lecture, we saw the formulation of the Integer Linear
Program for the shortest path algorithm. In this lecture we formulate and solve the dual.


\section{The formulation of the shortest path problem}


\subsection*{Input:}

A directed graph with positive integer weights, $s,t\in V$


\subsection*{Output: }

Shortest path from $s$ to $t$


\subsection*{Variables:}

We choose one variable per edge, $x_{e}$. If $x_{e}$ is picked,
$x_{e}=1$ else $x_{e}=0$. $w_{e}$ is the value of the weight of
edge $e$


\subsection*{Cost:}

The cost function is ${\min\,\sum}_{u,v}x_{uv}w_{uv}$


\subsection*{Constraints:}

\begin{enumerate}
\item $\sum_{u}x_{su}-\sum_{v}x_{vs}=1$ (The difference in the number of
edges leaving $s$ and entering into $s$ is 1)
\item $\sum_{v}x_{vt}-\sum_{u}x_{tu}=1$ (The difference in the number of
edges entering into $t$ and leaving $t$ is 1)
\item $\forall p\in V-\{ s,t\}\,\,\sum_{q}x_{pq}-\sum_{r}x_{rp}=0$ (For
all other vertices, edges leaving them is equal to the edges entering
into them)
\item $0\leq x\leq1,\,\, x$ is integer. We drop integer and upper bound
constraints on $x$ as in the case of MST.
\end{enumerate}

\section{The Dual}

The resulting dual of the primal will have one variable for each vertex
in the graph.

\begin{gather*}
\max{\, y}_{s}-y_{t} \\
\forall u,v\,\, y_{u}-y_{v}\leq w_{uv}
\end{gather*}



\subsection*{Algorithm}

We try to devise a strategy to solve for the values of $y$ subject
to the constraint that $y_{u}-y_{v}\leq w_{uv}$ and maximising the
objective function $y_{s}-y_{t}$. The general scheme while trying
to go about finding a solution would be as follows:

\begin{enumerate}
\item Start with a feasible dual solution.
\item Always maintain dual feasibility.
\item Try and improve.
\end{enumerate}
Now, if $y$ is a solution, $y\pm\delta$ will also be a solution
since the constraints would be satisfied. So, the value of $y_{t}$
is arbitrarily set to $0$. Further, we start by setting $y_{u}=0\,\forall u$
and we try to improve the solution thereupon. We will facilitate this
process using the marbles and strings analogy described below.


\subsubsection*{Marbles and Strings analogy}

Consider the vertices of the graph as marbles and the edges as inextensible
strings (wound to the marbles) with lengths equal to the value of
the weights of the corresponding edges. The value $y_{u}$ for vertex
$u$ is interpreted as the distance of node $u$ from the node $t$
($y_{t}=0$, as assumed before). We start by assigning the values
of $y_{u}=0\,\forall u$, the situation which is represented by all
the marbles being at the position of marble $t$. Thus, all the strings
are slack at this initial point. 

Now, maintaining the value of $y_{t}$ at $0$ (keeping the position
of marble $t$ fixed), the values of all other \emph{$y's$} are raised
\emph{simultaneously} (this ensures that the dual feasibilty is maintained).
This would be analogous to pulling all the marbles simultaneously
(in a straight line) away from marble $t$. This is done till one
of the strings joining marble $t$ becomes taut. Suppose it is the
string that joins marble $m$ to $t$ that has become taut. At this
point, $y_{m}=w_{mt}$, and we can no longer pull this particular
marble away from $t$ if dual feasibilty is to be maintained. So we
fix the position of this marble $m$ now and start pulling all the
other marbles till another string becomes taut. We again fix the position
of that corresponding marble and keep pulling the other marbles. This
process is continued until we find that in due time one of the strings
attached to marble $s$ has become taut at which point that has to
be fixed. At this point, all the strings corresponding to the edges
that belong to the shortest path are taut. Among the edges that have
become tight, there are some edges which are not part of the shortest
path. These can be removed using the \emph{reverse delete procedure}
described below.


\subsubsection*{Reverse Delete Procedure:}

Consider edges in reverse order of them becoming tight. Delete the
edge and now check if a path exists from $s$ to $t$. If a path does
exist, then this edge is not a part of the shortest path and it should
be removed from the solution set.

Proof that the value of primal optimal is equal to the value of dual
optimal:
 \begin{equation*}
 \sum_{(u,v)\, chosen}w_{uv}=\sum_{(u,v)\, chosen}(y_{u}-y_{v})=y_{s}-y_{t}
\end{equation*}

\end{document}
