\documentclass[a4paper,12pt]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{graphicx} %BIlder einbinden
\usepackage{amsmath} %erweiterte Mathe-Zeichen
\usepackage{amsfonts} %weitere fonts
\usepackage[utf8]{inputenc} %Umlaute & Co
\usepackage{hyperref} %Links
\usepackage{ifthen} %ifthenelse
\usepackage{enumerate}

\usepackage{color}
\usepackage{algpseudocode} %Pseudocode
\usepackage{dsfont} % schöne Zahlenräumezeichen
\usepackage{amssymb, amsthm} %noch stärker erweiterte Mathe-Zeichen
\usepackage{tikz} %TikZ ist kein Zeichenprogramm
\usetikzlibrary{trees,automata,arrows,shapes}
\usepackage{pgfplots}

\pagestyle{empty}


\topmargin-50pt


\newcounter{aufgabe}
\def\tand{&}

\newcommand{\makeTableLine}[2][0]{%
  \setcounter{aufgabe}{1}%
  \whiledo{\value{aufgabe} < #1}%
  {%
    #2\tand\stepcounter{aufgabe}%
  }
}

\newcommand{\aufgTable}[1]{
  \def\spalten{\numexpr #1 + 1 \relax}
  \begin{tabular}{|*{\spalten}{p{1cm}|}}
    \makeTableLine[\spalten]{E\theaufgabe}$\Sigma$~~\\ \hline
    \rule{0pt}{15pt}\makeTableLine[\spalten]{}\\
  \end{tabular}
}

\def\header#1#2#3#4#5#6#7{\pagestyle{empty}
\begin{minipage}[t]{0.47\textwidth}
\begin{flushleft}
{\bf #4}\\
#5
\end{flushleft}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{flushright}
#6 \vspace{0.5cm}\\
%                 Number of Columns    Definition of Columns      second empty line
% \begin{tabular}{|*{5}{C{1cm}|}}\hline A1&A2&A3&A4&$\Sigma$\\\hline&&&&\\\hline\end{tabular}\\\vspace*{0.1cm}
\aufgTable{#7}
\end{flushright}
\end{minipage}
\vspace{1cm}
\begin{center}
{\Large\bf Sheet #1}

{(Hand in #3)}
\end{center}
}



%counts the exercisenumber
\newcounter{n}

%Kommando für Aufgaben
%\Aufgabe{AufgTitel}{Punktezahl}
\newcommand{\Aufgabe}[2]{\stepcounter{n}
    \textbf{Exercise \arabic{n}: #1} (#2 Points)\\}

\newcommand{\textcorr}[1]{\textcolor{red}{#1}}
\newenvironment{corr}{\color{red}}{\color{black}\newline}
\newcommand{\ok}{\begin{corr}
            $\checkmark$
        \end{corr}}

\newcommand{\enot}[2]{#1 \cdot 10^{#2}}

\begin{document}
%\header{BlattNr}{Tutor}{Abgabedatum}{Vorlesungsname}{Namen}{Semester}{Anzahl Aufgaben}
\header{6}{}{2015-11-25}{Kommunikationsnetze}{\textit{Jonas Jaszkowic, 3592719}\\\textit{Jan-Peter Hohloch, 3908712}}{WS 15/16}{2}
\vspace{1cm}
\Aufgabe{Switching Methods in Communication Networks\footnote{pictures from slides adjusted to exercise}}{45}
    \begin{enumerate}
        \item Circuit switching:
        \begin{itemize}
            \item Setup time:
            \begin{itemize}
                \item 2 nodes to lookup: $2\cdot 3s=6s$ (A,B are known)
                \item 3 lines to setup: $3\cdot 0.1s=0.3s$
                \item ACK for setup over three lines $3\cdot 0.02s=0.06$
                \item[$\Rightarrow$] $6.36s$
            \end{itemize}
            \item Data Transmission Time: $\frac{80000 bit}{4800 bit/s}+3\cdot 0.02s=\frac{50}{3}s+0.06s \approx 16.7s$
            \item Teardown time: not needed since data is transmitted before teardown
            \item[$\rightarrow$] Transmission time: $\approx 23.1s$
            \includegraphics[width=.5\textwidth]{circuitSwitching.png}
        \end{itemize}
        \item Message switching:
        \begin{itemize}
            \item One message containing $80000bit+400 bit=80400 bit$
            \item Setup: no setup times given so we assume datagram switching with one message
            \item Data transmission: $\frac{80400bit}{4800bit/s}+ 3\cdot 2\cdot 0.02s= 16.75 s+0.12s\approx 16.9s$
            \item[$\rightarrow$] Transmission time $\approx 16.9s$
            \includegraphics[width=.5\textwidth]{messageSwitching.png}
        \end{itemize}
        \item Package switching:
        \begin{itemize}
            \item 20 packages ($\frac{10000}{500}$) containing $500Byte+50Byte=4400bit$
            \item Setup: no setup times given so we assume datagram switching
            \item Data transmission: $20\cdot \left(\frac{4400bit}{4800bit/s}+ 3\cdot 2\cdot 0.02s\right) \approx 20\cdot (0.9s+0.12s)\approx 20s$
            \item[$\rightarrow$] Transmission time $\approx 20s$\vspace{-12pt}\\
            Picture for each packet:
            \hfill\includegraphics[width=.5\textwidth]{messageSwitching.png}
        \end{itemize}
    \end{enumerate}
\Aufgabe{Switches}{55}\\
    Let $i=1,...,5$, in=out=$10^i$
    \begin{enumerate}
        \item There are $10^{2i}$ crosspoints (in $\times$ out)
        \item At maximum there are $10^i$ crosspoints active simultaneously ($\min$(in,out))
        \item $C_N$ has the double slope of $X_N$, the ratio has a negative slope since $C_N$ is growing faster than $X_N$. The ratio describes kind of the efficiency of the switch, we see that it decreases for a large number of connections.\\
        \includegraphics[width=.5\textwidth]{crossSwitchPlot.png}
        \item $n$ for minimal number of crosspoints: $\left\lceil \sqrt{\frac{10^i}{2}}\right\rceil=3,8,23,71,224$\\
        $k\geq 2n-1$ : $k=5,15,45,141,447$
        \item We use the minimal number of crosspoints above:\\
        $C_{N,opt}=\frac{N}{n}\cdot n\cdot k + k\cdot \frac{N}{n}\cdot\frac{N}{n}+ \frac{N}{n}\cdot k\cdot n\\
        =153,5337,175043,5617042,178486160$
        \item The optimal number of crosspoints for large N is lower than the number of crosspoints in the crossswitch. For small $N$ vice versa.\\
        $C_{N,opt}$ is numerically not stable because of the ceiling function for $n$.\\
        \includegraphics[width=.5\textwidth]{multiStageSwitchPlot.png}
    \end{enumerate}
\end{document}
