%\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{cite}
\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}}

\newcommand{\cost}{{\rm cost}}


%
% 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{4}{Sep 10}{The \textsc{Traveling Salesman} Problem}{Zachary Friggstad}{Antonio Carlos Salzvedel Furtado Junior}

% **** YOUR NOTES GO HERE:

\section{\textsc{Traveling Salesman} Problem}

The following algorithm describes a $\frac{3}{2}$-approximation for the \textsc{Traveling Salesman} Problem, defined in the previous lecture. The shortcutting step used by this algorithm is performed as described in the proof of Theorem 1 from Lecture 3. The algorithm is one of the oldest approximations, from Christofides in 1976~\cite{C76}.

\begin{definition}
Given a graph $G = (V,E)$, a {\em matching} $M$ is a subset of edges so each $v \in V$ is the endpoint of at most one edge in $M$. The matching $M$ is said to be {\em perfect}
if every vertex in $v$ is an endpoint of some edge in $M$, equivalently $|M| = |V|/2$.
\end{definition}

We will use the following fact without proof.
\begin{theorem}
There is a polynomial-time algorithm that determines if a graph has a perfect matching. Furthermore, if such a matching exists and if the edges have costs then we can also
find a minimum-cost perfect matching in polynomial time.
\end{theorem}

The main idea behind this improved approximation is that we can fix the odd-degree nodes in the minimum spanning tree by being more clever than simply doubling every edge.
Instead, we will just match them up in the cheapest way possible.

\begin{algorithm}
\caption{\textsc{Traveling Salesman} $\frac{3}{2}$-approximation}
\label{alg:3_2_approx}
{\bf Input}: A metric on nodes $V$ with costs $c(u,v)$,$u,v \in V$. \\
{\bf Output}: A Hamiltonian cycle $H$.
\begin{algorithmic}
\STATE $T \gets$ a minimum spanning tree of the metric
\STATE $D \gets$ odd degree nodes in $T$
\STATE $M \gets$ minimum cost perfect matching of $D$
\STATE $\mathcal{C} \gets$ Eulerian circuit of the graph $(V,T+M)$ (the + means keep both copies of an edge if it lies in $T$ and $M$)
\STATE shortcut $\mathcal{C}$ to get a Hamiltonian cycle $H$
\RETURN $H$
\end{algorithmic}
\end{algorithm}

\begin{theorem}\label{thm:alg2_theorem}
Algorithm~\ref{alg:3_2_approx} is a $\frac{3}{2}$-approximation
\end{theorem}

\begin{proof}
First, note that $T + M$ is an Eulerian graph since it is connected (as it contains $T$) and clearly every $v \in V$ has even degree in $T+M$.

Let $OPT$ denote the cost of an optimum solution.

As we know  that the shortcutting step will not increase the size of a Hamiltonian cycle, we can affirm that
\begin{alignat*}{3}
\cost(H) & \leq \cost(\mathcal{C}) &  \\ 
 & = \cost(T) + \cost(M) & \\
 & \leq OPT + \cost(M). & \\
\label{eqn2}
\end{alignat*}
The last inequality is justified because $T$ is the cheapest spanning tree and the optimum solution, being a Hamiltonian cycle,
contains some spanning tree.

We need to demonstrate that the following is true:
\[
\cost(M) \leq \frac{OPT}{2}.
\]
Let $H^{*}$ be an optimum solution, so $\cost(H)^{*} = OPT$.

Shortcut $H^{*}$ past nodes in $V-D$ to get a cycle $H_D$ spanning $D$. Since shortcutting does not increase the cost,
\[
\cost(H_{D}) \leq \cost(H^{*}) = OPT.
\]

Say the cycle $H_{D}$ follows nodes $v_1, v_2, \ldots, v_{|D|}, v_1$.
Let $M_{1}$ and $M_{2}$ be the two perfect matchings on $D$ obtained by taking the edges of $H_{D}$ alternatively, such that
$$M_{1} = \{(v_{1}v_{2}),(v_{3}v_{4}),...,(v_{|D-1|}v_{|D|})\}$$
and
$$M_{2} = \{(v_{2}v_{3}),(v_{4}v_{5}),...,(v_{|D|}v_{1})\}$$

Then $\cost(M_{1}) + \cost(M_{2}) = \cost(H_{D})$ so
\[ \min(\cost(M_{1}),\cost(M_{2})) \leq \frac{\cost(H_{D})}{2} \leq \frac{OPT}{2}. \]

Since $M$ is the minimum-cost perfect matching of $D$, then
\[ \cost(M) \leq \min(\cost(M_{1}),\cost(M_{2})) \leq \frac{OPT}{2}.\]
Thus, $\cost(H) \leq \frac{3}{2} \cdot OPT$

\end{proof}


\section*{References}

\begin{itemize}
\item[C76] {\sc N.~Christofides},
Worst-case analysis of a new heuristic for the travelling salesman problem,
Report 388, Graduate School of Industrial Administration, CMU, 1976.
\end{itemize}
 
\end{document}
