%\documentstyle[10pt,twoside]{article}
%\documentstyle[twoside]{article}
\documentclass[twoside]{article}
\setlength{\oddsidemargin}{0 in}
\setlength{\evensidemargin}{0 in}
\setlength{\topmargin}{-0.6 in}
\setlength{\textwidth}{6.7 in}
\setlength{\textheight}{8.5 in}
\setlength{\headsep}{0.75 in}
\setlength{\parindent}{0 in}
\setlength{\parskip}{0.1 in}
\usepackage{amsmath,amssymb,enumerate,algorithm,ifthen,algorithmic}

% The following commands sets up the lecnum (lecture number)
% counter and make various numbering schemes work relative
% to the lecture number. Don't edit them!
%
\newcounter{lecnum}
\renewcommand{\thepage}{\thelecnum-\arabic{page}}
\renewcommand{\thesection}{\thelecnum.\arabic{section}}
\renewcommand{\theequation}{\thelecnum.\arabic{equation}}
\renewcommand{\thefigure}{\thelecnum.\arabic{figure}}
\renewcommand{\thetable}{\thelecnum.\arabic{table}}

\newtheorem{theorem}{Theorem} 
\newtheorem{lemma}{Lemma} 
\newtheorem{claim}{Claim} 
\newtheorem{proposition}{Proposition} 
\newtheorem{prob}{Problem} 
\newtheorem{corollary}{Corollary} 
\newtheorem{question}{Question} 
\newtheorem{conjecture}{Conjecture} 
\newtheorem{example}{Example} 
\newtheorem{definition}{Definition} 
\newtheorem{remarka}{Remark} 

\def\P{\mathop{\rm P}\nolimits}
\def\NP{\mathop{\rm NP}\nolimits}
\def\DTIME{\mathop{\rm DTIME}\nolimits}
\def\BPTIME{\mathop{\rm BPTIME}\nolimits}
\def\ZPTIME{\mathop{\rm ZPTIME}\nolimits}
\def\polylog{\mathop{\rm polylog}\nolimits}

\newenvironment{remark}{\begin{remarka}\rm}{\end{remarka}} 
\newenvironment{proof}{{\bf Proof.}}{\hfill\rule{2mm}{2mm}} 
\newenvironment{pproof}[1]{\noindent{\textbf{Proof of #1.}}}{\hfill\rule{2mm}{2mm}} 
\newcommand{\calI}{{\cal I}}
\newcommand{\calT}{{\cal T}}
\newcommand{\calP}{{\cal P}}
\newcommand{\opt}{\mbox{\sc opt}}
\newcommand{\OPT}{\mbox{\sc OPT}}
\newcommand{\QQ}{\mathbb{Q}}
\newcommand{\RR}{\mathbb{R}}
\newcommand{\ZZ}{\mathbb{Z}}



%
% The following macro is used to generate the header.
%
\newcommand{\lecture}[5]{
   \pagestyle{myheadings}
   \thispagestyle{plain}
   \newpage
   \setcounter{lecnum}{#1}
   \setcounter{page}{1}
   \noindent
   \begin{center}
   \framebox{
      \vbox{\vspace{2mm}
    \hbox to 6.28in { {\bf CMPUT 675: Approximation Algorithms
                        \hfill Fall 2014} }
       \vspace{4mm}
       \hbox to 6.28in { {\Large \hfill Lecture #1 (#2): #3 \hfill} }
       \vspace{2mm}
       \hbox to 6.28in { {\it Lecturer: #4 \hfill Scribe: #5} }
      \vspace{2mm}}
   }
   \end{center}
   \markboth{Lecture #1: #3}{Lecture #1: #3}
   \vspace*{4mm}
}

%
% Convention for citations is authors' initials followed by the year.
% For example, to cite a paper by Leighton and Maggs you would type
% \cite{LM89}, and to cite a paper by Strassen you would type \cite{S69}.
% (To avoid bibliography problems, for now we redefine the \cite command.)
%
\renewcommand{\cite}[1]{[#1]}

\input{epsf}

%Use this command for a figure; it puts a figure in wherever you want it.
%usage: \fig{NUMBER}{FIGURE-SIZE}{CAPTION}{FILENAME}
\newcommand{\fig}[4]{
			\vspace{0.2 in}
			\setlength{\epsfxsize}{#2}
			\centerline{\epsfbox{#4}}
			\begin{center}
			Figure \thelecnum.#1:~#3
			\end{center}
	}

% Use these for theorems, lemmas, proofs, etc.

% Some useful equation alignment commands, borrowed from TeX
\makeatletter
\def\eqalign#1{\,\vcenter{\openup\jot\m@th
  \ialign{\strut\hfil$\displaystyle{##}$&$\displaystyle{{}##}$\hfil
      \crcr#1\crcr}}\,}
\def\eqalignno#1{\displ@y \tabskip\@centering
  \halign to\displaywidth{\hfil$\displaystyle{##}$\tabskip\z@skip
    &$\displaystyle{{}##}$\hfil\tabskip\@centering
    &\llap{$##$}\tabskip\z@skip\crcr
    #1\crcr}}
\def\leqalignno#1{\displ@y \tabskip\@centering
  \halign to\displaywidth{\hfil$\displaystyle{##}$\tabskip\z@skip
    &$\displaystyle{{}##}$\hfil\tabskip\@centering
    &\kern-\displaywidth\rlap{$##$}\tabskip\displaywidth\crcr
    #1\crcr}}
\makeatother

% **** IF YOU WANT TO DEFINE ADDITIONAL MACROS FOR YOURSELF, PUT THEM HERE:

% NOW START EDITING
\begin{document}
%FILL IN THE RIGHT INFO.
%\lecture{**LECTURE-NUMBER**}{**DATE**}{**LECTURER**}{**SCRIBE**}
\lecture{17}{Oct 15}{\textsc{Steiner Forest }}{Zachary Friggstad}{Yifeng Zhang}

% **** YOUR NOTES GO HERE:

\section{\textsc{Steiner Forest}}

\begin{definition}
In the \textsc{Steiner Forest} problem, we are given an undirected graph $G = (V,E)$ with edge cost $c_e \geq 0$, $e \in E$. Additionaly, we are given of pairs of vertices $(s_1,t_1), (s_2,t_2), \ldots, (s_k,t_k)$. The goal is to find the cheapest forest $F \subseteq E$ such that for each  $1 \leq  i \leq k$, $s_i$ and $t_i$ lie in the same component of $(V,F)$
\end{definition}

Consider the function $f : 2^v \to \{0,1\}$ where for any $S \subseteq V$ we have $f(S) = 1$ if and only if $|S \cap \{s_i, t_i\}| = 1$ for some $1 \leq i \leq V$.
This notation will be useful when we consider a generalization of the Steiner Forest problem next lecture.

Say that $F \subseteq E$ is feasible if and only if $\delta(S) \cap F \neq \emptyset$ for every $S \subseteq V$ with $f(S) = 1$.
Note that $F$ is feasible if and only if $s_i$ and $t_i$ lie in the same component of $(V,F)$ for every $1 \leq i \leq k$.

\section{An LP Relaxation}
Recall that $\delta(S)$ denotes the set of all edges in $E$ that have exactly one endpoint in $S$.
\[
\begin{array}{rrcll}
{\rm minimize}: & \displaystyle\sum_{e \in E} c_e \cdot x_e & & & \tag{\bf LP-Primal} \label{lp:primal} \\~\\
{\rm subject~to} : & \displaystyle\sum_{e \in \delta(S)} x_e & \geq & 1 & \text{for any } S \subseteq V \text{ with } f(S) = 1 \\~\\
& {\bf x} & \geq & 0
\end{array}
\]
Though this LP admits an efficient separation oracle (simply check that the minimum ${\bf x}$-capacity $s_i-t_i$ cut is at least 1 for each $1 \leq i \leq k$), we will not need to solve it directly in our approximation.
Rather, we will use the {\em primal-dual} method: simultaneously build an integer primal solution and a feasible dual solution in a careful way to ensure that their costs are close to each other.

The dual of (\ref{lp:primal}) is the following LP that has a variable $y_S$ for every $S \subseteq V$ with $f(S) = 1$.
\[
\begin{array}{rrcll}
{\rm maximize}: & \displaystyle\sum_{S \subseteq V : f(S) = 1} y_S & & & \tag{\bf LP-Dual} \label{lp:dual} \\~\\
{\rm subject~to}: & \displaystyle\sum_{\substack{S \subseteq V : f(S) = 1\\ e \in \delta(S)}} y_S & \leq & c_e & \text{for each } e \in E \\~\\
& {\bf y} & \geq & 0
\end{array}
\]

Primal-dual algorithms are guided by complementary slackness conditions.
Let's inspect these conditions for (\ref{lp:primal}) and (\ref{lp:dual}), where we use $x_e = 1$ instead of $x_e > 0$ because we are looking for an integer primal solution.
\begin{enumerate}
\item $x_e = 1 \Rightarrow \sum_{S : f(S) = 1, e \in \delta(S)} y_S = c_e$ for each $e \in E$
\item $y_S > 0 \Rightarrow \sum_{e \in \delta(S)} x_e = 1$ for each $S \subseteq V$ with $f(S) = 1$
\end{enumerate}
Of course, we cannot satisfy all of these conditions simultaneously; we want an {\em integer} primal solution. Something has to be relaxed.

The algorithm below ensures the first complementary slackness condition hold: an edge is not ``bought'' unless its dual constraint is tight.
However, it only satisfies a relaxed version of the second constraints.

First note that if we could ensure the edges we use $F$ satisfy $|\delta(S) \cap F| \leq 2$ for every $S$ with $y_S > 0$, then this is a 2-approximation (c.f. previous lecture).
However, even this is difficult to enforce. What the algorithm does is ensure that the constructed primal and dual
solutions have these second conditions hold, in some appropriate sense, {\em on average}. This will be explained in more detail soon.

The following algorithm is our primal-dual approximation for \textsc{Steiner Forest}. For a given feasible dual solution, say that an edge $e$ is {\em tight} if the dual constraint for that edge holds with equality.
The $\Delta_i$ variables are only used to help the analysis.
\begin{algorithm}
\caption{\textsc{Steiner Forest} Approximation}\label{alg:a1}
\begin{algorithmic}
\STATE $F_1 \gets \emptyset$
\STATE ${\bf y} \leftarrow {\bf 0}$
\STATE $i \gets 1$  (iteration counter)
\WHILE{$F_i$ is not feasible}
	\STATE Let $\mathcal{C}_i$ be the set of components $S$ of $(V,F_i)$ with $f(S)=1$
	\STATE Raise all $y_S$, $S \in \mathcal{C}_i$ uniformly until some edge $e$ becomes tight
	\STATE $\Delta_i \gets$ the amount we raised each $y_S$
	\STATE Let $F_{i+1} \leftarrow F_i \cup \{e\}$
	\STATE $i \leftarrow i + 1$
\ENDWHILE
\STATE $F \leftarrow F_i$
\WHILE{there is some $e \in F$ s.t. $F-\{e\}$ is feasible}
    \STATE $F \gets F-\{e\}$
\ENDWHILE
\RETURN $F$ 
\end{algorithmic}
\end{algorithm}

Note that throughout the execution of the algorithm that ${\bf y}$ is feasible. This is because we stop raising $y_S$ values when some edge goes tight to ensure that no dual constraint is violated.
Also, if multiple edges go tight then pick any one of them to be $e$ in the iteration.

To implement this efficiently, we do not have to explicitly initialize each entry of ${\bf y}$ to 0. Rather, only keep track of the subsets $S$ with $y_S > 0$.
Each iteration of the first loop has some edge go tight, so there are at most $m = |E|$ of these iterations. Each iteration raises at most $n = |V|$ variables $y_S$, so the total number
of nonzero variables is at most $n \cdot m$. Clearly every iteration can be performed in polynomial time.

The second ``pruning'' loop is necessary because the cost of $F$ can be huge otherwise. Consider the following simple example with $V = \{s, t, v_1, \ldots, v_{n-2}\}$ and edges
$E = \{(s,t), (s,v_1), (s,v_2), \ldots, (s, v_{n-2})\}$ where $c_{(s,t)} = 3$ and $c_{(s,v_i)} = 1$ for every $1 \leq i \leq n-2$. The only pair is the $(s,t)$ pair. All edges $(s,v_i)$ will
go tight before the $(s,t)$ edge, so the cost of the tight edges before pruning is $n-1$ whereas the optimum solution has cost 3. The pruning phase will discard all edges
except the $(s,t)$ edge.

Our main result is the following.
\begin{theorem}\label{thm:th1}
Algorithm \ref{alg:a1} returns a solution $F$ with cost at most $2 \cdot OPT_{\text{LP}}$.
\end{theorem}

To show this, we first note the following claim which will be proven in the next lecture.
This is the averaging argument alluded to above that will be used in place of the relaxed complementary slackness condition
$y_S > 0 \Rightarrow |\delta(S) \cap F| \leq 2$.
\begin{claim}\label{claim:c1}
Consider any iteration $i$ and let $F$ be the final set of returned edges.
We have $\sum\nolimits_{S \in \mathcal{C}_i}|F \cap \delta(S)| \leq 2|\mathcal{C}_i|$, i.e. the average degree of the ``active'' sets in iteration $i$ is at most 2.
\end{claim}


\begin{pproof}{\bf Theorem \ref{thm:th1}}
We emulate the proof of why relaxed complementary slackness conditions ensure approximately optimal solutions while making appropriate adjustments
for the averaging argument.

Let ${\bf \overline x}$ be the integer solution where $\overline x_e = 1$ for $e \in F$ and $\overline x_e = 0$ for $e \not\in F$.
\begin{eqnarray}
{\rm cost}(F) & = & \sum_{e \in F} c_e \notag \\
& = & \sum_{e \in E}c_e \cdot \overline{x_e} \notag \\  
& = & \sum_{e\in \delta(S)}\left(\sum_{\substack{S:f(S)=1 \\ e\in \delta(S)}}y_S\right)\overline{x_e} \label{eqn:e1}
\end{eqnarray}
The last equality is by the fact that the dual constraint for each $e \in F$ is tight under ${\bf y}$. Continuing, we rearrange (\ref{eqn:e1}) to get
\begin{eqnarray}
\sum_{S : f(S) = 1} y_S \left(\sum_{e \in \delta(S)} \overline x_e\right) = \sum_{S : f(S) = 1} y_S \cdot |\delta(S) \cap F| \label{eqn:e2}.
\end{eqnarray}

We break this last sum into the iterations. That is, in iteration $i$ each $y_S, S \in \mathcal C_i$ is raised by $\Delta_i$ so the total amount this iteration
contributes to expression (\ref{eqn:e2}) is exactly $\sum_{S \in \mathcal C_i} \Delta_i \cdot |\delta(S) \cap F|$. Summing over all iterations and using Claim (\ref{claim:c1}), we see
\begin{eqnarray*}
\sum_{S : f(S) = 1} y_S \cdot |\delta(S) \cap F| & = & \sum_i \Delta_i \sum_{S \in \mathcal C_i} |\delta(S) \cap F| \\
& \leq & 2 \cdot \sum_i \Delta_i |\mathcal C_i| \\
& = & 2 \cdot \sum_{S : f(S) = 1} y_S.
\end{eqnarray*}
The final equality holds because each $y_S$ value is equal to the sum of the $\Delta_i$ values over all iterations where $S \in \mathcal C_i$.

Finally, because ${\bf y}$ is a feasible dual solution then by weak duality we have $2 \cdot \sum_{S : f(S) = 1} y_S \leq OPT_{\text{LP}}$. That is, the cost of $F$ is at most $2 \cdot OPT_{\text{LP}}$.
\end{pproof}

This algorithm, along with generalizations that are discussed next lecture and in Assignment 3, are due to Goemans and Williamson (see \cite{GW95} for the \textsc{Steiner Forest} approximation).
This is the best-known approximation for \textsc{Steiner Forest} and it is a major open problem to find a better than 2-approximation. This may be possible; in the special case of \textsc{Steiner Tree} that we have
a $\ln(4) + \epsilon$ approximation for any constant $\epsilon > 0$.

\section*{References}

\begin{itemize}
\item{GW95}
M.~X.~Goemans and D.~P.~Williamson,
A general approximation technique for constrained forest problems,
SIAM Journal on Computing, 24, 296--317, 1995.
 
\end{itemize}

\end{document}
