To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit f85b368f authored by Theo von Arx's avatar Theo von Arx
Browse files

Initial commit

parents
################
# Miscellanous #
################
books
tags
#########
# LaTeX #
#########
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2
.*.lb
## Intermediate documents:
*.dvi
*.xdv
*-converted-to.*
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
*.pdf
## Generated if empty string is given at "Please type another file name for output:"
.pdf
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.run.xml
## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync
## Build tool directories for auxiliary files
# latexrun
latex.out/
## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa
# achemso
acs-*.bib
# amsthm
*.thm
# beamer
*.nav
*.pre
*.snm
*.vrb
# changes
*.soc
# cprotect
*.cpt
# elsarticle (documentclass of Elsevier journals)
*.spl
# endnotes
*.ent
# fixme
*.lox
# feynmf/feynmp
*.mf
*.mp
*.t[1-9]
*.t[1-9][0-9]
*.tfm
#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R
# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
*.glsdefs
# gnuplottex
*-gnuplottex-*
# gregoriotex
*.gaux
*.gtex
# htlatex
*.4ct
*.4tc
*.idv
*.lg
*.trc
*.xref
# hyperref
*.brf
# knitr
*-concordance.tex
# TODO Comment the next line if you want to keep your tikz graphics files
*.tikz
*-tikzDictionary
# listings
*.lol
# makeidx
*.idx
*.ilg
*.ind
*.ist
# minitoc
*.maf
*.mlf
*.mlt
*.mtc[0-9]*
*.slf[0-9]*
*.slt[0-9]*
*.stc[0-9]*
# minted
_minted*
*.pyg
# morewrites
*.mw
# nomencl
*.nlg
*.nlo
*.nls
# pax
*.pax
# pdfpcnotes
*.pdfpc
# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd
# scrwfile
*.wrt
# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/
# pdfcomment
*.upa
*.upb
# pythontex
*.pytxcode
pythontex-files-*/
# thmtools
*.loe
# TikZ & PGF
*.dpth
*.md5
*.auxlock
# todonotes
*.tdo
# easy-todo
*.lod
# xmpincl
*.xmpi
# xindy
*.xdy
# xypic precompiled matrices
*.xyc
# endfloat
*.ttt
*.fff
# Latexian
TSWLatexianTemp*
## Editors:
# WinEdt
*.bak
*.sav
# Texpad
.texpadtmp
# LyX
*.lyx~
# Kile
*.backup
# KBibTeX
*~[0-9]*
# auto folder when using emacs and auctex
./auto/*
*.el
# expex forward references with \gathertags
*-tags.tex
# standalone packages
*.sta
\documentclass[a4paper, landscape, 8pt, german]{scrartcl}
\input{chapters/header.tex}
\title{DES - Zusammenfassung}
\author{Theo von Arx}
\begin{document}
\begin{multicols*}{3}
\maketitle
\input{chapters/queueing.tex}
\input{chapters/online.tex}
\columnbreak
\appendix
\input{chapters/appendix.tex}
\end{multicols*}
\end{document}
%! TEX root = DES.tex
\section{Mathematik}
\subsection{Spezielle Reihen}
\begin{itemize}
\item $\displaystyle \sum_{k=0}^\infty aq^k=a+aq+aq^2+\ldots=\frac{a}{1-q}$ für $|q|<1$
\item $\displaystyle \sum_{k=0}^\infty (k+1)q^k=1+2q+3q^2+\ldots=\frac{1}{(1-q)^2} $ für $|q|<1$
\item $\displaystyle \sum_{k=1}^\infty \frac{1}{k^2}=1+\frac{1}{2^2}+\frac{1}{3^2}+\ldots=\frac{\pi^2}{6}$
\item $\displaystyle \sum_{k=0}^\infty \frac{1}{k!}=1+1+\frac{1}{2}+\frac{1}{6}+\ldots=e$
\end{itemize}
\subsection{Spezielle Summen}
\begin{itemize}
\item $\displaystyle \sum_{k = 1}^n k = \frac{n(n + 1)}{2}$
\item $\displaystyle \sum_{k = 1}^n i^2 = \frac{n (n + 1) (2n + 1)}{6}$
\item $\displaystyle \sum_{k = 0}^n q^i = \frac{1 - q^{n + 1}}{1 - q}$
\item $\displaystyle \sum_{k = 1}^n \frac{1}{k} \approx \ln(n) + \gamma$
\item $\displaystyle \sum_{k = 0}^n \begin{pmatrix}n \\k\end{pmatrix} a^{n - k} b^k = (a + b)^n$
\end{itemize}
\subsection{Prinzip der Inklusion / Exklusion:}
\begin{align*}
| A \cup B \cup C| &= |A| + |B| + |C| - |A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C| \\
|A \cup B| &= |A| + |B| - |A\cap B| \\
| A \cap B \cap C| &= |A| + |B| + |C| - |A \cup B| - |A \cup C| - |B \cup C| + |A \cup B \cup C| \\
|A \cap B| &= |A| + |B| - |A\cup B|
\end{align*}
\section{Verschiedenes}
\paragraph*{Palindrom}
Bsp: $\displaystyle L = \{ u \, | \, u \in \{ 0, 1\}^*$ und $u^{reverse} = u \} = \{u \, | \, ''u \text{ ist ein Palindrom}'' \}$. Daran denken, dass $|u| = odd$ sein kann.
\paragraph*{DFA überprüfen}
Jeder FA braucht einen Start-State. \\
DFAs haben für alle Buchstaben im Alphabet $\Sigma$ eindeutige Folgezustände.
%! TEX root = DES.tex
\usepackage[ngerman]{babel}
\usepackage[a4paper, top=5mm, left=5mm, right=5mm, bottom=5mm, headsep=0mm, footskip=4mm]{geometry}
\usepackage{multicol}
\usepackage[compact]{titlesec}
% math
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\mathtoolsset{showonlyrefs}
\usepackage{graphicx}
\usepackage{float}
\usepackage[utf8]{inputenc}
\usepackage{framed}
\usepackage[dvipsnames]{xcolor}
\usepackage{xparse}
\usepackage{txfonts}
\usepackage{xifthen}
\usepackage{trfsigns}
\usepackage{subcaption}
\makeindex
% Deaktiviere Paragrapheneinzug
\setlength{\parindent}{0pt}
% Multiline cells
\newcommand{\multiline}[1]{%
\begin{tabular}{@{}l@{}}#1\end{tabular}}
\usepackage{wrapfig}
\setcounter{secnumdepth}{4}
%%%%%%%%%%%%%%%
% Definitions %
%%%%%%%%%%%%%%%
% Layout
% ======
\definecolor{color2}{RGB}{180,255,180}
\definecolor{color3}{RGB}{220,255,220}
\definecolor{color4}{RGB}{240,255,240}
% make document compact
\titlespacing{\section}{0pt}{*0}{*0}
\titlespacing{\subsection}{0pt}{*0}{*0}
\titlespacing{\subsubsection}{0pt}{*0}{*0}
% sections
\setkomafont{section}{\mysection}
\newcommand{\mysection}[1]{
\Large\sf\bf
\setlength{\fboxsep}{0cm}
\colorbox{Dandelion}{
\begin{minipage}{\linewidth}
\vspace*{1pt}
#1
\vspace*{0pt}
\end{minipage}
}}
\setkomafont{subsection}{\mysubsection}
\newcommand{\mysubsection}[1]{
\large\sf\bf
\setlength{\fboxsep}{0cm}
\colorbox{Apricot}{
\begin{minipage}{\linewidth}
\vspace*{1pt}
#1
\vspace*{0pt}
\end{minipage}
}}
\setkomafont{subsubsection}{\mysubsubsection}
\newcommand{\mysubsubsection}[1]{
\normalsize\sf\bf
\setlength{\fboxsep}{0cm}
\colorbox{Melon}{
\begin{minipage}{\linewidth}
\vspace*{1pt}
#1
\vspace*{0pt}
\end{minipage}
}}
\newlength{\Mylen}
% OLD
\newenvironment{fcolorbox3}
{
\noindent
\ignorespaces
\def\FrameCommand{\fcolorbox{framecolor}{shadecolor}}
\framed
\FrameRestore
\noindent
\ignorespaces
}
{
\ignorespacesafterend
\endframed
\ignorespacesafterend
}
% USES MINIPAGES TO GET THE RIGHT FRAME SIZE
\newenvironment{fcolorbox2}
{%
\noindent%
\ignorespaces%
\def\FrameCommand{\fcolorbox{framecolor}{shadecolor}}%
\begin{minipage}[t]{\linewidth}%
\framed%
\FrameRestore%
\noindent%
\ignorespaces%
}
{%
\ignorespacesafterend%
\endframed%
\end{minipage}%
\ignorespacesafterend%
}
\newenvironment{tblock3}[1][]
{
\noindent
#1
\settowidth\Mylen{#1}
\begin{minipage}[t]{\textwidth - \Mylen - 5pt}
}
{
\end{minipage}
}
\newenvironment{fsatz}[1][]
{
\definecolor{shadecolor}{rgb}{0.95,0.95,1}%
\definecolor{framecolor}{rgb}{0.95,0.95,1}%
\begin{fcolorbox2}
\begin{tblock}[\textbf{Satz:}]
}
{
\end{tblock}
\end{fcolorbox2}\hspace{\fill}
}
\newenvironment{fdef}
{
\definecolor{shadecolor}{rgb}{0.9,1,0.9}%
\definecolor{framecolor}{rgb}{0.9,1,0.9}%
\begin{fcolorbox2}%
\begin{tblock}[\textbf{Def:}]
}
{
\end{tblock}
\end{fcolorbox2}
}
\newenvironment{ftext}[1][]
{
\definecolor{shadecolor}{rgb}{1,0.95,0.95}%
\definecolor{framecolor}{rgb}{1,0.95,0.95}%
\begin{fcolorbox2}
\ifthenelse{\isempty{#1}}
{\begin{tblock}[]}
{\begin{tblock}[#1]}
}
{
\end{tblock}
\end{fcolorbox2}
}
\newenvironment{bem}
{
\noindent
\ignorespaces
\begin{tblock}[\underline{Bem}:]
}
{
\end{tblock}\hspace{0pt}\noindent\ignorespaces
}
\newenvironment{bsp}[1][]
{
\noindent
\ignorespaces
\ifthenelse{\isempty{#1}}
{\begin{tblock}[\underline{Bsp}:]}
{\begin{tblock}[\underline{Bsp #1}:]}
}
{
\end{tblock}\hspace{0pt}\noindent\ignorespaces
}
\newenvironment{fakt}
{%
\noindent%
\ignorespaces%
\begin{tblock}[\underline{Fakt}:]%
}
{%
\end{tblock}\hspace{0pt}\noindent\ignorespaces%
}
\newenvironment{bew}
{
\noindent
\ignorespaces
\begin{tblock}[\underline{Beweis}:]
}
{
\begin{flushright}%
$\Box$%
\end{flushright}%
\end{tblock}\hspace{0pt}\noindent\ignorespaces%
}
% ABC LISTE
\newcounter{Lcount}
% Das gleiche ginge auch mit \roman, \arabic und \alph
\newenvironment{abclist}{\begin{list}{\alph{Lcount})}{\usecounter{Lcount}}}{\end{list}}
% Matrix
\newcommand{\matrixp}[1]{\begin{pmatrix}#1\end{pmatrix}}
%Matrix of Function
\newcommand{\fmatrixp}[1]{\left(\begin{pmatrix}#1\end{pmatrix}\right)}
% NEW STUFF
\newlength{\tblocklen}
\newenvironment{tblock}[1][]
{%
\noindent\settowidth\tblocklen{#1\hspace{3pt}}%
\begin{list}{*}
{%
\setlength{\labelsep}{2pt}\setlength{\itemindent}{0pt}\setlength{\labelwidth}{\tblocklen}%
\setlength{\leftmargin}{\labelwidth}\setlength{\partopsep}{0pt}\setlength{\parskip}{0pt}%
\setlength{\topsep}{0pt}%
}%
\item[#1\hspace{3pt}]
}
{
\end{list}
}
% MATHEMATICS
% ===========
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\Z}{\mathbb{Z}}
%! TEX root = DES.tex
\section{Worst-Case Event Systems}
\subsection{Ski Rental (deterministic Algorithm)}
Das Ski Rental Problem besteht darin, Skis entweder für den Preis 1 pro Monat zu mieten, oder für den Preis 1 zu kaufen. \\
Sobald man die Skis gekauft hat, wird man sofort das Interesse an Skis verlieren.
\\
Der Algorithmus für dieses Problem hat keinen Input und als Output nur eine reelle Zahl $z$, die die Anzahl Monate beschreibt, nach der Skis gekauft werden sollen.
\\
Die Kosten des Algorithmus mit Wert $z$ für den Input $u$ sind
\[
cost_z(u) = \begin{cases}
u, & \text{für } u \leq z \\
z + 1, & \text{für } u > z
\end{cases}
\]
Die Kosten des optimalen (offline) Algorithmus sind
\[
cost_{opt}(u) = \begin{cases}
u, & \text{für } u \leq 1 \\
1, & \text{für } u > 1
\end{cases}
= \min(u, 1)
\]
\begin{fdef}
\textbf{Competitive Analysis} \\
Ein Online Algorithmus $A$ ist $c$-competitive, wenn für alle endlichen Inputsequenzen $I$
\[
cost_A(I) \leq c \cdot cost_{opt}(I) + k
\qquad
\text{oder}
\qquad
c \cdot gain_A(I) \geq gain_{opt}(I) - k \cdot c
\]
wobei $cost$ die Kostenfuktion für den Algorithmus A bzw. den optimalen Algorithmus ist. $k$ ist eine Konstante, die unabhängig vom Input ist. Falls $k = 0$, dann nennt man den Online Algorithmus \textbf{strictly c-competitive}.
\end{fdef}
\\
Das Ski Rental Problem ist strictly 2-competitive. Der beste Algorithmus ist $z = 1$.
\subsection{Randomized Ski Rental (randomized Algorithm)}
Wir verwenden einen Algorithmus, der zufällig einer von zwei Werten $z_1$ und $z_2$ ($z_1 < z_2$) mit Wahrscheinlichkeiten $p_1$ und $p_2 = 1 - p_1$ wählt.
\[
cost_A(u) = \begin{cases}
u, & \text{für } u \leq z_1 \\
p_1 \cdot (z_1 + 1) + p_2 \cdot u, & \text{für } z_1 < u \leq z_2 \\
p_1 \cdot (z_1 + 1) + p_2 \cdot (z_2 + 1), & \text{für } z_2 < u
\end{cases}
\]
Die schlimmsten Inputs sind offensichtlich $u_1 = z_1 + \epsilon$ und $u_2 = z_2 + \epsilon$.
Der Gegenspieler wird folglich diese mit Wahrscheinlichkeit $q_1$ bzw. $q_2$ wählen.
\\