\documentclass[landscape]{slides}
\usepackage{multicol}
\usepackage[all,poly,ps,dvips,color]{xy}
\input{preamble}
  
\input{SLIDES}
 
%\usepackage[dvips]{graphics}
%\usepackage[all,poly,ps,dvips,color]{xy}
%\UseCrayolaColors

%\DeclareMathOperator{\mathin}{in}
%\DeclareMathOperator{\mathout}{out}

\newcommand{\vindex}[2]{\left[ #1 \right] _ #2}
\newcommand{\eigen}{\mathbf a}
\newcommand{\elem}{\mathbf e}
\newcommand{\state}{\mathbf x}
\newcommand{\maxdeg}{\Delta}
\newcommand{\maxdegC}{d_{max}}

\newcommand{\din}{d_{\mathin}}
\newcommand{\dout}{d_{\mathout}}
\newcommand{\dmax}{d_{\max}}


\newcommand{\nlabel}[2]{\ar@{} @(#1,#1) |<<{#2}}
\newcommand{\gnlabel}[2]{[#1(.25)] {#2}}
\newcommand{\node}{{\bullet}}
\newcommand{\bypass}{{\circ}}

\begin{document}

\begin{titlepage}
\title{CS 591, Lecture 15}

\author {Jared Saia \\
{\red University of New Mexico}}

\date{}
\maketitle

\end{titlepage}


\begin{SLIDE}[Class Outline]

\begin{itemize}
\item Presentations!!!
\item Homework 2
\item Finish up MARK Analysis
\end{itemize}
\end{SLIDE}

\begin{SLIDE}[Class Presentations]

\begin{itemize}
\item Each student will give a 30 minute presentation
\item By October 29th (next Tuesday), you must speak to me (in office
hours or by appointment) about your proposed presentation.
\item By November 5th, you must turn in a 1 page detailed summary of
what you will present.  Give a description of the abstract problem,
the algorithm(s), and all major theorems.
\item Class Presentations will be given on November 19, 21 and 26th -
choose a date now.
\end{itemize}
\end{SLIDE}

\begin{SLIDE}[Class Presentations (II)]
\begin{itemize}

\item The presentation should be on an algorithmic approach to a
``real-world'' problem or on a mathematical tool that is useful for
real-world algorithms

\item There should be some ``mathematical meat'' to your
presentation.  In particular, there should be some use of mathematical
tools like the ones we learned in class (e.g. graph theory,
probability theory, online analysis, etc.)

\item It's ok to present in groups of up to $3$ people

\item Find something that interests you!!!

\end{itemize}
\end{SLIDE}


\begin{SLIDE}[Ideas for Presentations]
\begin{itemize}
\item Graph Theory
\item Probability Theory
\item Spectral Analysis and Search Engines
\item Online Algorithms
\item Smoothed Analysis
\item Computational Biology
\end{itemize}
\end{SLIDE}


\begin{SLIDE}[Graph Theory]
\begin{itemize}
\item Data Migration with Space Constraints (see paper ``On Algorithms
for Efficient Data Migration'' on course web page)
\item Experimental Results on Data Migration (see paper ``An
Experimental Study of Data Migration Algorithms'' on course page)
\item Tutte's Theorem for matchings in general graphs (see any graph
theory book)
\item Phylogeny Problems (see Bernard Moret)
\end{itemize}
\end{SLIDE}

\begin{SLIDE}[Probability Theory]
\begin{itemize}
\item Pattern Matching and Fingerprinting (see paper ``Some
applications of Rabin's fingerprinting method'' on course web page)

\item How to Reduce the resource bounds for attack-resistant p2p
networks (see paper ``Censorship Resistant Peer-To-Peer Content
Addressable Networks'' on course web page)
\end{itemize}
\end{SLIDE}

\begin{SLIDE}[Spectral Analysis]
\begin{itemize}
\item The Google Algorithm (see "The Anatomy of a Large-Scale
Hypertextual Web Search Engine" on course web page)
\item Theoretical Analysis of why spectral methods work for search
(see paper ``Spectral Analysis of Data'' on course web page)
\end{itemize}
\end{SLIDE}

\begin{SLIDE}[Online Algorithms]
\begin{itemize}
\item Online Learning (see paper ``Online Algorithms in Machine
Learning'' on course web page)
\item Online Auctions (see me for appropriate references)
\item Show that the lower bound for randomized paging against an oblivious
adversary is $O (\log n)$
\end{itemize}
\end{SLIDE}


\begin{SLIDE}[Homework 2]
\begin{itemize}
\item Problem 4, $n*2^{-k\log n} = n^{k-1}$.  Make sure you simplify
all answers as much as possible.  Always want a single exponential
when possible.
\item Problem 5, After compute probability that \emph{a fixed} segment
has too many/too few points, need to use union bounds to compute
probability that \emph{no} segment has too many/too few points in it.
\item Problem 6, don't replace $(1-1/n)^{n}$ with $(1-1/e)$ until the
very end of the computation.  Make sure you \emph{state} that this is
an approximation as $n \rightarrow \infty$
\end{itemize}
\end{SLIDE}

\begin{SLIDE}[Homework 2, Problem 7]
Part 1)
\begin{itemize}
\item Let $p$ be the probability the coin is heads.
\item Let a round be two flips of the coin.  Say a round succeeds if
there is one heads and one tails.  Let $r$ be the probability that a
round succeeds
\item Let $t$ be the expected number of flips until a round succeeds.
$t = r*2 + (1-r)* (2 + t)$.  Simplifying, we get $t = f/r$
\end{itemize}
\end{SLIDE}

\begin{SLIDE}[HW 2, Problem 7]

Part 2)
\begin{itemize}
\item We need a more efficient algorithm!
\item Hint: Consider the first $4$ biased flips
\item If the first pair of flips are HT or TH, or the second pair or
TH or HT, we can get a bit using the simple method
\item Can improve things by pairing up HHTT and TTHH.  Idea is to
merge the same flips to get a multi-level strategy
\end{itemize}
\end{SLIDE}



\begin{SLIDE}[Algorithm MARK]

We will consider the randomized algorithm MARK defined as follows:
\begin{itemize}
\item Initially all pages are marked
\item If there is a request for a page $p$ which is in the cache but
unmarked, then $p$ is marked
\item Otherwise if $p$ is not in the cache, $p$ is brought
\emph{marked} into the cache
\item If all the pages in the cache are marked when $p$ is brought in,
they are all unmarked first
\item The page that is evicted is chosen uniformly at random from all
unmarked pages currently in the cache.
\end{itemize}
\end{SLIDE}

\begin{SLIDE}[MARK Analysis]
\begin{itemize}
\item Defn: $H_{k} = 1 + 1/2 + 1/3 + \dots + 1/k$
\item Fact: $\ln k < H_{k} < 1 + \ln k$
\item \emph{Theorem:} The competitive ratio of Mark is $2*H_{k}$
\end{itemize}
\end{SLIDE}

\begin{SLIDE}[MARK Analysis]
\begin{itemize}
\item Fix a request sequence $\sigma$ and partition it into phases of
$k$ unique requests as before
\item For each phase $i$, call the pages in the cache just before the
start of the phase the \emph{old} pages and call all other pages
requested in the $i$-th phase \emph{new} pages
\item Note that each request in the $i$-th phase is to either an old
or a new phase
\item Note also that repeated requests to a new or old page don't
contribute to our cost since each page requested is kept in the cache
until the end of the phase
\end{itemize}
\end{SLIDE}

\begin{SLIDE}[MARK Analysis]
\begin{itemize}
\item Let $m_{i}$ be the number of new pages requested in the $i$-th phase
\item The worst order for the MARK algorithm is if all requests to
new pages precede requests to old pages
\item In this order, the requests to new pages incur $m_{i}$ faults
\item What about the remaining $k-m_{i}$ requests to old pages?
\end{itemize}
\end{SLIDE}

\begin{SLIDE}[MARK Analysis]
\begin{itemize}
\item What do we want?: We want to compute the expected number of
misses on the $k-m_{i}$ old pages

\item We can get this using linearity of expectation if we can find
the right probabilities.

\item Q: What is the probability that the $j$-th old page requested
will not be in the cache?  (i.e. it will generate a fault)
\end{itemize}
\end{SLIDE}


\begin{SLIDE}[Mark Analysis]
\begin{itemize}
\item Q: What is the probability that the $j$-th old page requested
is not in the cache?

\item Let $x_{j}$ be the $j$-th old page

\item Let $O$ be the set of old pages.

\item Let $O_{j} = O - \{x_{1},\dots ,x_{j-1} \}$ (i.e. the set of
unmarked old pages when $x_{j}$ is requested)

\item Note that $m_{i}$ of the pages in $O_{j}$ have been evicted from
the cache when $x_{j}$ is requested.  These $m_{i}$ evicted pages are
chosen uniformly at random from the set $O_{j}$

\item Thus the probability that some fixed page (say $x_{j}$) in the
set $O_{j}$ has been evicted is $m_{i}/|O_{j}| = m_{i}/k- (j-1)$

\item Thus the probability that the $j$-th old page requested is not
in the cache is $m_{i}/k-j+1$

\end{itemize}
\end{SLIDE}


\begin{SLIDE}[Mark Analysis]

Hence the number of faults incurred by MARK is:
\begin{eqnarray}
m_{i}+\sum_{j=1}^{k-m_{i}} \frac{m_{i}}{k-j+1} & = & m_{i} (H_{k}-H_{m_{i}}+1)\\
& \leq  & m_{i}H_{k}
\end{eqnarray}

\end{SLIDE}

\begin{SLIDE}[Bound for OPT]
It's not hard to bound OPT for this sequence:
\begin{itemize}
\item Let $q_{i}$ be the number of faults to OPT in the $i$-th phase
and let $l$ be the total number of phases
\item For $i>2$, $q_{i-1}+q_{i} \geq k+m_{i}$, since $k+m_{i}$
distinct pages requested during these two phases.
\begin{eqnarray}
\sum_{i=1}^{l} (q_{i-1}+q_{i}) & \geq  & \sum_{i=2}^{l} m_{i}\\
2*\sum_{i=1}^{l}q_{i} - q_{1} & \geq & \sum_{i=2}^{l} m_{i}\\
2*OPT & \geq & q_{1} +  \sum_{i=2}^{l} m_{i}\\
2*OPT & \geq & \sum_{i=1}^{l} m_{i}
\end{eqnarray}
\end{itemize}
\end{SLIDE}

\begin{SLIDE}[Take Away]
\begin{itemize}
\item So MARK has no more than $H_{k} * \sum_{i} m_{i}$ faults
\item OPT has at least $1/2 (\sum_{i} m_{i})$ faults
\item Hence the competitive ration is $2*H_{k}$
\item Note: There are variants of MARK that have been shown to be
$H_{k}$ competitive
\end{itemize}
\end{SLIDE}

\end{document}
