Compare commits
No commits in common. "5e5ed80c42099342bb41b6d17b00c7e5ca7e844b" and "c044edaf654a8f8b80c38e2b1618e5626a91b72f" have entirely different histories.
5e5ed80c42
...
c044edaf65
10 changed files with 0 additions and 492 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -329,6 +329,3 @@ TSWLatexianTemp*
|
||||||
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
|
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
|
||||||
# Uncomment the next line to have this generated file ignored.
|
# Uncomment the next line to have this generated file ignored.
|
||||||
#*Notes.bib
|
#*Notes.bib
|
||||||
|
|
||||||
# Ipe autosave
|
|
||||||
*.autosave.ipe
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1,18 +0,0 @@
|
||||||
\documentclass[parskip=half]{ngexrcs}
|
|
||||||
\usepackage{hyperref}
|
|
||||||
\usepackage{subcaption}
|
|
||||||
\setkeys{Gin}{pagebox=artbox, width=0.2\textwidth}
|
|
||||||
|
|
||||||
\subject{Algorithmische Graphentheorie}
|
|
||||||
\title{6. Übungsblatt}
|
|
||||||
\author{Jasper Gude \and Pia Röttgers}
|
|
||||||
|
|
||||||
\begin{document}
|
|
||||||
\maketitle
|
|
||||||
\points[2em]{25}
|
|
||||||
|
|
||||||
\input{aufgabe_1.tex}
|
|
||||||
\input{aufgabe_2.tex}
|
|
||||||
\input{aufgabe_3.tex}
|
|
||||||
|
|
||||||
\end{document}
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
\section{LP-Runden}
|
|
||||||
\begin{tasks}
|
|
||||||
\item
|
|
||||||
Wir suchen in $U$ nach dem Knoten $v$ mit dem kleinsten $x_v$, unser $\epsilon$,
|
|
||||||
und setzen alle Knoten $u \in U$ auf $x_u - \epsilon$ und alle Knoten $w \in W$
|
|
||||||
auf $\min(x_w~+~\epsilon, 1)$.
|
|
||||||
|
|
||||||
Das macht unsere Beschränkung $x_u + x_w \geq 1$ nicht kaputt, da ein Nachbar $w$
|
|
||||||
von einem Knoten $u \in U$ mindestens den Wert $\frac{1}{2} + \epsilon$ hat,
|
|
||||||
also $1$ ist oder in $W$ liegt.
|
|
||||||
|
|
||||||
Somit hat sich $\abs{U} + \abs{W}$ um mindestens $1$ verkleinert, da
|
|
||||||
$x_v$ nun $0$ ist und somit nicht in $U \cup W$ liegt und zu $W$ keine
|
|
||||||
weiteren Knoten dazukommen können.
|
|
||||||
|
|
||||||
Die Veränderungen der Variablen läuft in $\Oh(V)$, da im schlimmsten Fall
|
|
||||||
alle Knoten entweder in $U$ oder in $W$ liegen.
|
|
||||||
\points{4}
|
|
||||||
\item
|
|
||||||
\label{1b}
|
|
||||||
Wir teilen die Knoten $v \in V$ in drei Mengen ein.
|
|
||||||
\begin{align*}
|
|
||||||
A = &\set{v \mid x_v \leq \frac{1}{2}-\epsilon} \\
|
|
||||||
B = &\set{v \mid v \notin A \cup C} \\
|
|
||||||
C = &\set{v \mid x_v \geq \frac{1}{2}+\epsilon}
|
|
||||||
\end{align*}
|
|
||||||
Für alle $v \in A$ setzen wir $x_v = 0$, für alle $v \in B$ setzen wir
|
|
||||||
$x_v = \frac{1}{2}$ und für alle $v \in C$ setzen wir $x_v = 1$.
|
|
||||||
Als $\epsilon$ wählen wir das das kleinste $x_v$.
|
|
||||||
|
|
||||||
Das dürfen wir, da wir damit die LP-Beschränkungen aufrechterhalten.
|
|
||||||
\begin{enumerate}
|
|
||||||
\item Für alle Variablen $x_v$ gilt $0 \leq x_v \leq 1$.
|
|
||||||
\item Für alle Paare $v, u$ gilt $x_v + x_u \geq 1$, da
|
|
||||||
|
|
||||||
Fall 1: O.B.d.A gilt: Wenn $x_v \leq \frac{1}{2} - \epsilon$, dann muss $x_u \geq \frac{1}{2} + \epsilon$, wird $x_v = 0$ und $x_u = 1$.
|
|
||||||
|
|
||||||
Fall 2: Wenn $x_v$ oder $x_u \geq \frac{1}{2} + \epsilon$, werden
|
|
||||||
$x_v$ oder $x_u = 1$.
|
|
||||||
|
|
||||||
Fall 3: Wenn $x_v, x_u \notin A \cup C$, werden $x_v = x_u = \frac{1}{2}$.
|
|
||||||
\end{enumerate}
|
|
||||||
Die Laufzeit beläuft sich auf $\Oh(V)$ da sich das $\min_{v \in V} x_v$ in
|
|
||||||
$\Oh(V)$ Zeit finden und sich jeder Knoten in $\Oh(V)$ in eine
|
|
||||||
der drei Mengen einteilen lassen kann.
|
|
||||||
\points{3}
|
|
||||||
\item
|
|
||||||
Wir nehmen als Basis den Algorithmus aus \autoref{1b}. Um nun eine
|
|
||||||
eindeutige 2-Approximation für die Knotenüberdeckung zu bekommen,
|
|
||||||
runden wir alle $x_v = \frac{1}{2}$ auf $1$ auf.
|
|
||||||
|
|
||||||
Dadurch erhalten wir eine Lösung die maximal doppelt so viele Knoten
|
|
||||||
enthält, wie eine optimale Lösung, da für ein Knotenpaar $v, u$ für das
|
|
||||||
$x_v = x_u = \frac{1}{2}$ mindestens ein Knoten in der Knotenüberdeckung
|
|
||||||
enthalten sein muss. Wenn wir beide Knoten nehmen, haben wir doppelt so
|
|
||||||
viele.
|
|
||||||
\points{2}
|
|
||||||
\end{tasks}
|
|
||||||
|
|
@ -1,75 +0,0 @@
|
||||||
\section{Christofides’ Algorithmus}
|
|
||||||
\begin{tasks}
|
|
||||||
\item
|
|
||||||
Siehe \autoref{fig:christofides}.
|
|
||||||
\points{4}
|
|
||||||
\item
|
|
||||||
Siehe \autoref{fig:checkmate}. Diese Tour kann nicht von \algt{Christofides}
|
|
||||||
berechnet werden, denn egal mit welcher Kante in welche Richtung gestartet
|
|
||||||
wird, nimmt \algt{Cristofides} immer eine Kante in die Tour, die nicht in
|
|
||||||
\autoref{fig:checkmate} ist.
|
|
||||||
|
|
||||||
\begin{figure}
|
|
||||||
\centering
|
|
||||||
\includegraphics[page=10, width=0.5\textwidth]{figures.pdf}
|
|
||||||
\caption{Eine kleinere TSP-Tour, die von \algt{Cristofides} nicht berechnet werden kann.}
|
|
||||||
\label{fig:checkmate}
|
|
||||||
\end{figure}
|
|
||||||
\points{1}
|
|
||||||
\end{tasks}
|
|
||||||
|
|
||||||
{
|
|
||||||
\newpage
|
|
||||||
\KOMAoptions{mpinclude=false}
|
|
||||||
\recalctypearea
|
|
||||||
\begin{figure}
|
|
||||||
\centering
|
|
||||||
\begin{subfigure}{.3\linewidth}
|
|
||||||
\centering
|
|
||||||
\includegraphics[page=1, width=0.9\textwidth]{figures.pdf}
|
|
||||||
\caption{Der gewichtete, vollständige Graph $G$.}
|
|
||||||
\end{subfigure}
|
|
||||||
\begin{subfigure}{.3\linewidth}
|
|
||||||
\centering
|
|
||||||
\includegraphics[page=2, width=0.9\textwidth]{figures.pdf}
|
|
||||||
\caption{Minimalen Spannbaum finden.}
|
|
||||||
\end{subfigure}
|
|
||||||
\begin{subfigure}{.3\linewidth}
|
|
||||||
\centering
|
|
||||||
\includegraphics[page=3, width=0.9\textwidth]{figures.pdf}
|
|
||||||
\caption{Knoten $U$ mit ungeraden Graden finden.}
|
|
||||||
\end{subfigure}
|
|
||||||
\begin{subfigure}{.3\linewidth}
|
|
||||||
\centering
|
|
||||||
\includegraphics[page=4, width=0.9\textwidth]{figures.pdf}
|
|
||||||
\caption{Minimales, perfektes Matching auf $G[U]$ finden.}
|
|
||||||
\end{subfigure}
|
|
||||||
\begin{subfigure}{.3\linewidth}
|
|
||||||
\centering
|
|
||||||
\includegraphics[page=5, width=0.9\textwidth]{figures.pdf}
|
|
||||||
\caption{Eulertour konstruieren.}
|
|
||||||
\end{subfigure}
|
|
||||||
\begin{subfigure}{.3\linewidth}
|
|
||||||
\centering
|
|
||||||
\includegraphics[page=6, width=0.9\textwidth]{figures.pdf}
|
|
||||||
\caption{Eulertour konstruieren.}
|
|
||||||
\end{subfigure}
|
|
||||||
\begin{subfigure}{.3\linewidth}
|
|
||||||
\centering
|
|
||||||
\includegraphics[page=7, width=0.9\textwidth]{figures.pdf}
|
|
||||||
\caption{Eulertour konstruieren.}
|
|
||||||
\end{subfigure}
|
|
||||||
\begin{subfigure}{.3\linewidth}
|
|
||||||
\centering
|
|
||||||
\includegraphics[page=8, width=0.9\textwidth]{figures.pdf}
|
|
||||||
\caption{Eulertour konstruieren.}
|
|
||||||
\end{subfigure}
|
|
||||||
\begin{subfigure}{.3\linewidth}
|
|
||||||
\centering
|
|
||||||
\includegraphics[page=9, width=0.9\textwidth]{figures.pdf}
|
|
||||||
\caption{Schon besuchte Knoten überspringen. TSP vollständig.}
|
|
||||||
\end{subfigure}
|
|
||||||
\caption{Cristofides' Algorithmus}
|
|
||||||
\label{fig:christofides}
|
|
||||||
\end{figure}
|
|
||||||
}
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
||||||
\section{Matchings in allgemeinen Graphen}
|
|
||||||
\begin{tasks}
|
|
||||||
\item
|
|
||||||
|
|
||||||
\begin{pseudocode}
|
|
||||||
Matchings($G = \tup(V, E)$)
|
|
||||||
$M = \emptyset$
|
|
||||||
$visited =$ |Array von $False$ der Größe| $|V|$ // Markiert gematchte Knoten
|
|
||||||
|
|
||||||
for $e$ in $E$ do
|
|
||||||
if $\neg visited[u] \wedge \neg visited[v]$ then
|
|
||||||
$M = M \cup \{e\}$
|
|
||||||
$visited[u] = True$
|
|
||||||
$visited[v] = True$
|
|
||||||
return $M$
|
|
||||||
\end{pseudocode}
|
|
||||||
|
|
||||||
Angenommen $M$ wäre erweiterbar (d.h. es gibt eine Kante $\{u,v\}$ mit $u,v \notin V(M)$). Dann wurden sowohl $u$ als auch $v$ während des Algorithmus beim Durchlaufen der Kante $\{u,v\}$ als frei angesehen und wäre somit der Menge $M$ hinzugefügt worden. Das ist eine Widerspruch.
|
|
||||||
|
|
||||||
\textbf{Laufzeit:}
|
|
||||||
|
|
||||||
Initialisierung des Arrays: $\Oh(V)$
|
|
||||||
|
|
||||||
Schleife: Jede Kante wird genau einmal betrachtet ($\Oh(V)$) und die Überprüfung und Markierung passieren in $\Oh(1)$. Also insgesamt $\Oh(E)$
|
|
||||||
|
|
||||||
Das ergibt eine Gesamtlaufzeit von $\Oh(V+E)$
|
|
||||||
\points{3}
|
|
||||||
\item
|
|
||||||
\points{2}
|
|
||||||
|
|
||||||
\item
|
|
||||||
Sei $M$ das vom Algorithmus berechnete maximale Matching und $M^*$ das optimale maximale Matching.
|
|
||||||
|
|
||||||
Für jede Kante $e^*=\{u,v\}\in M^*$ gilt: mindestens einer der beiden Knoten $u$ oder $v$ muss über eine Kante aus $M$ abgedeckt werden, sonst wäre der $M$ nicht nicht-erweiterbar.
|
|
||||||
|
|
||||||
Eine Kante aus $M$ hat genau zwei Endknoten und kann daher höchstens zwei verschiedene Kanten aus $M^*$ ,,blockieren``. Da alle Kanten in $M^*$ disjunkt sind kann man daraus folgern:
|
|
||||||
\[
|
|
||||||
\abs{M^*} \leq 2\cdot \abs{M} \implies \abs{M} \geq \frac{1}{2} \abs{M^*}
|
|
||||||
\]
|
|
||||||
Somit ist der Algorithmus aus der Teilaufgabe a) eine 1/2 Approximation für ein optimales Matching.
|
|
||||||
|
|
||||||
\points{3}
|
|
||||||
\item
|
|
||||||
|
|
||||||
Zielfunktion:
|
|
||||||
\[
|
|
||||||
\arg\min \sum_{e\in E} x_e \geq 1
|
|
||||||
\]
|
|
||||||
Entscheidungsvariablen: für jede Kante $e\in E$:
|
|
||||||
\[
|
|
||||||
x_e\in\{0,1\}\quad \forall e\in E
|
|
||||||
\]
|
|
||||||
Die Variable nimmt den Wert 1 an, wenn die Kante im Matching M ist und 0 falls sie das nicht ist.
|
|
||||||
|
|
||||||
Nebenbedingungen:
|
|
||||||
\begin{enumerate}
|
|
||||||
\item
|
|
||||||
Matching: Jeder Knoten darf von maximal einer Matching-Kante berührt werden
|
|
||||||
\[
|
|
||||||
\forall v\in V \colon \sum_{e\in \delta(v)}x_e\leq1
|
|
||||||
\]
|
|
||||||
$\delta(v)$ ist die Menge aller Kanten welche an $v$ anliegen
|
|
||||||
\item Nicht-Erweiterbarkeit: Für jede Kante $\{u,v\}$ muss die Summe der Matching-Kanten an $u$ und $v$ mindestens 1 sein
|
|
||||||
\[
|
|
||||||
\forall \{u,v\} \in E \colon \sum_{e \in \delta(u)} x_e + \sum_{e' \in \delta(v)} x_e' \geq 1
|
|
||||||
\]
|
|
||||||
$\delta(v)$ ist die Menge aller Kanten welche an $v$ anliegen. Äquivalent für $\delta(u)$.
|
|
||||||
\end{enumerate}
|
|
||||||
\points{3}
|
|
||||||
\item
|
|
||||||
\points{2}
|
|
||||||
\end{tasks}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
\section{Längste Wege}
|
|
||||||
\begin{tasks}
|
|
||||||
\item
|
|
||||||
Da $s, t$ in $G'$ adjazent zu jedem Knoten in $G$ ist, können wir
|
|
||||||
einen einfachen $s$-$t$-Weg der Länge $k+2$ erzeugen, indem wir
|
|
||||||
einen einfachen Weg der Länge $k$ in $G$ nehmen, $s$ an das eine Ende und $t$ an das andere Ende hängen.
|
|
||||||
|
|
||||||
Umgekehrt kann man aus einem einfachen $s$-$t$-Weg der Länge $k$
|
|
||||||
in $G'$ einen einfachen Weg der Länge $k-2$ in $G$ konstruieren,
|
|
||||||
indem wir $s$ und $t$ entfernen.
|
|
||||||
\points{2}
|
|
||||||
|
|
||||||
\item
|
|
||||||
Ein Hamiltonweg ist ein Weg der alle Knoten in $G$ beinhaltet
|
|
||||||
und somit Länge $n-1$ besitzt.
|
|
||||||
|
|
||||||
Wie wir oben gezeigt haben, kann ein $s$-$t$-Weg der Länge $n+1$
|
|
||||||
in $G'$ leicht in einen Weg der Länge $n-1$ in $G$ umgewandelt
|
|
||||||
werden. Das heißt, dass wir einen Hamiltonweg in $G$ finden,
|
|
||||||
wenn wir einen $s$-$t$-Weg finden.
|
|
||||||
|
|
||||||
Umgekehrt können wir einen Hamiltonweg leicht in einen $s$-$t$-Weg
|
|
||||||
umwandeln, also finden wir einen $s$-$t$-Weg wenn wir einen
|
|
||||||
Hamiltonweg finden.
|
|
||||||
|
|
||||||
Also finden wir einen Hamiltonweg genau dann, wenn wir einen
|
|
||||||
$s$-$t$-Weg finden.
|
|
||||||
\points{1}
|
|
||||||
|
|
||||||
\item
|
|
||||||
Da wir Hamiltonweg auf \algt{Längster $s$-$t$-Weg} reduziert
|
|
||||||
haben, muss also \algt{Längster $s$-$t$-Weg} $\NPe$-schwer sein, denn
|
|
||||||
wenn es in $\Pe$ liegen würde, könnten wir auch Hamiltonweg in
|
|
||||||
polynomieller Zeit lösen. Da wir nicht von $\Pe = \NPe$ ausgehen,
|
|
||||||
ist das nicht möglich.
|
|
||||||
\points{2}
|
|
||||||
|
|
||||||
\end{tasks}
|
|
||||||
Binary file not shown.
|
|
@ -1,71 +0,0 @@
|
||||||
% vim: set filetype:tex
|
|
||||||
|
|
||||||
% Identification %
|
|
||||||
\NeedsTeXFormat{LaTeX2e}
|
|
||||||
\ProvidesClass{ngexrcs}[2021/12/21 ADS Exercise class]
|
|
||||||
|
|
||||||
% Handle options %
|
|
||||||
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrartcl}}
|
|
||||||
\ProcessOptions\relax
|
|
||||||
|
|
||||||
% More declarations %
|
|
||||||
\LoadClass{scrartcl}
|
|
||||||
|
|
||||||
\KOMAoptions{mpinclude=true}
|
|
||||||
\recalctypearea
|
|
||||||
|
|
||||||
\RequirePackage{ngutils}
|
|
||||||
|
|
||||||
% define fonts
|
|
||||||
\RequirePackage{fontspec}
|
|
||||||
\RequirePackage[math-style=upright]{unicode-math}
|
|
||||||
\setmainfont{TeX Gyre Pagella}
|
|
||||||
\setsansfont{TeX Gyre Heros}
|
|
||||||
\setmonofont{TeX Gyre Cursor}
|
|
||||||
\setmathfont{Euler Math}
|
|
||||||
|
|
||||||
\setlength{\marginparwidth}{1.5\marginparwidth}
|
|
||||||
\setlength{\fboxrule}{\heavyrulewidth}
|
|
||||||
|
|
||||||
% Use sansfont for all title elements
|
|
||||||
\addtokomafont{titlehead}{\sffamily}
|
|
||||||
\addtokomafont{subject}{\sffamily}
|
|
||||||
\addtokomafont{title}{\sffamily}
|
|
||||||
\addtokomafont{subtitle}{\sffamily}
|
|
||||||
\addtokomafont{author}{\sffamily}
|
|
||||||
\addtokomafont{date}{\sffamily}
|
|
||||||
\addtokomafont{publishers}{\sffamily}
|
|
||||||
|
|
||||||
% Use serif font for headings
|
|
||||||
\addtokomafont{disposition}{\rmfamily}
|
|
||||||
|
|
||||||
% Let sections be formated as in: Aufgabe 1 -- Section title
|
|
||||||
\renewcommand*{\sectionformat}{Aufgabe \thesection\autodot\enskip--\enskip}
|
|
||||||
|
|
||||||
% Let points of an exercise be printed as in: [__ / 2]
|
|
||||||
\newkomafont{points}{\sffamily}
|
|
||||||
\newcommand\points[2][1em]{\marginline{\framebox{{\usekomafont{points}\hspace{#1} \textbf{/} #2}}}}
|
|
||||||
|
|
||||||
\newcounter{task}
|
|
||||||
\renewcommand{\thetask}{\@alph\c@task)}
|
|
||||||
\newenvironment{tasks}
|
|
||||||
{
|
|
||||||
\begin{list}{\thetask}
|
|
||||||
{
|
|
||||||
\usecounter{task}
|
|
||||||
\setlength{\leftmargin}{1.6em}
|
|
||||||
}
|
|
||||||
}{%
|
|
||||||
\end{list}
|
|
||||||
}
|
|
||||||
|
|
||||||
\DeclareNewTOC
|
|
||||||
[
|
|
||||||
type=algorithm,
|
|
||||||
types=algorithms,
|
|
||||||
float,
|
|
||||||
floattype=4,
|
|
||||||
name=Algorithmus,
|
|
||||||
listname={Algorithmenverzeichnis}
|
|
||||||
]
|
|
||||||
{loa}
|
|
||||||
|
|
@ -1,157 +0,0 @@
|
||||||
\NeedsTeXFormat{LaTeX2e}
|
|
||||||
\ProvidesPackage{ngutils}[2026/06/05 Never's LaTeX utils]
|
|
||||||
|
|
||||||
\RequirePackage[ngerman]{babel}
|
|
||||||
\RequirePackage{graphicx}
|
|
||||||
\RequirePackage{tabularx}
|
|
||||||
\RequirePackage{booktabs}
|
|
||||||
\RequirePackage{listings}
|
|
||||||
|
|
||||||
\lstnewenvironment{pseudocode}[1][] %defines the algorithm listing environment
|
|
||||||
{
|
|
||||||
\renewcommand{\lstlistingname}{Algorithmus}
|
|
||||||
\lstset{ %this is the stype
|
|
||||||
mathescape=true,
|
|
||||||
columns=fullflexible,
|
|
||||||
basicstyle=\normalfont,
|
|
||||||
identifierstyle=\scshape,
|
|
||||||
keywordstyle=\bfseries,
|
|
||||||
keywords={, and, or, not, new, if, then, else, while, for, in, to, up, down, foreach, do, return},
|
|
||||||
commentstyle=\itshape,
|
|
||||||
comment=[l]//,
|
|
||||||
delim=[is][\normalfont]{|}{|},
|
|
||||||
tabsize=3,
|
|
||||||
frame=tb,
|
|
||||||
framerule=1pt,
|
|
||||||
#1 % this is to add specific settings to an usage of this environment (for instnce, the caption and referable label)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{}
|
|
||||||
|
|
||||||
\newcommand{\seilpmi}{\Longleftarrow}
|
|
||||||
|
|
||||||
\newcommand{\NN}{\mathbb{N}}
|
|
||||||
\newcommand{\ZZ}{\mathbb{Z}}
|
|
||||||
\newcommand{\QQ}{\mathbb{Q}}
|
|
||||||
\newcommand{\RR}{\mathbb{R}}
|
|
||||||
\newcommand{\CC}{\mathbb{C}}
|
|
||||||
\newcommand{\PP}{\mathbb{P}}
|
|
||||||
|
|
||||||
\newcommand{\Pe}{\mathrm{P}}
|
|
||||||
\newcommand{\NPe}{\mathrm{NP}}
|
|
||||||
|
|
||||||
\newcommand{\Oh}{\mathcal{O}}
|
|
||||||
\newcommand{\oh}{\scriptstyle{\mathcal{O}}}
|
|
||||||
|
|
||||||
\newcommand{\Eh}{\mathop{\mathrm{E}}}
|
|
||||||
\newcommand{\Var}{\mathop{\mathrm{Var}}}
|
|
||||||
\newcommand{\pot}{\mathop{\mathcal{P}}}
|
|
||||||
\newcommand{\argmax}{\mathop{\mathrm{arg\,max}}}
|
|
||||||
\newcommand{\argmin}{\mathop{\mathrm{arg\,min}}}
|
|
||||||
|
|
||||||
\newcommand{\parens}[1]{\left(#1\right)}
|
|
||||||
\newcommand{\brackets}[1]{\left[#1\right]}
|
|
||||||
\newcommand{\braces}[1]{\left\{#1\right\}}
|
|
||||||
\newcommand{\angled}[1]{\left\langle#1\right\rangle}
|
|
||||||
|
|
||||||
\newcommand{\suchthat}{\;\middle\vert\;}
|
|
||||||
|
|
||||||
\newcommand{\tup}[1]{\parens{#1}}
|
|
||||||
\newcommand{\interval}[2][b]{
|
|
||||||
\if\detokenize{a}\detokenize{#1}%
|
|
||||||
\left[#2\right[
|
|
||||||
\fi
|
|
||||||
\if\detokenize{b}\detokenize{#1}%
|
|
||||||
\left[#2\right]
|
|
||||||
\fi
|
|
||||||
\if\detokenize{c}\detokenize{#1}%
|
|
||||||
\left]#2\right[
|
|
||||||
\fi
|
|
||||||
\if\detokenize{d}\detokenize{#1}%
|
|
||||||
\left]#2\right]
|
|
||||||
\fi
|
|
||||||
}
|
|
||||||
\newcommand{\set}[2][]{
|
|
||||||
\ifx&
|
|
||||||
\braces{#2}
|
|
||||||
\else
|
|
||||||
\braces{#1 \suchthat #2}
|
|
||||||
\fi
|
|
||||||
}
|
|
||||||
\newcommand{\arr}[1]{\angled{#1}}
|
|
||||||
\newcommand{\abs}[1]{\left\vert#1\right\vert}
|
|
||||||
\newcommand{\norm}[1]{\left\Vert#1\right\Vert}
|
|
||||||
\newcommand{\ceil}[1]{\left\lceil#1\right\rceil}
|
|
||||||
\newcommand{\floor}[1]{\left\lfloor#1\right\rfloor}
|
|
||||||
|
|
||||||
% \newcommand{\alg}[2]{{\normalfont\scshape#1}{\normalfont(#2)}}
|
|
||||||
\newcommand{\algt}[1]{{\normalfont\scshape#1}}
|
|
||||||
|
|
||||||
\makeatletter
|
|
||||||
\newcommand*{\alg@unstarred}[2]{{\normalfont\scshape#1}{\normalfont(#2)}}
|
|
||||||
\newcommand*{\alg@starred}[1]{{\normalfont\scshape#1}}
|
|
||||||
\newcommand*{\alg}{\@ifstar{\alg@starred}{\alg@unstarred}}
|
|
||||||
\makeatother
|
|
||||||
|
|
||||||
\newcommand{\com}[1]{{\normalfont\itshape/\!\!/ #1}}
|
|
||||||
|
|
||||||
\newenvironment{algorithmic}[1][1em]{
|
|
||||||
\begin{minipage}[t]{\dimexpr\linewidth}
|
|
||||||
\bfseries
|
|
||||||
\begin{tabbing}
|
|
||||||
\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\hspace{#1}\=\kill
|
|
||||||
}{%
|
|
||||||
\end{tabbing}
|
|
||||||
\end{minipage}
|
|
||||||
}
|
|
||||||
|
|
||||||
% \newlength{\theoremskip}
|
|
||||||
% \setlength{\theoremskip}{6em}
|
|
||||||
%
|
|
||||||
% \newcommand{\theoremfont}{\normalfont\bfseries}
|
|
||||||
% \newcommand{\definitionfont}{\normalfont\bfseries}
|
|
||||||
%
|
|
||||||
% \newenvironment{theoremic}[3][]{
|
|
||||||
% {#3 #2 #1}
|
|
||||||
% \hfill
|
|
||||||
% \begin{minipage}[t]{\the\dimexpr\linewidth-\theoremskip\relax}
|
|
||||||
% }{
|
|
||||||
% \end{minipage}
|
|
||||||
% }
|
|
||||||
%
|
|
||||||
% \newenvironment{theorem}[1][]{
|
|
||||||
% \begin{theoremic}[#1]{Satz}{\theoremfont}
|
|
||||||
% }{
|
|
||||||
% \end{theoremic}
|
|
||||||
% }
|
|
||||||
%
|
|
||||||
% \newenvironment{lemma}[1][]{
|
|
||||||
% \begin{theoremic}[#1]{Lemma}{\theoremfont}
|
|
||||||
% }{
|
|
||||||
% \end{theoremic}
|
|
||||||
% }
|
|
||||||
%
|
|
||||||
% \newenvironment{corrolary}[1][]{
|
|
||||||
% \begin{theoremic}[#1]{Korall}{\theoremfont}
|
|
||||||
% }{
|
|
||||||
% \end{theoremic}
|
|
||||||
% }
|
|
||||||
%
|
|
||||||
% \newenvironment{proof}[1][]{
|
|
||||||
% \begin{theoremic}[#1]{Beweis}{\theoremfont}
|
|
||||||
% }{
|
|
||||||
% \end{theoremic}
|
|
||||||
% }
|
|
||||||
%
|
|
||||||
% \newenvironment{definition}[1][]{
|
|
||||||
% \begin{theoremic}[#1]{Definition}{\theoremfont}
|
|
||||||
% }{
|
|
||||||
% \end{theoremic}
|
|
||||||
% }
|
|
||||||
%
|
|
||||||
% \newenvironment{example}[1][]{
|
|
||||||
% \begin{theoremic}[#1]{Beispiel}{\theoremfont}
|
|
||||||
% }{
|
|
||||||
% \end{theoremic}
|
|
||||||
% }
|
|
||||||
%
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue