mirror of
https://github.com/2martens/uni.git
synced 2026-05-06 19:36:26 +02:00
Compare commits
40 Commits
ad_blatt_3
...
ad_blatt_4
| Author | SHA1 | Date | |
|---|---|---|---|
| da05933c8d | |||
| 4cbbe10194 | |||
| 99ca499a0a | |||
| 4d8389eba9 | |||
| a6ed748153 | |||
| 758f40ea1f | |||
| 26fda0ddb4 | |||
| 347f0584a0 | |||
| 240dd113ab | |||
| 7fb91df76f | |||
| 542da545e2 | |||
| 8743f36082 | |||
| 02da1f0144 | |||
| 44ab3e4e0b | |||
| 7913205597 | |||
| 1f552564c9 | |||
| b3df21b7d1 | |||
| 66ba6adf3c | |||
| 034d351d48 | |||
| 7782f3bce6 | |||
| 891d29e8db | |||
| f0ede8a917 | |||
| 6944116e41 | |||
| 4814d034eb | |||
| 18beb0ed80 | |||
| 470120c41a | |||
| 6781c5ac6b | |||
| 32ee17cb3d | |||
| 7f9d6991ad | |||
| 5496fc3dd5 | |||
| d71f895dad | |||
| 11002283c7 | |||
| ba8e658c6b | |||
| 53c2f20454 | |||
| 8c9345ae82 | |||
| c1e7081efc | |||
| 605f14d18f | |||
| d47a755fdf | |||
| 2b4c538135 | |||
| 5d3323e75e |
11
README.md
11
README.md
@ -1,4 +1,13 @@
|
||||
uni
|
||||
===
|
||||
|
||||
University stuff
|
||||
Aus gegebenem Anlass:
|
||||
|
||||
Die in diesem Repository zu findenen Latex- und .rkt-Dateien sind Hausaufgaben. Zum Zwecke der Zusammenarbeit innerhalb
|
||||
**meiner** Gruppe werden auch Dateien hochgeladen, deren Abgabedeadline noch nicht erreicht ist.
|
||||
|
||||
Es nutzt anderen Gruppen kein Stück diese noch ausstehenden Abgaben 1:1 zu kopieren, die Namen zu ändern und als ihre
|
||||
eigene Arbeit auszugeben. Denn dann bekommen beide Gruppen keine Punkte. Da dies so in GDB passiert ist, werden die entsprechenden
|
||||
Latexdateien für GDB ab sofort erst nach der Abgabedeadline hochgeladen. Es ist bedauerlich, dass einige Personen in dieser
|
||||
Hinsicht derartig dumm sind. Es spricht nichts dagegen sich die von mir bearbeiteten Abgaben anzusehen und sich Ideen zu holen.
|
||||
Identische Kopien sind aber in keinem Falle angebracht.
|
||||
|
||||
334
ad/AD-Gruppe_8_Koehler_Krabbe_Martens_Blatt4.tex
Normal file
334
ad/AD-Gruppe_8_Koehler_Krabbe_Martens_Blatt4.tex
Normal file
@ -0,0 +1,334 @@
|
||||
\documentclass[10pt,a4paper,oneside,ngerman,numbers=noenddot]{scrartcl}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage[ngerman]{babel}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{amsfonts}
|
||||
\usepackage{amssymb}
|
||||
\usepackage{bytefield}
|
||||
\usepackage{paralist}
|
||||
\usepackage{gauss}
|
||||
\usepackage{pgfplots}
|
||||
\usepackage{textcomp}
|
||||
\usepackage[locale=DE,exponent-product=\cdot,detect-all]{siunitx}
|
||||
\usepackage{tikz}
|
||||
\usepackage{algorithm}
|
||||
\usepackage{algorithmic}
|
||||
\usetikzlibrary{automata,matrix,fadings,calc,positioning,decorations.pathreplacing,arrows,decorations.markings}
|
||||
\usepackage{polynom}
|
||||
\polyset{style=C, div=:,vars=x}
|
||||
\pgfplotsset{compat=1.8}
|
||||
\pagenumbering{arabic}
|
||||
\def\thesection{\arabic{section})}
|
||||
\def\thesubsection{(\alph{subsection})}
|
||||
\def\thesubsubsection{(\roman{subsubsection})}
|
||||
\makeatletter
|
||||
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
|
||||
\hskip -\arraycolsep
|
||||
\let\@ifnextchar\new@ifnextchar
|
||||
\array{#1}}
|
||||
\makeatother
|
||||
\parskip 12pt plus 1pt minus 1pt
|
||||
\parindent 0pt
|
||||
|
||||
\begin{document}
|
||||
\author{Reinhard Köhler (6425686), Tronje Krabbe (6435002), \\
|
||||
Jim Martens (6420323)}
|
||||
\title{Hausaufgaben zum 4. Dezember}
|
||||
\subtitle{Gruppe 8}
|
||||
\maketitle
|
||||
\section{} %1
|
||||
\subsection{} %a
|
||||
Der Algorithmus funktioniert nicht mehr. Dies wird anhand dieses Gegenbeispiels deutlich:
|
||||
|
||||
\begin{verbatim}
|
||||
A = [0,1,4,8,10,13]
|
||||
value = 1
|
||||
low = 0
|
||||
high = 5
|
||||
// erster Schleifendurchlauf 0 < 5, daher Rumpf ausführen
|
||||
mid = (0 + 5) / 2 = 2
|
||||
// A[2] = 4 > value
|
||||
high = 2 - 1 = 1
|
||||
// zweiter Schleifendurchlauf 0 < 1, daher Rumpf ausführen
|
||||
mid = (0 + 1) / 2 = 0
|
||||
// A[0] = 0 < value
|
||||
low = 0 + 1 = 1
|
||||
// dritter Schleifendurchlauf 1 = 1, daher Rumpf nicht ausführen
|
||||
return not_found
|
||||
\end{verbatim}
|
||||
|
||||
Obwohl das Element vorhanden ist, wird zurückgegeben, dass es nicht vorhanden sei. Da es ein Gegenbeispiel gibt, funktioniert der Algorithmus nach der Änderung von \texttt{while (low <= high)} zu \texttt{while (low < high)} nicht mehr.
|
||||
\subsection{} %b
|
||||
\begin{verbatim}
|
||||
BinarySearch(A[0..N-1], value) {
|
||||
low = N - 1
|
||||
high = 0
|
||||
while (high <= low) {
|
||||
// invariants: value > A[i] for all i < low
|
||||
value < A[i] for all i > high
|
||||
mid = (low + high) / 2
|
||||
if (A[mid] > value)
|
||||
high = mid + 1
|
||||
else if (A[mid] < value)
|
||||
low = mid - 1
|
||||
else
|
||||
return mid
|
||||
}
|
||||
return not_found
|
||||
}
|
||||
\end{verbatim}
|
||||
\subsection{} %c
|
||||
\textbf{Formaler Beweis:} Wir müssen beweisen, dass die while-Schleife endet. Angenommen wir befinden uns in Iteration $i$ der while-Schleife.
|
||||
\begin{itemize}
|
||||
\item Zu Beginn der while-Schleife haben wir \texttt{high $\leq$ low} (andernfalls hätten wir die while-Schleife nicht betreten).
|
||||
\item Nach dem Ausdruck \texttt{mid = (low + high) / 2} gilt \texttt{high $\leq$ mid $\leq$ low}.
|
||||
\item Entweder die Schleife wird durch die Rückgabe von \texttt{mid} beendet, womit wir fertig wären.
|
||||
\item Oder sie befindet sich in einer der ersten beiden Fälle des if-Statements. Entweder high wird um mindestens eins erhöht oder low wird um mindestens eins verkleinert, wodurch sich in jedem Schleifendurchlauf die Differenz von \texttt{low - high} um mindestens eins verringert.
|
||||
\item Damit gilt \texttt{low - high < 0} nach maximal $n$ Iterationen der while-Schleife und die Schleife terminiert.
|
||||
\end{itemize}
|
||||
\subsection{} %d
|
||||
\textbf{Beweis der Korrektheit:}
|
||||
|
||||
Offensichtlich gibt der Algorithmus ein korrektes Ergebnis zurück, wenn \texttt{mid} zurückgegeben wird, da dann \texttt{A[mid] $=$ value} gilt.
|
||||
|
||||
Zu zeigen: Wenn der Algorithmus \texttt{not\_found} zurückgibt, dann kommt \texttt{value} tatsächlich nicht in dem Array vor.
|
||||
|
||||
Wir werden dies nun durch die Gegenposition beweisen: Wir müssen zeigen, dass wenn \texttt{value} im Array vorkommt, der Algorithmus \texttt{mid} zurückgibt.
|
||||
|
||||
\textbf{Erster Schritt:} Es ist einfach zu sehen, dass die folgenden Invarianten immer gelten:
|
||||
\begin{itemize}
|
||||
\item \texttt{value > A[i] for all i < low (strict inequality!)}
|
||||
\item \texttt{value < A[i] for all i > high (strict inequality!)}
|
||||
\end{itemize}
|
||||
|
||||
\textbf{Zweiter Schritt:} Annahme, dass \texttt{value} im Array vorkommt.
|
||||
\begin{itemize}
|
||||
\item Bereits bekannt: Invarianten sind wahr. Das bedeutet zu keinem Zeitpunkt im Algorithmus kann sich das Element, das wir suchen, links von \texttt{high} oder rechts von \texttt{low} befinden.
|
||||
\item Der einzige Weg, wie wir theoretisch das gesuchte Element "`verpassen"' könnten, wäre, dass \texttt{high = mid + 1} oder \texttt{low = mid - 1} zu der Situation führen, dass \texttt{high > low} gilt bevor wir das gesuchte Element gefunden haben (weil wir dann die Schleife verlassen).
|
||||
\begin{itemize}
|
||||
\item Durch die Konstruktion des Algorithmus haben wir immer \texttt{high $\leq$ mid $\leq$ low} nachdem \texttt{mid = (low + high) / 2} ausgeführt wurde.
|
||||
\item Solange \texttt{low $\geq$ high + 2} gilt, haben wir immer \texttt{high < mid < low}.
|
||||
In dieser Situation, \texttt{mid - 1 $\geq$ high} und \texttt{mid + 1 $\leq$ low}, haben wir immer noch \texttt{high $\leq$ low} nachdem entweder \texttt{high = mid + 1} oder \texttt{low = mid - 1} ausgeführt wurden, sodass die while-Schleife ein weiteres Mal betreten wird.
|
||||
|
||||
Es gibt zwei kritische Fälle, in denen wir die Schleife verlassen könnten:
|
||||
\begin{itemize}
|
||||
\item \texttt{low = high}. Aber dann gilt auch \texttt{mid = high}. Nach der Annahme, dass \texttt{value} im Array ist, muss \texttt{A[high] = value} gelten. Durch die Rückgabe von \texttt{mid} wird demnach genau der richtige Index zurückgegeben.
|
||||
\item \texttt{low = high + 1}. In diesem Fall gilt \texttt{mid = high}. Nun gilt entweder \texttt{A[high] = A[mid] = value}, wodurch durch Rückgabe von \texttt{mid} das richtige Ergebnis zurückgegeben würde, oder es gilt \texttt{A[high] = A[mid] > value}, wodurch \texttt{high} um eins erhöht würde, was beim nächsten Schleifendurchlauf im Fall \texttt{low = high} enden würde. In dem Fall wird das korrekte Ergebnis zurückgegeben, wie bereits gezeigt wurde.
|
||||
\end{itemize}
|
||||
\end{itemize}
|
||||
\item Dies zeigt, dass wenn \texttt{value} im Array vorhanden ist, der Algorithmus immer damit endet \texttt{mid} zurückzugeben.
|
||||
\end{itemize}
|
||||
\section{} %2
|
||||
\subsection{} %a
|
||||
\subsubsection{} %i
|
||||
In einem Graph ohne Kanten kann jeder Knoten gleich gefärbt sein. Dies gilt, weil die Bedingung $c_{k}(i= \neq c_{k}(j)$ nur gilt, wenn $i$ und $j$ mit einer Kante verbunden sind, was in solch einem Graphen nicht gegeben ist. Daher ist hier nichts zu zeigen.
|
||||
\subsubsection{} %ii
|
||||
Wenn ein Graph k-färbbar ist, dann kann man auch eine weitere Farbe in die Abbildung $c_{k}$ hinzunehmen ohne sie zu benutzen. Dies gilt da $c_{k}$ nicht surjektiv sein muss.
|
||||
\subsubsection{} %iii
|
||||
Man nehme einen k-färbbaren Graphen. Nun kann man solange weitere Farben hinzufügen, bis n Farben in der Abbildung vorkommen. Diese müssen jedoch nicht benutzt werden. Daher ist jeder Graph n-färbbar.
|
||||
\subsection{} %b
|
||||
\subsubsection{} %i
|
||||
Wenn ein Graph 2-färbbar ist, dann gibt es keine Zyklen ungerader Länge. Bei einem Zyklus gerader Länge kann jeder zweiter Knoten die gleiche Farbe haben, ohne mit einem Knoten verbunden zu sein, der die gleiche Farbe hat.
|
||||
|
||||
Alle Knoten mit einer Farbe kann man als eine Untermenge einer Abbildung eines bipartiten Graphen verstehen.
|
||||
\subsubsection{} %ii
|
||||
\begin{verbatim}
|
||||
IST_2FAERBUNG(G) {
|
||||
kanten = E(G)
|
||||
valid = true
|
||||
farben = new Set()
|
||||
foreach kante in kanten {
|
||||
knoten1 = kante.knoten1
|
||||
knoten2 = kante.knoten2
|
||||
farben.add(knoten1.farbe)
|
||||
farben.add(knoten2.farbe)
|
||||
if (knoten1.farbe == knoten2.farbe) {
|
||||
valid = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return (valid && (farben.getAnzahl() == 2))
|
||||
}
|
||||
\end{verbatim}
|
||||
\subsubsection{} %iii
|
||||
Es gibt 2 verschiedene 2-Färbungen, sofern man unterschiedliche Farben nicht als Unterschied ansieht. Pro 2 Farben gibt es genau 2 verschiedene Färbungen.
|
||||
\subsection{} %c
|
||||
Bei einer beliebigen Landkarte werden mindestens vier Farben benötigt, damit direkt benachbarte Länder stets unterschiedliche Farben haben.
|
||||
\subsubsection{} %i
|
||||
\begin{tikzpicture}
|
||||
\node (altona) {A};
|
||||
\node (eimsbuettel) [above right=of altona] {E};
|
||||
\node (nord) [right=of eimsbuettel] {N};
|
||||
\node (wandsbek) [right=of nord] {W};
|
||||
\node (mitte) [below=of eimsbuettel] {M};
|
||||
\node (harburg) [below left=of mitte] {H};
|
||||
\node (bergedorf) [below right=of mitte] {B};
|
||||
|
||||
\path[every node/.style={font=\scriptsize}]
|
||||
(altona) edge (mitte)
|
||||
(altona) edge (eimsbuettel)
|
||||
(mitte) edge (harburg)
|
||||
(mitte) edge (bergedorf)
|
||||
(mitte) edge (eimsbuettel)
|
||||
(mitte) edge (nord)
|
||||
(mitte) edge (wandsbek)
|
||||
(eimsbuettel) edge (nord)
|
||||
(nord) edge (wandsbek);
|
||||
\end{tikzpicture}
|
||||
\subsubsection{} %ii
|
||||
\begin{alignat*}{2}
|
||||
c_{k}(A) &=& gelb \\
|
||||
c_{k}(E) &=& rot \\
|
||||
c_{k}(M) &=& blau \\
|
||||
c_{k}(H) &=& rot \\
|
||||
c_{k}(B) &=& rot \\
|
||||
c_{k}(N) &=& gelb \\
|
||||
c_{k}(W) &=& rot
|
||||
\end{alignat*}
|
||||
\subsubsection{} %iii
|
||||
Die Aussage, dass vier Farben minimal sind, besagt nur, dass man es bei einer beliebigen Landkarte schafft diese mit maximal vier Farben zu färben. Es gibt die Obergrenze der nötigen Farben an. Die Regel besagt hingegen nicht, dass immer mindestens vier Farben benötigt werden. Bei einer Landkarte mit nur zwei aneinandergrenzenden Ländern reichen auch zwei Farben. Bei einer Karte mit nur einer zusammenhängenden Fläche ohne angrenzende Flächen reicht sogar eine Farbe.
|
||||
\subsubsection{} %iv
|
||||
\begin{tikzpicture}
|
||||
\node (sh) {SH};
|
||||
\node (hh) [below right=of sh] {HH};
|
||||
\node (meck) [right=of hh] {MP};
|
||||
\node (bremen) [below left=of hh] {B};
|
||||
\node (nieder) [below=of hh] {N};
|
||||
|
||||
\path[every node/.style={font=\scriptsize}]
|
||||
(sh) edge (hh)
|
||||
(sh) edge (meck)
|
||||
(hh) edge (nieder)
|
||||
(bremen) edge (nieder)
|
||||
(sh) edge (nieder)
|
||||
(bremen) edge (sh)
|
||||
(bremen) edge (hh);
|
||||
\end{tikzpicture}
|
||||
|
||||
In dieser konstruierten Karte (dargestellt als Graph), müssen mindestens vier Farben verwendet werden.
|
||||
\section{} %3
|
||||
\subsection{} %a
|
||||
\[
|
||||
G_{1}: 1, 3, 4, 5, 2, 8, 6, 7
|
||||
\]
|
||||
\[
|
||||
G_{2}: 1, 3, 5, 6, 4, 7, 2
|
||||
\]
|
||||
\subsection{} %b
|
||||
\[
|
||||
G_{1}: 4, 3, 7, 6, 8, 2, 5, 1
|
||||
\]
|
||||
\[
|
||||
G_{2}: 4, 6, 5, 3, 2, 7, 1
|
||||
\]
|
||||
\subsection{} %c
|
||||
\[
|
||||
G_{1}: 1, 3, 5, 4, 2, 7, 8, 6
|
||||
\]
|
||||
\[
|
||||
G_{2}: 1, 3, 4, 7, 5, 2, 6
|
||||
\]
|
||||
\subsection{} %d
|
||||
Für $G_1$ existiert keine topologische Sortierung, da es sich nicht um einen DAG (Directed acyclic graph) handelt. Dies erkennt man daran, dass beispielsweise ein Zyklus von 1 über 5 über 2 zurück zur 1 existiert. $\square$
|
||||
|
||||
Für $G_2$ existieren topologische Sortierungen, z.B.:
|
||||
\[
|
||||
1, 3, 5, 6, 4, 7, 2
|
||||
\]
|
||||
\subsection{} %e
|
||||
Wie bereits etabliert, existieren für $G_1$ keine mit ihm konsistenten topologischen Sortierungen. Für $G_2$ allerdings existieren mehrere:
|
||||
|
||||
Nach Proposition 5 (Uniqueness of topological Sort) im Skript, Folie 163, ist eine topologische Sortierung nur eindeutig, wenn der dazugehörige Graph einen Hamilton-Kreis enthält. $G_2$ enthält keinen Hamilton-Kreis. Dies ist leicht zu erkennen: es gibt keinen Pfad in dem Graphen, der die Knoten $2$ \textit{und} $3$ besucht. Daher gibt es mehrere topologische Sortierungen.
|
||||
|
||||
Eine weitere wäre z.B.:
|
||||
\[
|
||||
1, 7, 2, 5, 6, 4, 3
|
||||
\]
|
||||
\subsection{} %f
|
||||
starke Zusammenhangskomponenten von $G_{1}:$
|
||||
\begin{alignat*}{2}
|
||||
comp1:&&\; 1, 2, 5, 6, 7, 8 \\
|
||||
comp2:&&\; 3 \\
|
||||
comp3:&&\; 4
|
||||
\end{alignat*}
|
||||
|
||||
starke Zusammenhangskomponenten von $G_{2}:$
|
||||
\begin{alignat*}{1}
|
||||
comp1: 1 \\
|
||||
comp2: 2 \\
|
||||
comp3: 3 \\
|
||||
comp4: 4 \\
|
||||
comp5: 5 \\
|
||||
comp6: 6 \\
|
||||
comp7: 7
|
||||
\end{alignat*}
|
||||
\section{} %4
|
||||
\subsection{} %a
|
||||
% Senken finden (alle Senken infiltrieren, dadurch werden alle Module eliminiert)
|
||||
% Algorithmus aus Vorlesung benutzen
|
||||
Es müssen alle Module (oder Knoten) ohne eingehende Kanten eliminiert (bzw. markiert) werden, da diese andernfalls nie erreicht werden können. Zu allen anderen Knoten muss es gerichtete Pfade von einem dieser Knoten geben. Ausnahmen können starke Zusammenhangskomponenten bilden. In jeder starken Zusammenhangskomponente wird daher ebenfalls ein Knoten eliminiert.
|
||||
\newpage
|
||||
\begin{verbatim}
|
||||
function eliminiereMCP() {
|
||||
int zaehler = 0
|
||||
|
||||
list infiltrierteKnoten
|
||||
// füge alle Knoten ohne Vorgänger hinzu:
|
||||
for-all v in Knotenmenge:
|
||||
if v.eingehendeKanten == 0:
|
||||
infiltriere(v)
|
||||
infiltrierteKnoten.add(v)
|
||||
end if
|
||||
end for-all
|
||||
// füge einen Knoten aus jeder
|
||||
// starken Zusammenhangskomponente hinzu:
|
||||
list starkZusammenhaengend = findeStarkeZusammenhangskomponenten()
|
||||
for-all elemente in starkZusammenhaengend:
|
||||
for i = 0; i < elemente.length; i++
|
||||
if infiltrierteKnoten.contains(elemente[i]):
|
||||
zaehler++
|
||||
end if
|
||||
if zaehler == 0:
|
||||
infiltriere(elemente[0])
|
||||
infiltrierteKnoten.add(elemente[0])
|
||||
end if
|
||||
end for
|
||||
end for-all
|
||||
eliminiere(infiltrierteKnoten)
|
||||
}
|
||||
\end{verbatim}
|
||||
\subsection{} %b
|
||||
Wenn alle Senken infiltriert werden, werden dadurch alle Module eliminiert, da alle Module direkt oder indirekt mit mindestens einer Senke verbunden sind.
|
||||
\subsection{} %c
|
||||
Es müssen alle Senken infiltriert werden, da ansonsten einzelne Module nicht eliminiert werden könnten.
|
||||
|
||||
\section*{Zusatzaufgabe} %Zusatz
|
||||
|
||||
Beweis der Terminierung für beliebige natürliche Zahlen größer $0$.\\
|
||||
Trivialer Fall: \\
|
||||
Der Algorithmus terminiert für $n=1$. \\
|
||||
Zweiter Fall: \\
|
||||
Der Algorithmus terminiert für $2^{c} = n$. Dies gilt, da damit nach $c$ Rekursionsschritten immer $n=1$ gilt. \\
|
||||
Dritter Fall: \\
|
||||
Es ist zu zeigen, dass nach endlich vielen Rekursionsschritten \textsc{Coll} mit einer 2er-Potenz aufgerufen wird.
|
||||
|
||||
Dazu lohnt es sich die verbleibenden Zahlen bis 10 anzuschauen.
|
||||
\begin{alignat*}{2}
|
||||
3 \rightarrow 10 \rightarrow 5 \rightarrow 16 \\
|
||||
5 \rightarrow 16 \\
|
||||
6 \rightarrow 3 \\
|
||||
7 \rightarrow 22 \rightarrow 11 \rightarrow 34 \rightarrow 17 \rightarrow 52 \rightarrow 26 \rightarrow 13 \rightarrow 40 \rightarrow 20 \rightarrow 10 \rightarrow 5 \rightarrow 16 \\
|
||||
9 \rightarrow 28 \rightarrow 14 \rightarrow 7 \\
|
||||
10 \rightarrow 5
|
||||
\end{alignat*}
|
||||
|
||||
Was kann aus dieser Reihe geschlossen werden? Alle Zahlen, die aus dem Produkt einer 2er-Potenz und einer dieser Zahlen entstehen, lassen sich auf eine 2er-Potenz zurückführen. Auf diese Weise könnte man für die ersten $d$ natürlichen Zahlen zeigen, dass sie sich alle auf eine 2er-Potenz zurückführen lassen.
|
||||
|
||||
Aufgrund dieser Annahme steigt die Wahrscheinlichkeit bei einem Rekursionsaufruf mit $3n+1$ auf ein solches Vielfaches einer bereits auf eine 2er-Potenz zurückgeführte Zahl zu stoßen.
|
||||
|
||||
Da es jedoch unendlich viele Primzahlen gibt, wenngleich sich deren Abstand zueinander immer weiter erhöht, findet man immer Zahlen, die noch nicht auf eine 2er-Potenz zurückgeführt sind. Aufgrund dieser Tatsache kann es keine allgemeingültige Aussage für alle natürlichen Zahlen geben. Allerdings kann dieser Algorithmus selbst als Antwort verstanden werden. Für eine beliebig große Zahl, die nicht ein gerades Vielfaches einer bereits zurückgeführten Zahl ist, muss daher nur der Algorithmus ausgeführt werden bis ein solches Vielfaches erreicht wurde.
|
||||
|
||||
Nach endlich vielen Schritten wird dies praktisch der Fall sein, wenngleich die Anzahl dieser Schritte dramatisch zunehmen wird. Es ist jedoch nicht möglich dafür einen theoretischen Beweis zu finden, der ebenjene Tatsache darlegen kann.
|
||||
\end{document}
|
||||
165
gdb/G62B3_Dittrich-Lindemann-Martens.tex
Normal file
165
gdb/G62B3_Dittrich-Lindemann-Martens.tex
Normal file
@ -0,0 +1,165 @@
|
||||
\documentclass[ngerman]{gdb-aufgabenblatt}
|
||||
\RequirePackage[utf8]{inputenc}
|
||||
\renewcommand{\Aufgabenblatt}{3}
|
||||
\renewcommand{\Ausgabedatum}{Mi. 13.11.2013}
|
||||
\renewcommand{\Abgabedatum}{Do. 28.11.2013}
|
||||
\renewcommand{\Gruppe}{Tim Dittrich, Sebastian Lindemann, Jim Martens}
|
||||
|
||||
% define how the sections are rendered
|
||||
\def\thesection{Aufgabe \arabic{section}:}
|
||||
\def\thesubsection{\alph{subsection})}
|
||||
\def\thesubsubsection{(\roman{subsubsection})}
|
||||
|
||||
\usetikzlibrary{positioning}
|
||||
\usetikzlibrary{shadows}
|
||||
|
||||
\begin{document}
|
||||
\section{Konzeptioneller Entwurf}
|
||||
\begin{tikzpicture}%[node distance=1.31cm, every edge/.style={link}]
|
||||
\node[entity] (biomol) {Biomolekül};
|
||||
\node[attribut] (biomolID) [below left=0.5 and 0 of biomol] {\underline{Molekül-ID}} edge (biomol);
|
||||
\node[attribut] (biomolDesc) [below right=0.5 and 0 of biomol] {Beschreibung} edge (biomol);
|
||||
\node[relationship] (relBiomolOrg) [above=of biomol] {kommt vor} edge node [above left=-0.5 and 0.2] {[1;*]} (biomol);
|
||||
\node[entity] (organism) [above=of relBiomolOrg] {Organismus} edge node [below right=-0.5 and 0.2] {[0;*]} (relBiomolOrg);
|
||||
\node[attribut] (orgID) [left=of organism] {\underline{Taxonomie-ID}} edge (organism);
|
||||
\node[attribut] (orgName) [above left=of organism] {Name} edge (organism);
|
||||
\node[attribut] (orgTrivName) [above=of organism] {Trivialname} edge (organism);
|
||||
\node[relationship] (relBiomolArt) [left=of biomol] {veröffentlicht in} edge node [above right=0 and -0.5] {[1;1]} (biomol);
|
||||
\node[entity] (article) [left=of relBiomolArt] {Artikel} edge node [above left=0 and -0.5] {[0;*]} (relBiomolArt);
|
||||
\node[attribut] (artTitel) [above left=of article] {\underline{Titel}} edge (article);
|
||||
\node[attribut] (artDatum) [left=of article] {Datum} edge (article);
|
||||
\node[relationship] (relArtWiss) [above=of article] {geschrieben von} edge node [above right=-0.5 and 0] {[1;*]} (article);
|
||||
\node[entity] (wissen) [above=of relArtWiss] {Wissenschaftler} edge node [below right=-0.5 and 0] {[0;*]} (relArtWiss);
|
||||
\node[attribut] (wissName) [left=of wissen] {\underline{Name}} edge (wissen);
|
||||
\node[multivalentattribut] (wissKontakt) [above=of wissen] {Kontaktinformationen} edge (wissen);
|
||||
\node[attribut] (wissTel) [above left=of wissKontakt] {Telefonnummer} edge (wissKontakt);
|
||||
\node[attribut] (wissEmail) [above=of wissKontakt] {E-Mailadresse} edge (wissKontakt);
|
||||
\node[erbt] (relDNABiomol) [below=of biomol] {is-a} edge (biomol);
|
||||
\node[entity] (dnamol) [below left=0.5 and 2 of relDNABiomol] {DNA-Molekül} edge (relDNABiomol);
|
||||
\node[attribut] (dnaNuk) [above left=of dnamol] {Nukleotidsequenz} edge (dnamol);
|
||||
\node[attribut] (dnaStrang) [left=of dnamol] {Strang-Orientierung} edge (dnamol);
|
||||
\node[attribut] (dnaChrom) [below left=of dnamol] {Nummer des Chromosoms} edge (dnamol);
|
||||
\node[entity] (mrnamol) [below=of relDNABiomol] {mRNA-Molekül} edge (relDNABiomol);
|
||||
\node[attribut] (mrnaNuk) [above right=of mrnamol] {Nukleotidksequenz} edge (mrnamol);
|
||||
\node[attribut] (mrnaVien) [right=of mrnamol] {Vienna-String} edge (mrnamol);
|
||||
\node[relationship] (relDNAmRNA) [below=3.0 of dnamol] {wird übersetzt} edge node [below left=-1.5 and 0] {[1;1]} (dnamol) edge node [above right=0.4 and -0.2] {[0;*]} (mrnamol);
|
||||
\node[attribut] (relStart) [above left=0.9 and 1 of relDNAmRNA] {Startposition} edge (relDNAmRNA);
|
||||
\node[attribut] (relEnde) [left=of relDNAmRNA] {Endposition} edge (relDNAmRNA);
|
||||
\node[weakrelationship] (relRNAProt) [below=of mrnamol] {wird synthetisiert} edge node [below right=-0.5 and 0] {[1;1]} (mrnamol);
|
||||
\node[weakentity] (prot) [below right=of relRNAProt] {Protein} edge node [above left=-0.5 and 0] {[0;1]} (relRNAProt);
|
||||
\node[attribut] (protAmino) [below left=0.5 and 1 of prot] {\dashuline{Aminosäuresequenz}} edge (prot);
|
||||
\node[attribut] (protGewicht) [left=of prot] {Molekulargewicht} edge (prot);
|
||||
\node[attribut] (protCATH) [below right=0.6 and -1.3 of prot] {CATH-Klassifikation} edge (prot);
|
||||
\node[relationship] (relProtDom) [right=of organism] {enthält} edge[bend left] node [above right=5 and -1] {[1;*]} (prot);
|
||||
\node[entity] (domain) [above=of relProtDom] {Domäne} edge node [below right=-0.5 and 0] {[0;*]} (relProtDom);
|
||||
\node[attribut] (domID) [above left=of domain] {\underline{Domänen-ID}} edge (domain);
|
||||
\node[attribut] (domHMM) [above=of domain] {HMM} edge (domain);
|
||||
\end{tikzpicture}
|
||||
|
||||
\section{Logischer Entwurf}
|
||||
Person(\underline{Name}, DOB, Geschlecht) \\
|
||||
Schauspieler(\dashuline{Name $\rightarrow$ Person.Name}, Markenzeichen) \\
|
||||
Regisseur(\dashuline{Name $\rightarrow$ Person.Name}, Genre)\\
|
||||
Charakter(\underline{CID}, Name, Charakterbeschreibung)\\
|
||||
Film(\underline{Titel}, \dashuline{Regisseur $\rightarrow$ Regisseur.Name}, Zusammenfassung, 1. Drehtag,
|
||||
letzter Drehtag, Genre1, Genre2, Genre3, Genre4)\\
|
||||
Rolle(\dashuline{Charakter $\rightarrow$ Charakter.CID, Schauspieler $\rightarrow$ Schauspieler.Name, Film $\rightarrow$ Film.Titel}, Drehbeginn, Drehende, Gage)
|
||||
|
||||
\section{Relationale Algebra und SQL}
|
||||
\subsection{} %a
|
||||
\subsubsection{} %i
|
||||
Nachname des Rennfahrers, der im Malaysia GP den ersten Platz belegte.
|
||||
|
||||
\begin{tabular}{c}
|
||||
Nachname \\
|
||||
\hline
|
||||
Vettel \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\subsubsection{} %ii
|
||||
Vor- und Nachname aller Rennfahrer, die in einem Rennstall angestellt sind, der weniger als 350 Budget hat.
|
||||
|
||||
\begin{tabular}{c|c}
|
||||
Vorname & Nachname \\
|
||||
\hline
|
||||
Lewis & Hamilton \\
|
||||
Jenson & Button \\
|
||||
Kimi & Räikkonen \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\subsubsection{} %iii
|
||||
Name der Rennställe, deren Fahrer im Australien GP eine Platzierung haben.
|
||||
|
||||
\begin{tabular}{c}
|
||||
Name \\
|
||||
\hline
|
||||
RedBull \\
|
||||
Ferrari \\
|
||||
McLaren \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\subsection{} %b
|
||||
\subsubsection{} %i
|
||||
\[
|
||||
\pi_{Rennstall.Name}(\sigma_{Geburt >= 1985}(Rennfahrer) \underset{RSID=Rennstall}{\bowtie} Rennstall)
|
||||
\]
|
||||
|
||||
\begin{tabular}{c}
|
||||
Name \\
|
||||
\hline
|
||||
RedBull \\
|
||||
McLaren \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\subsubsection{} %ii
|
||||
$\pi_{Vorname, Nachname, Geburt}(\pi_{RID}(\sigma_{Name='Australien GP'}(Rennort) \bowtie Platzierung) \bowtie $\\$ Rennfahrer \underset{Rennstall=RSID}{\bowtie} (\sigma_{Name='McLaren'}(Rennstall)))$
|
||||
|
||||
\begin{tabular}{c|c|c}
|
||||
Vorname & Nachname & Geburt \\
|
||||
\hline
|
||||
Lewis & Hamilton & 1985-01-07 \\
|
||||
Jenson & Button & 1980-01-19 \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\subsubsection{} %iii
|
||||
$Rennfahrer - (Rennfahrer \bowtie (\pi_{RID}(Platzierung)))$
|
||||
|
||||
\begin{tabular}{c|c|c|c|c|c}
|
||||
RID & Vorname & Nachname & Geburt & Wohnort & Rennstall \\
|
||||
\hline
|
||||
44 & Kimi & Räikkönen & 1979-10-17 & Espoo (Finnland) & 34 \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\subsubsection{} %iv
|
||||
$\pi_{Vorname, Nachname}(\sigma_{Rennstall = 31}(Rennfahrer) - (\sigma_{Nachname='Button'}(Rennfahrer)))$
|
||||
|
||||
\begin{tabular}{c|c}
|
||||
Vorname & Nachname \\
|
||||
\hline
|
||||
Lewis & Hamilton \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\subsection{} %c
|
||||
\subsubsection{} %i
|
||||
\begin{verbatim}
|
||||
SELECT fahrer.Vorname, fahrer.Nachname, fahrer.Geburt
|
||||
FROM Platzierung platz,
|
||||
Rennort ort,
|
||||
Rennfahrer fahrer
|
||||
WHERE platz.OID = ort.OID
|
||||
AND platz.RID = fahrer.RID
|
||||
AND ort.Name = 'Australien GP'
|
||||
AND fahrer.Rennstall = 31
|
||||
\end{verbatim}
|
||||
\subsubsection{} %ii
|
||||
\begin{verbatim}
|
||||
SELECT Vorname, Nachname
|
||||
FROM Rennfahrer
|
||||
WHERE Rennstall = 31
|
||||
AND Nachname <> 'Button'
|
||||
\end{verbatim}
|
||||
|
||||
\section{Algebraische Optimierung}
|
||||
\subsection{} %a
|
||||
\subsection{} %b
|
||||
\end{document}
|
||||
200
gdb/G62B4_Dittrich-Lindemann-Martens.tex
Normal file
200
gdb/G62B4_Dittrich-Lindemann-Martens.tex
Normal file
@ -0,0 +1,200 @@
|
||||
\documentclass[ngerman]{gdb-aufgabenblatt}
|
||||
\RequirePackage[utf8]{inputenc}
|
||||
\renewcommand{\Aufgabenblatt}{3}
|
||||
\renewcommand{\Ausgabedatum}{Mi. 13.11.2013}
|
||||
\renewcommand{\Abgabedatum}{Do. 28.11.2013}
|
||||
\renewcommand{\Gruppe}{Tim Dittrich, Sebastian Lindemann, Jim Martens}
|
||||
|
||||
% define how the sections are rendered
|
||||
\def\thesection{Aufgabe \arabic{section}:}
|
||||
\def\thesubsection{\alph{subsection})}
|
||||
\def\thesubsubsection{(\roman{subsubsection})}
|
||||
|
||||
\usetikzlibrary{positioning}
|
||||
\usetikzlibrary{shadows}
|
||||
|
||||
\begin{document}
|
||||
\section{Relationenalgebra}
|
||||
\subsection{} %a
|
||||
\[
|
||||
\pi_{Obst.Sorte}(Obst \underset{Obst.Entdecker=Person.PNR}{\bowtie}( \sigma_{Vorname='Horst'}(Person)))
|
||||
\]
|
||||
\subsection{} %b
|
||||
\[
|
||||
\pi_{Person.Vorname, Person.Nachname}(Person \underset{Person.PNR=Allergie.Person}{\bowtie} (\sigma_{Symptom='Halskratzen'}(Allergie)))
|
||||
\]
|
||||
\subsection{} %c
|
||||
\[
|
||||
\pi_{Obst.Sorte, Person.Nachname}((Person \underset{Obst.Entdecker=Person.PNR}{\bowtie} Obst) \underset{Allergie.Obst=Obst.ONR}{\bowtie} (\sigma_{Symptom='W"urgreiz'}(Allergie)))
|
||||
\]
|
||||
|
||||
\section{SQL - Schemadefinition}
|
||||
\subsection{} %a
|
||||
\begin{verbatim}
|
||||
CREATE TABLE Rennstall (
|
||||
RSID INT(10) NOT NULL PRIMARY KEY,
|
||||
Name VARCHAR(255) NOT NULL UNIQUE KEY,
|
||||
Teamchef VARCHAR(255) DEFAULT NULL,
|
||||
Budget INT(3) NOT NULL CHECK(Budget>=0 AND Budget <= 500)
|
||||
);
|
||||
|
||||
CREATE TABLE Rennfahrer (
|
||||
RID INT(10) NOT NULL PRIMARY KEY,
|
||||
Rennstall INT(10) NOT NULL,
|
||||
Vorname VARCHAR(255) NOT NULL,
|
||||
Nachname VARCHAR(255) NOT NULL,
|
||||
Geburt DATE NOT NULL,
|
||||
Wohnort VARCHAR(255) DEFAULT NULL,
|
||||
CONSTRAINT fk_rennstall FOREIGN KEY (Rennstall) REFERENCES Rennstall (RSID)
|
||||
);
|
||||
|
||||
CREATE TABLE Rennort (
|
||||
OID INT(10) NOT NULL PRIMARY KEY,
|
||||
Name VARCHAR(255) NOT NULL,
|
||||
Strecke VARCHAR(255) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE Platzierung (
|
||||
RID INT(10) NOT NULL,
|
||||
OID INT(10) NOT NULL,
|
||||
Platz INT(3) NOT NULL,
|
||||
CONSTRAINT pk_platzierung PRIMARY KEY (RID, OID)
|
||||
);
|
||||
\end{verbatim}
|
||||
\subsection{} %b
|
||||
Dadurch muss beim Erstellen einer Datenbankabfrage verstärkt darauf geachtet werden, dass nach jeder einzelnen Anweisung die Integrität eingehalten wird. Demnach wird eine feste Reihenfolge vorgegeben. Zyklische Verweise verhindern damit ein irgendwie geartetes Verändern auch nur eines Bestandteils, wenn durch diese Änderung irgendeine Fremdschlüsselbedingung verletzt ist.
|
||||
|
||||
Der Fremdschlüssel von Rennstall zu Rennfahrer könnte erst nach der Anlegung der Tabelle Rennfahrer erstellt werden.
|
||||
|
||||
Außerdem könnten dadurch weder Rennställe noch Rennfahrer gelöscht werden. Wenn ein Rennfahrer gelöscht werden soll und er ein Star eines Rennstalles ist, dann wird die Operation sofort abgebrochen. Umgekehrt kann kein Stall gelöscht werden, da zumindest der Star des Rennstalles selber auf den Rennstall referenziert, wodurch auch solche eine Operation abgebrochen würde.
|
||||
\subsection{} %c
|
||||
\begin{verbatim}
|
||||
INSERT INTO Rennstall
|
||||
(RSID, Name, Teamchef, Budget)
|
||||
VALUES (2, 'Red Bull', 'Christian Horner', 370),
|
||||
(5, 'Ferrari', 'Stefano Domenicali', 350),
|
||||
(31, 'McLaren', 'Martin Whitmarsh', 220),
|
||||
(34, 'Lotus F1', 'Eric Boullier', 100);
|
||||
|
||||
INSERT INTO Rennfahrer
|
||||
(RID, Rennstall, Vorname, Nachname, Geburt, Wohnort)
|
||||
VALUES (4, 2, 'Sebastian', 'Vettel', 19870703, 'Kemmental (Schweiz)'),
|
||||
(6, 5, 'Fernando', 'Alonso', 19810729, 'Lugano (Schweiz)'),
|
||||
(8, 2, 'Marc', 'Webber', 19760827, 'Aston Clinton (UK)'),
|
||||
(9, 31, 'Lewis', 'Hamilton', 19850107, 'Genf (Schweiz)'),
|
||||
(20, 31, 'Jenson', 'Button', 19800119, 'Monte Carlo (Monaco)'),
|
||||
(21, 5, 'Felipe', 'Massa', 19820425, 'São Paulo (Brasilien)'),
|
||||
(44, 34, 'Kimi', 'Räikkönen', 19791017, 'Espoo (Finnland)');
|
||||
|
||||
INSERT INTO Rennort
|
||||
(OID, Name, Strecke)
|
||||
VALUES (4, 'Australien GP', 'Albert Park Circuit'),
|
||||
(15, 'Malaysia GP', 'Sepang International Circuit'),
|
||||
(21, 'China GP', 'Shanghai International Circuit');
|
||||
|
||||
INSERT INTO Platzierung
|
||||
(RID, OID, Platz)
|
||||
VALUES (8, 4, 6),
|
||||
(4, 15, 1),
|
||||
(20, 15, 17),
|
||||
(4, 4, 3),
|
||||
(6, 4, 2),
|
||||
(8, 15, 2),
|
||||
(6, 21, 1),
|
||||
(9, 4, 5),
|
||||
(21, 15, 5),
|
||||
(20, 4, 9),
|
||||
(21, 4, 4);
|
||||
\end{verbatim}
|
||||
\subsection{} %d
|
||||
|
||||
\begin{itemize}
|
||||
\item \begin{verbatim}
|
||||
DELETE FROM Rennfahrer
|
||||
WHERE Vorname LIKE 'F%';
|
||||
\end{verbatim}
|
||||
\item \begin{verbatim}
|
||||
DROP TABLE Platzierung;
|
||||
DROP TABLE Rennort;
|
||||
DROP TABLE Rennfahrer;
|
||||
DROP TABLE Rennstall;
|
||||
\end{verbatim}
|
||||
\end{itemize}
|
||||
|
||||
\section{SQL - Anfragen}
|
||||
\subsection{} %a
|
||||
\begin{verbatim}
|
||||
SELECT DISTINCT obst.Sorte
|
||||
FROM Person pers,
|
||||
Allergie aller,
|
||||
Obst obst
|
||||
WHERE pers.PNR = aller.Person
|
||||
AND aller.Obst = obst.ONR
|
||||
AND pers.Vorname = 'Peter'
|
||||
AND pers.Nachname = 'Meyer'
|
||||
ORDER BY obst.Sorte DESC;
|
||||
\end{verbatim}
|
||||
\subsection{} %b
|
||||
\begin{verbatim}
|
||||
SELECT pers.PNR, pers.Nachname, COUNT(aller.Obst)
|
||||
FROM Person pers,
|
||||
Allergie aller
|
||||
WHERE pers.PNR = aller.Person
|
||||
GROUP BY pers.PNR;
|
||||
\end{verbatim}
|
||||
\subsection{} %c
|
||||
\begin{verbatim}
|
||||
SELECT pers.PNR
|
||||
FROM Person pers,
|
||||
Obst obst
|
||||
WHERE pers.PNR = obst.Entdecker
|
||||
GROUP BY pers.PNR
|
||||
HAVING COUNT(obst.ONR) > 6;
|
||||
\end{verbatim}
|
||||
\subsection{} %d
|
||||
\begin{verbatim}
|
||||
SELECT pers.Vorname, pers.Nachname
|
||||
FROM Person pers,
|
||||
Person entdecker,
|
||||
Obst obst
|
||||
WHERE entdecker.PNR = obst.Entdecker
|
||||
AND pers.Lieblingsobst = obst.ONR
|
||||
AND entdecker.Vorname = pers.Vorname;
|
||||
\end{verbatim}
|
||||
\subsection{} %e
|
||||
\begin{verbatim}
|
||||
SELECT pers.PNR, pers.Vorname, pers.Nachname
|
||||
FROM Person pers
|
||||
WHERE pers.PNR NOT IN (SELECT obst.Entdecker
|
||||
FROM Obst obst);
|
||||
\end{verbatim}
|
||||
|
||||
\section{Optimierung}
|
||||
anfänglicher Operatorbaum:\\
|
||||
\begin{tikzpicture}[shorten >=1pt,node distance=1.1cm,on grid]
|
||||
\node (proj) {$\pi_{Person.PNR, Person.Vorname, Person.Nachname}$};
|
||||
\node (sel) [below=2.0 of proj] {$\sigma_{Obst.Sorte\text{ LIKE 'K\%'}}$};
|
||||
\node (join) [below=2.0 of sel] {$\underset{Person.Lieblingsobst = Obst.ONR}{\bowtie}$};
|
||||
\node (person) [below left=2.0 and 2.0 of join] {Person};
|
||||
\node (obst) [below right=2.0 and 2.0 of join] {Obst};
|
||||
\path (proj) edge node [right] {400} (sel)
|
||||
(sel) edge node [right] {2000} (join)
|
||||
(join) edge node [left] {2000} (person)
|
||||
(join) edge node [right] {25} (obst);
|
||||
\end{tikzpicture}
|
||||
|
||||
optimierter Operatorbaum:\\
|
||||
\begin{tikzpicture}[shorten >=1pt,node distance=1.1cm,on grid]
|
||||
\node (proj) {$\pi_{Person.PNR, Person.Vorname, Person.Nachname}$};
|
||||
\node (join) [below=2.0 of proj] {$\underset{Person.Lieblingsobst = Obst.ONR}{\bowtie}$};
|
||||
\node (person) [below left=2.0 and 2.0 of join] {Person};
|
||||
\node (sel) [below right=2.0 and 2.0 of join] {$\sigma_{Obst.Sorte\text{ LIKE 'K\%'}}$};
|
||||
\node (obst) [below=of sel] {Obst};
|
||||
\path (proj) edge node [right] {400} (join)
|
||||
(join) edge node [left] {2000} (person)
|
||||
(join) edge node [right] {5} (sel)
|
||||
(sel) edge node [right] {25} (obst);
|
||||
\end{tikzpicture}
|
||||
|
||||
Der zweite Operatorbaum ist klar performanter, da die Selektion der Obstsorte bereits vor dem Join stattfindet.
|
||||
\end{document}
|
||||
@ -14,11 +14,17 @@
|
||||
%
|
||||
% v1.0:
|
||||
% 2009-11-09 KH: Erste Version der Makro-Sammlung
|
||||
\usepackage{ulsy}
|
||||
|
||||
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{vsis-gdb}[2009/11/27 v1.2 Nuetzliche Makros fuer GDB]
|
||||
|
||||
|
||||
\RequirePackage{ulsy}
|
||||
\RequirePackage{setspace}
|
||||
\RequirePackage[fleqn]{amsmath}
|
||||
|
||||
\RequirePackage{latexsym} % F<>r Befehle wie \Join
|
||||
% Gestricheltes Unterstreichen, z.B. f<>r Relationales Datenbankmodell (Fremdschl<68>ssel)
|
||||
\RequirePackage[normalem]{ulem}
|
||||
\def\dashuline{\bgroup
|
||||
@ -29,6 +35,8 @@
|
||||
\kern.1em}\ULon}
|
||||
\def\soliduline{\bgroup \markoverwith{\hbox
|
||||
{\vtop{\kern.3ex\hrule width.2em}}}\ULon}
|
||||
% Umgebung f<>r relationale Datenbankschemata
|
||||
\newenvironment{RMSchma}{\begin{raggedright}\it\doublespacing}{\end{raggedright}}
|
||||
|
||||
% Operatoren der relationalen Algebra
|
||||
\newcommand*{\projektion}[1]{\pi_{#1}}
|
||||
@ -99,9 +107,8 @@
|
||||
font=\footnotesize,
|
||||
},
|
||||
erbt/.style={
|
||||
draw,
|
||||
>=open triangle 45,
|
||||
->,
|
||||
regular polygon, regular polygon sides=6,
|
||||
draw, black, very thick, minimum size=3em
|
||||
},
|
||||
% Layout fuer referenzgraphen
|
||||
refGraph/.style={
|
||||
@ -127,13 +134,3 @@
|
||||
align=right,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
\RequirePackage[utf8]{inputenc}
|
||||
|
||||
\RequirePackage{vsis-gdb} % Nuetzliche Makros fuer GDB
|
||||
\RequirePackage{booktabs} % Linien f<>r Tabellen
|
||||
|
||||
296
mk/VortragElektronischeDemokratie.tex
Normal file
296
mk/VortragElektronischeDemokratie.tex
Normal file
@ -0,0 +1,296 @@
|
||||
\documentclass[14pt]{beamer}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Meta informations:
|
||||
\newcommand{\trauthor}{Jim Martens}
|
||||
\newcommand{\trtype}{} %{Proseminar} %{Seminar} %{Workshop}
|
||||
\newcommand{\trcourse}{Einführung in das wissenschaftliche Arbeiten}
|
||||
\newcommand{\trtitle}{Elektronische Demokratie}
|
||||
\newcommand{\trmatrikelnummer}{}
|
||||
\newcommand{\tremail}{2martens@informatik.uni-hamburg.de}
|
||||
\newcommand{\trinstitute}{Fachbereich Informatik}
|
||||
\newcommand{\trwebsiteordate}{}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Languages:
|
||||
|
||||
% Falls die Ausarbeitung in Deutsch erfolgt:
|
||||
\usepackage[ngerman]{babel}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage[utf8]{inputenc}
|
||||
% \usepackage[latin9]{inputenc}
|
||||
\selectlanguage{ngerman}
|
||||
|
||||
% If the thesis is written in English:
|
||||
%\usepackage[english]{babel}
|
||||
%\selectlanguage{english}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Bind packages:
|
||||
\usepackage{beamerthemesplit}
|
||||
\usetheme{Boadilla}
|
||||
%\usetheme{Copenhagen}
|
||||
%\usetheme{Darmstadt}
|
||||
%\usetheme{Frankfurt}
|
||||
%\usetheme{Ilmenau}
|
||||
%\usetheme{JuanLesPins}
|
||||
%\usetheme{Madrid}
|
||||
%\usetheme{Warsaw }
|
||||
%\usecolortheme{dolphin}
|
||||
%\setbeamertemplate{sections/subsections in toc}[sections numbered]
|
||||
%\beamertemplatenavigationsymbolsempty
|
||||
%\setbeamertemplate{headline}[default] % deaktiviert die Kopfzeile
|
||||
\setbeamertemplate{navigation symbols}{}% deaktiviert Navigationssymbole
|
||||
%\useinnertheme{rounded}
|
||||
|
||||
\usepackage{acronym} % Acronyms
|
||||
\usepackage{algorithmic} % Algorithms and Pseudocode
|
||||
\usepackage{algorithm} % Algorithms and Pseudocode
|
||||
\usepackage{amsfonts} % AMS Math Packet (Fonts)
|
||||
\usepackage{amsmath} % AMS Math Packet
|
||||
\usepackage{amssymb} % Additional mathematical symbols
|
||||
\usepackage{amsthm}
|
||||
\usepackage{color} % Enables defining of colors via \definecolor
|
||||
\usepackage{fancybox} % Gleichungen einrahmen
|
||||
\usepackage{fancyhdr} % Paket zur schickeren der Gestaltung der
|
||||
\usepackage{graphicx} % Inclusion of graphics
|
||||
%\usepackage{latexsym} % Special symbols
|
||||
\usepackage{longtable} % Allow tables over several parges
|
||||
\usepackage{listings} % Nicer source code listings
|
||||
\usepackage{lmodern}
|
||||
\usepackage{multicol} % Content of a table over several columns
|
||||
\usepackage{multirow} % Content of a table over several rows
|
||||
\usepackage{rotating} % Alows to rotate text and objects
|
||||
\usepackage[section]{placeins} % Ermoeglich \Floatbarrier fuer Gleitobj.
|
||||
\usepackage[hang]{subfigure} % Allows to use multiple (partial) figures in a fig
|
||||
%\usepackage[font=footnotesize,labelfont=rm]{subfig} % Pictures in a floating environment
|
||||
\usepackage{tabularx} % Tables with fixed width but variable rows
|
||||
\usepackage{url,xspace,boxedminipage} % Accurate display of URLs
|
||||
|
||||
\definecolor{uhhRed}{RGB}{254,0,0} % Official Uni Hamburg Red
|
||||
\definecolor{uhhGrey}{RGB}{136,136,136} % Official Uni Hamburg Grey
|
||||
\definecolor{uhhLightGrey}{RGB}{180,180,180} % Official Uni Hamburg LightGrey
|
||||
\definecolor{uhhLightLightGrey}{RGB}{220,220,220} % Official Uni Hamburg LightLightGrey
|
||||
\setbeamertemplate{itemize items}[ball]
|
||||
\setbeamercolor{title}{fg=uhhRed,bg=white}
|
||||
\setbeamercolor{title in head/foot}{bg=uhhRed}
|
||||
\setbeamercolor{block title}{bg=uhhGrey,fg=white}
|
||||
\setbeamercolor{block body}{bg=uhhLightLightGrey,fg=black}
|
||||
\setbeamercolor{section in head/foot}{bg=black}
|
||||
\setbeamercolor{frametitle}{bg=white,fg=uhhRed}
|
||||
\setbeamercolor{author in head/foot}{bg=black,fg=white}
|
||||
\setbeamercolor{author in footline}{bg=white,fg=black}
|
||||
\setbeamercolor*{item}{fg=uhhRed}
|
||||
\setbeamercolor*{section in toc}{fg=black}
|
||||
\setbeamercolor*{separation line}{bg=black}
|
||||
\setbeamerfont*{author in footline}{size=\scriptsize,series=\mdseries}
|
||||
\setbeamerfont*{institute}{size=\footnotesize}
|
||||
|
||||
\newcommand{\opticalseperator}{0.0025\paperwidth}
|
||||
|
||||
\institute{Universit\"at Hamburg\\\trinstitute}
|
||||
\title{\trtitle}
|
||||
\subtitle{\trtype}
|
||||
\author{\trauthor}
|
||||
\date{}
|
||||
\logo{}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Configurationen:
|
||||
%\hypersetup{pdfpagemode=FullScreen}
|
||||
|
||||
\hyphenation{whe-ther} % Manually use: "\-" in a word: Staats\-ver\-trag
|
||||
|
||||
%\lstloadlanguages{C} % Set the default language for listings
|
||||
\DeclareGraphicsExtensions{.pdf,.svg,.jpg,.png,.eps} % first try pdf, then eps, png and jpg
|
||||
\graphicspath{{./src/}} % Path to a folder where all pictures are located
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Custom Definitions:
|
||||
\setbeamertemplate{title page}
|
||||
{
|
||||
\vbox{}
|
||||
\vspace{0.4cm}
|
||||
\begin{centering}
|
||||
\begin{beamercolorbox}[sep=8pt,center,colsep=-4bp]{title}
|
||||
\usebeamerfont{title}\inserttitle\par%
|
||||
\ifx\insertsubtitle\@empty%
|
||||
\else%
|
||||
\vskip0.20em%
|
||||
{\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
|
||||
\fi%
|
||||
\end{beamercolorbox}%
|
||||
\vskip0.4em
|
||||
\begin{beamercolorbox}[sep=8pt,center,colsep=-4bp,rounded=true,shadow=true]{author}
|
||||
\usebeamerfont{author}\insertauthor \\ \insertinstitute
|
||||
\end{beamercolorbox}
|
||||
|
||||
\vfill
|
||||
%\begin{beamercolorbox}[ht=8ex,center]{}
|
||||
% \includegraphics[width=0.20\paperwidth]{wtmIcon.pdf}
|
||||
% \end{beamercolorbox}%
|
||||
\begin{beamercolorbox}[sep=8pt,center,colsep=-4bp,rounded=true,shadow=true]{institute}
|
||||
\usebeamerfont{institute}%\trwebsiteordate
|
||||
\end{beamercolorbox}
|
||||
\vspace{-0.1cm}
|
||||
\end{centering}
|
||||
}
|
||||
|
||||
\setbeamertemplate{frametitle}
|
||||
{
|
||||
\begin{beamercolorbox}[wd=\paperwidth,ht=3.8ex,dp=1.2ex,leftskip=0pt,rightskip=4.0ex]{frametitle}%
|
||||
\usebeamerfont*{frametitle}\centerline{\insertframetitle}
|
||||
\end{beamercolorbox}
|
||||
\vspace{0.0cm}
|
||||
}
|
||||
|
||||
\setbeamertemplate{footline}
|
||||
{
|
||||
\leavevmode
|
||||
\vspace{-0.05cm}
|
||||
\hbox{
|
||||
\begin{beamercolorbox}[wd=.32\paperwidth,ht=4.8ex,dp=2.7ex,center]{author in footline}
|
||||
\hspace*{2ex}\usebeamerfont*{author in footline}\trauthor
|
||||
\end{beamercolorbox}%
|
||||
\begin{beamercolorbox}[wd=.60\paperwidth,ht=4.8ex,dp=2.7ex,center]{author in footline}
|
||||
\usebeamerfont*{author in footline}\trtitle
|
||||
\end{beamercolorbox}%
|
||||
\begin{beamercolorbox}[wd=.07\paperwidth,ht=4.8ex,dp=2.7ex,center]{author in footline}
|
||||
\usebeamerfont*{author in footline}\insertframenumber{}
|
||||
\end{beamercolorbox}
|
||||
}
|
||||
\vspace{0.15cm}
|
||||
}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Additional 'theorem' and 'definition' blocks:
|
||||
\newtheorem{axiom}{Axiom}[section]
|
||||
%\newtheorem{axiom}{Fakt}[section] % Wenn in Deutsch geschrieben wird.
|
||||
%Usage:%\begin{axiom}[optional description]%Main part%\end{fakt}
|
||||
|
||||
%Additional types of axioms:
|
||||
\newtheorem{observation}[axiom]{Observation}
|
||||
|
||||
%Additional types of definitions:
|
||||
\theoremstyle{remark}
|
||||
%\newtheorem{remark}[section]{Bemerkung} % Wenn in Deutsch geschrieben wird.
|
||||
\newtheorem{remark}[section]{Remark}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Provides TODOs within the margin:
|
||||
\newcommand{\TODO}[1]{\marginpar{\emph{\small{{\bf TODO: } #1}}}}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Abbreviations and mathematical symbols
|
||||
\newcommand{\modd}{\text{ mod }}
|
||||
\newcommand{\RS}{\mathbb{R}}
|
||||
\newcommand{\NS}{\mathbb{N}}
|
||||
\newcommand{\ZS}{\mathbb{Z}}
|
||||
\newcommand{\dnormal}{\mathit{N}}
|
||||
\newcommand{\duniform}{\mathit{U}}
|
||||
|
||||
\newcommand{\erdos}{Erd\H{o}s}
|
||||
\newcommand{\renyi}{-R\'{e}nyi}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Display of TOCs:
|
||||
\AtBeginSection[]
|
||||
{
|
||||
\setcounter{tocdepth}{2}
|
||||
\frame
|
||||
{
|
||||
\frametitle{Outline}
|
||||
\tableofcontents[currentsection]
|
||||
}
|
||||
}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Document:
|
||||
\begin{document}
|
||||
\renewcommand{\arraystretch}{1.2}
|
||||
|
||||
\begin{frame}[plain] % plain => kein Rahmen
|
||||
\titlepage
|
||||
\end{frame}
|
||||
%\setcounter{framenumber}{0}
|
||||
|
||||
\frame{
|
||||
\frametitle{Outline}
|
||||
\tableofcontents
|
||||
}
|
||||
|
||||
%%%%%%%%%%%%%%
|
||||
% Your Content
|
||||
|
||||
\section{Herleitung}
|
||||
|
||||
\frame[t]{
|
||||
\frametitle{Beispiele}
|
||||
\only<1-5>{
|
||||
\begin{itemize}
|
||||
\item<1-5> Terminfindung per Dudle
|
||||
\item<2-5> Petitionen
|
||||
\item<3-5> Crowdfunding - Abstimmen mit Geld
|
||||
\begin{itemize}
|
||||
\item<4-5> Star Citizen
|
||||
\item<5> Oculus Rift
|
||||
\end{itemize}
|
||||
\end{itemize}
|
||||
}
|
||||
}
|
||||
|
||||
\section{3-Phasen Modell}
|
||||
|
||||
\frame[t]{
|
||||
\frametitle{3-Phasen Modell}
|
||||
\begin{itemize}
|
||||
\item<1-> Single-point-of-entry
|
||||
\item<2-> E-Government
|
||||
\item<3> eins-zu-eins Beziehung zwischen Staat und Bürger
|
||||
\end{itemize}
|
||||
}
|
||||
|
||||
\section{Kritische Diskussion}
|
||||
|
||||
\frame[t]{
|
||||
\only<1-2>{
|
||||
\frametitle{Vorteile}
|
||||
\begin{itemize}
|
||||
\item<1-> Erleichterung der Informationsbeschaffung
|
||||
\item<2> Vereinfachung der Interaktion
|
||||
\item<2> gesteigerte Effizienz
|
||||
\item<2> erhöhte Transparenz
|
||||
\end{itemize}
|
||||
}
|
||||
\only<3->{
|
||||
\frametitle{Nachteile}
|
||||
\begin{itemize}
|
||||
\item<4-> Arbeitsplatzverlust
|
||||
\item<5-> Einschnitt in Privatsphäre
|
||||
\item<6-> erhöhtes Risiko des Identitätsdiebstahls
|
||||
\item<6-> Gefahr von politischer Verfolgung
|
||||
\end{itemize}
|
||||
}
|
||||
}
|
||||
|
||||
\section{Auswertung}
|
||||
|
||||
\frame[t]{
|
||||
\frametitle{Auswertung}
|
||||
|
||||
\begin{itemize}
|
||||
\item<1-> Übertragung aufs Internet nötig
|
||||
\item<2> unter Beachtung integraler Prinzipien
|
||||
\end{itemize}
|
||||
}
|
||||
|
||||
%%%%%%%%%%%%%%
|
||||
|
||||
\frame[c]{
|
||||
\frametitle{Ende}
|
||||
\begin{center}
|
||||
Danke für Eure Aufmerksamkeit.\\[1ex]
|
||||
Fragen?\\[5ex]
|
||||
\end{center}
|
||||
}
|
||||
|
||||
\end{document}
|
||||
12
mk/feedback.txt
Normal file
12
mk/feedback.txt
Normal file
@ -0,0 +1,12 @@
|
||||
Feedback zu Vortrag Elektronische Demokratie
|
||||
|
||||
* roter Faden war nicht zu erkennen
|
||||
* Gesamtüberblick über Elektronische Demokratie
|
||||
* auf einen einzelnen Aspekt konzentrieren
|
||||
* aktuellere Quellen benutzen (z.B. Piratenpartei, etc.)
|
||||
* mehr Quellen
|
||||
* Vergleich basierend auf mehreren Quellen
|
||||
* Definition der Begriffe
|
||||
* miteinbeziehen des Publikums bei einem so populären Thema
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
\newcommand{\trmatrikelnummer}{6420323}
|
||||
\newcommand{\tremail}{2martens@informatik.uni-hamburg.de}
|
||||
\newcommand{\trarbeitsbereich}{}
|
||||
\newcommand{\trdate}{10.02.2014}
|
||||
\newcommand{\trdate}{06.11.2013}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Languages:
|
||||
@ -151,8 +151,8 @@
|
||||
\Large\trcourse\\
|
||||
[1.5cm]
|
||||
\Large \trauthor\\
|
||||
[0.2cm]
|
||||
\normalsize Matr.Nr. \trmatrikelnummer\\
|
||||
% [0.2cm]
|
||||
% \normalsize Matr.Nr. \trmatrikelnummer\\
|
||||
[0.2cm]
|
||||
\normalsize\tremail\\
|
||||
[1.5cm]
|
||||
@ -171,7 +171,7 @@
|
||||
|
||||
% Abstract gives a brief summary of the main points of a paper:
|
||||
\section*{Abstract}
|
||||
Demokratie ist eine wichtige Errungenschaft der Menschheit. In diesem Paper wird die Erweiterung von Demokratie auf das Internet kritisch diskutiert, um anschließend zu einem Fazit zu gelangen.
|
||||
Demokratie ist eine wichtige Errungenschaft der Menschheit. Das Internet ist das technologische Gegenstück, das wohl einen ähnlichen tiefgreifenden Einfluss in die Gesellschaft genommen hat. Elektronische Demokratie befasst sich mit der Frage die Demokratie auf das Internet auszudehnen. Dieses Vorhaben hat naturgemäß Vor- und Nachteile, mit denen sich in diesem Paper befasst wird.
|
||||
|
||||
% Lists:
|
||||
\setcounter{tocdepth}{2} % depth of the table of contents (for Seminars 2 is recommended)
|
||||
@ -212,7 +212,7 @@
|
||||
\section{Kritische Diskussion}
|
||||
\label{sec:critDisc}
|
||||
|
||||
Die von Watson\cite{Watson2001} erläuterte strategische Perspektive klingt auf den ersten Blick sehr verlockend. Allerdings hat auch diese Idee ihre negativen Auswirkungen. In der folgenden Diskussion werden die Vor- und Nachteile von Watsons Idee gegenübergestellt. Die Pro-Argumente werden dabei aus Watsons Idee übernommen, schließlich stellt er diese Perspektive nicht vor weil sie in seinen Augen unzureichend ist, wohingegen die Contra-Argumente aus der Perspektive des Autoren dieses Papers dargelegt werden. Daraus kann jedoch nicht die Position des Autoren zu dieser Idee gefolgert werden.
|
||||
Die von Watson\cite{Watson2001} erläuterte strategische Perspektive klingt auf den ersten Blick sehr verlockend. Allerdings hat auch diese Idee ihre negativen Auswirkungen. In der folgenden Diskussion werden die Vor- und Nachteile von Watsons Idee gegenübergestellt. Die Pro-Argumente werden dabei aus Watsons Idee übernommen, schließlich stellt er diese Perspektive nicht vor weil sie in seinen Augen unzureichend ist, wohingegen die Contra-Argumente aus meiner Perspektive dargelegt werden. Daraus kann jedoch nicht meine Position zu dieser Idee gefolgert werden.
|
||||
|
||||
Der erste Schritt Watsons ist die Schaffung eines zentralen Portals, von wo aus die Bürger je nach Postleitzahl zu allen relevanten Stellen verlinkt werden.
|
||||
|
||||
@ -267,7 +267,7 @@
|
||||
% Insbesondere stehen die eigentlichen Informationen in der Datei
|
||||
% ``bib.bib''
|
||||
%
|
||||
\clearpage
|
||||
%\clearpage
|
||||
\bibliography{bib}
|
||||
\bibliographystyle{ieeetr}
|
||||
\addcontentsline{toc}{section}{Literatur}% Add to the TOC
|
||||
|
||||
212
optimierung/Uebungsblatt7.tex
Normal file
212
optimierung/Uebungsblatt7.tex
Normal file
@ -0,0 +1,212 @@
|
||||
\documentclass[10pt,a4paper,oneside,ngerman,numbers=noenddot]{scrartcl}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage[ngerman]{babel}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{amsfonts}
|
||||
\usepackage{amssymb}
|
||||
\usepackage{paralist}
|
||||
\usepackage{gauss}
|
||||
\usepackage{pgfplots}
|
||||
\usepackage[locale=DE,exponent-product=\cdot,detect-all]{siunitx}
|
||||
\usepackage{tikz}
|
||||
\usetikzlibrary{matrix,fadings,calc,positioning,decorations.pathreplacing,arrows,decorations.markings}
|
||||
\usepackage{polynom}
|
||||
\polyset{style=C, div=:,vars=x}
|
||||
\pgfplotsset{compat=1.8}
|
||||
\pagenumbering{arabic}
|
||||
% ensures that paragraphs are separated by empty lines
|
||||
\parskip 12pt plus 1pt minus 1pt
|
||||
\parindent 0pt
|
||||
% define how the sections are rendered
|
||||
\def\thesection{\arabic{section})}
|
||||
\def\thesubsection{\alph{subsection})}
|
||||
\def\thesubsubsection{(\roman{subsubsection})}
|
||||
% some matrix magic
|
||||
\makeatletter
|
||||
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
|
||||
\hskip -\arraycolsep
|
||||
\let\@ifnextchar\new@ifnextchar
|
||||
\array{#1}}
|
||||
\makeatother
|
||||
|
||||
\begin{document}
|
||||
\author{Jan Branitz (6326955), Jim Martens (6420323),\\
|
||||
Stephan Niendorf (6242417)}
|
||||
\title{Hausaufgaben zum 2. Dezember}
|
||||
\maketitle
|
||||
\section{} %1
|
||||
\subsection{} %a
|
||||
LP-Problem (P):
|
||||
|
||||
\begin{alignat*}{4}
|
||||
\text{maximiere}\; & 3x_{1} \,&+&\, x_{2} \,&+&\, 2x_{3} && \\
|
||||
\multicolumn{8}{l}{\text{unter den Nebenbedingungen}} && \\
|
||||
\;& x_{1} \,&+&\, x_{2} \,&+&\, 3x_{3} \,&\leq & 30 \\
|
||||
\;& 2x_{1} \,&+&\, 2x_{2} \,&+&\, 5x_{3} \,&\leq & 24 \\
|
||||
\;& 4x_{1} \,&+&\, x_{2} \,&+&\, 2x_{3} \,&\leq & 36 \\
|
||||
\multicolumn{6}{r}{$x_{1}, x_{2}, x_{3}$} \,&\geq &\, 0
|
||||
\end{alignat*}
|
||||
Duales Problem (D):
|
||||
\begin{alignat*}{4}
|
||||
\text{minimiere}\; & 30y_{1} \,&+&\, 24y_{2} \,&+&\, 36y_{3} && \\
|
||||
\multicolumn{8}{l}{\text{unter den Nebenbedingungen}} && \\
|
||||
\;& y_{1} \,&+&\, 2y_{2} \,&+&\, 4y_{3} \,&\geq & 3 \\
|
||||
\;& y_{1} \,&+&\, 2y_{2} \,&+&\, y_{3} \,&\geq & 1 \\
|
||||
\;& 3y_{1} \,&+&\, 5y_{2} \,&+&\, 2y_{3} \,&\geq & 2 \\
|
||||
\multicolumn{6}{r}{$y_{1}, y_{2}, y_{3}$} \,&\geq &\, 0
|
||||
\end{alignat*}
|
||||
|
||||
Durch Einsetzen von $x_{1}^{*}, x_{2}^{*}, x_{3}^{*}$ in die erste Ungleichung von P ergibt sich:
|
||||
\begin{alignat*}{2}
|
||||
1 \cdot \frac{33}{4} + 1 \cdot 0 + 3 \cdot \frac{3}{2} &\leq & 30 \\
|
||||
\frac{33}{4} + \frac{18}{4} &\leq & 30 \\
|
||||
\frac{51}{4} &\leq & \frac{120}{4}
|
||||
\end{alignat*}
|
||||
Die erste Ungleichung ist nicht mit Gleichheit erfüllt, somit muss $y_{1}^{*} = 0$ gelten.
|
||||
|
||||
Einsetzen in die zweite Ungleichung ergibt:
|
||||
\begin{alignat*}{2}
|
||||
2 \cdot \frac{33}{4} + 2 \cdot 0 + 5 \cdot \frac{3}{2} &\leq & 24 \\
|
||||
\frac{33}{2} + \frac{15}{2} &\leq & 24 \\
|
||||
\frac{48}{2} &\leq & \frac{48}{2}
|
||||
\end{alignat*}
|
||||
Die zweite Ungleichung ist mit Gleichheit erfüllt, woraus sich keine Schlüsse ziehen lassen.
|
||||
|
||||
Einsetzen in die dritte Ungleichung ergibt:
|
||||
\begin{alignat*}{2}
|
||||
4 \cdot \frac{33}{4} + 1 \cdot 0 + 2 \cdot \frac{3}{2} &\leq & 36 \\
|
||||
33 + 3 &\leq & 36 \\
|
||||
36 &\leq & 36
|
||||
\end{alignat*}
|
||||
Auch die dritte Ungleichung ist mit Gleichheit erfüllt. Da $x_{1}^{*}$ und $x_{3}^{*}$ größer als $0$ sind, müssen die erste und dritte Ungleichung von D mit Gleichheit erfüllt sein.
|
||||
|
||||
Unter Berücksichtigung von $y_{1}^{*} = 0$ ergibt sich daraus:
|
||||
\begin{alignat*}{2}
|
||||
I \;& 2y_{2} + 4y_{3} &=& 3 \\
|
||||
II \;& 2y_{2} + y_{3} &=& 1 \\
|
||||
I - II \;& 3y_{3} &=& 2 \\
|
||||
& y_{3} &=& \frac{2}{3} \\
|
||||
\intertext{Einsetzen von $y_{3}$ in $II$}
|
||||
II \;& 2y_{2} + \frac{2}{3} &=& 1 \\
|
||||
& 2y_{2} &=& \frac{1}{3} \\
|
||||
& y_{2} &=& \frac{1}{6}
|
||||
\end{alignat*}
|
||||
Demnach sind $y_{1}^{*} = 0, y_{2}^{*} = \frac{1}{6}, y_{3}^{*} = \frac{2}{3}$ eindeutig bestimmte Zahlen, die zusammen mit den x-Werten die komplementären Schlupfbedingungen erfüllen. Auffallend ist, dass dies die gleichen Werte sind, die bereits im ersten Beispiel auf Skript Seite 63 herauskamen. Da dort bereits überprüft wurde, ob die Zahlen eine zulässige Lösung von D sind und dies bestätigt wurde, kann diese Überprüfung hier ausgelassen werden.
|
||||
|
||||
Demnach ist $x_{1}^{*} = \frac{33}{4}, x_{2}^{*} = 0, x_{3}^{*} = \frac{3}{2}$ ebenso eine optimale Lösung für das LP-Problem.
|
||||
\subsection{} %b
|
||||
Zum Überprüfen der vorgeschlagenen Lösung werden die Werte zunächst in die Ungleichungen des LP-Problems eingesetzt.
|
||||
|
||||
Erste Ungleichung:
|
||||
\begin{alignat*}{2}
|
||||
5 + 2 &\leq & 7 \\
|
||||
7 &\leq & 7
|
||||
\end{alignat*}
|
||||
|
||||
Zweite Ungleichung:
|
||||
\begin{alignat*}{2}
|
||||
2 + 6 &\leq & 8 \\
|
||||
8 &\leq & 8
|
||||
\end{alignat*}
|
||||
|
||||
Dritte Ungleichung:
|
||||
\begin{alignat*}{2}
|
||||
2 \cdot 5 + 2 &\leq & 12 \\
|
||||
12 &\leq & 12
|
||||
\end{alignat*}
|
||||
|
||||
Da alle der Ungleichungen mit Gleichheit erfüllt sind, können keine Rückschlüsse auf y-Werte gezogen werden. Da alle x-Werte größer als 0 sind, müssen alle drei Ungleichungen von D mit Gleichheit erfüllt sein.
|
||||
|
||||
Das duale Problem:
|
||||
\begin{alignat*}{4}
|
||||
\text{minimiere}\; & 7y_{1} \,&+&\, 8y_{2} \,&+&\, 12y_{3} && \\
|
||||
\multicolumn{8}{l}{\text{unter den Nebenbedingungen}} && \\
|
||||
\;& y_{1} \,&& &+&\, 2y_{3} \,&\geq & 2 \\
|
||||
\;& y_{1} \,&+&\, y_{2} \,&+&\, y_{3} \,&\geq & 3 \\
|
||||
\;& &&\, y_{2} && &\geq & 2 \\
|
||||
\multicolumn{6}{r}{$y_{1}, y_{2}, y_{3}$} \,&\geq &\, 0
|
||||
\end{alignat*}
|
||||
|
||||
Aus der dritten Ungleichung lässt sich ablesen, dass $y_{2}^{*} = 2$ gilt. Es ergibt sich das folgende LGS:
|
||||
\begin{alignat*}{2}
|
||||
I \;& y_{1} + 2y_{3} &=& 2 \\
|
||||
II \;& y_{1} + 2 + y_{3} &=& 3 \\
|
||||
\;& y_{1} + y_{3} &=& 1 \\
|
||||
I - II \;& y_{3} &=& 1 \\
|
||||
\intertext{Einsetzen von $y_{3}$ in $I$}
|
||||
I \;& y_{1} + 2 \cdot 1 &=& 2 \\
|
||||
\;& y_{1} &=& 0
|
||||
\end{alignat*}
|
||||
|
||||
Es ergeben sich somit die eindeutig bestimmten Zahlen $y_{1}^{*} = 0, y_{2}^{*} = 2, y_{3}^{*} = 1$. Diese Zahlen erfüllen zusammen mit der vorgeschlagenen Lösung die komplementären Schlupfbedingungen.
|
||||
Schließlich muss noch geprüft werden, ob diese Zahlen auch eine zulässige Lösung des dualen Problems sind. Dafür werden diese eingesetzt:
|
||||
|
||||
Erste Ungleichung:
|
||||
\begin{alignat*}{2}
|
||||
2 \cdot 1 &\geq & 2 \\
|
||||
2 &\geq & 2
|
||||
\end{alignat*}
|
||||
|
||||
Zweite Ungleichung:
|
||||
\begin{alignat*}{2}
|
||||
2 + 1 &\geq & 3 \\
|
||||
3 &\geq & 3
|
||||
\end{alignat*}
|
||||
|
||||
Dritte Ungleichung:
|
||||
\begin{alignat*}{2}
|
||||
2 &\geq & 2
|
||||
\end{alignat*}
|
||||
|
||||
Da alle drei Ungleichungen mit den herausgefundenen Zahlen gültig sind, stellen die gefundenen Zahlen eine zulässige Lösung des dualen Problems dar.
|
||||
\section{} %2
|
||||
Zunächst wird das eigentliche LP-Problem noch einmal aufgestellt:
|
||||
\begin{alignat*}{7}
|
||||
\text{maximiere}\; & 8x_{1} &+& 3x_{2} &+& 6x_{3} &+& 3x_{4} &+& 9x_{5} &+& 5x_{6} && \\
|
||||
\multicolumn{14}{l}{\text{unter den Nebenbedingungen}} && \\
|
||||
& x_{1} &+& x_{2} && && && && &\leq &\, 400 \\
|
||||
& && && x_{3} &+& x_{4} && && &\leq &\, 480 \\
|
||||
& && && && && x_{5} &+& x_{6} &\leq &\, 230 \\
|
||||
& x_{1} && &+& x_{3} && &+& x_{5} && &\leq &\, 420 \\
|
||||
& && x_{2} && &+& x_{4} && &+& x_{6} &\leq &\, 250 \\
|
||||
\multicolumn{12}{r}{$x_{1}, x_{2}, x_{3}, x_{4}, x_{5}, x_{6}$} \,&\geq &\, 0
|
||||
\end{alignat*}
|
||||
Die vorgeschlagene Lösung ist $x_{1}^{*} = 400, x_{2}^{*} = 0, x_{3}^{*} = 10, x_{4}^{*} = 30, x_{5}^{*} = 10, x_{6}^{*} = 220$.
|
||||
|
||||
Es ist offensichtlich, dass die erste Ungleichung mit Gleichheit erfüllt ist. Die zweite Ungleichung ist ebenso offensichtlich nicht mit Gleichheit erfüllt ($10 + 30 = 40 < 480$). Die dritte Ungleichung ist mit Gleichheit erfüllt ($10 + 220 = 230$).
|
||||
|
||||
Die vierte Ungleichung ist ebenso mit Gleichheit erfüllt ($400 + 10 + 10 = 420$), wie die fünfte Ungleichung ($0 + 30 + 220 = 250$).
|
||||
|
||||
Daraus lässt sich schließen, dass $y_{2}^{*} = 0$ gelten muss. Ebenso müssen die erste, dritte, vierte, fünfte und sechste Ungleichung des dualen Problems mit Gleichheit erfüllt sein, da die entsprechenden Werte des primalen Problems größer $0$ sind.
|
||||
|
||||
Das duale Problem:
|
||||
\begin{alignat*}{6}
|
||||
\text{minimiere}\; & 400y_{1} &+& 480y_{2} &+& 230y_{3} &+& 420y_{4} &+& 250y_{5} && \\
|
||||
\multicolumn{12}{l}{\text{unter den Nebenbedingungen}} && \\
|
||||
& y_{1} && && &+& y_{4} && &\geq &\, 8 \\
|
||||
& y_{1} && && && &+& y_{5} &\geq &\, 3 \\
|
||||
& && y_{2} && &+& y_{4} && &\geq &\, 6 \\
|
||||
& && y_{2} && && && y_{5} &\geq &\, 3 \\
|
||||
& && && y_{3} &+& y_{4} && &\geq &\, 9 \\
|
||||
& && && y_{3} && &+& y_{5} &\geq &\, 5 \\
|
||||
\multicolumn{10}{r}{$y_{1}, y_{2}, y_{3}, y_{4}, y_{5}$} \,&\geq &\, 0
|
||||
\end{alignat*}
|
||||
|
||||
Unter der Berücksichtigung, dass $y_{2}^{*} = 0$ gilt und alle außer die zweite Ungleichung mit Gleichheit erfüllt sein müssen, ergibt sich direkt $y_{4}^{*} = 6$ und $y_{5}^{*} = 3$.
|
||||
|
||||
Aufgrund dieser Werte lassen sich die restlichen Werte leicht errechnen:
|
||||
\begin{alignat*}{2}
|
||||
y_{1} + 6 &=& 8 \\
|
||||
y_{1} &=& 2 \\
|
||||
\intertext{Fünfte Ungleichung}
|
||||
y_{3} + 6 &=& 9 \\
|
||||
y_{3} &=& 3 \\
|
||||
\intertext{Sechste Ungleichung}
|
||||
y_{3} + 3 &=& 5 \\
|
||||
y_{3} &=& 2
|
||||
\end{alignat*}
|
||||
Bei dem Errechnen von $y_{3}$ ergibt sich ein Widerspruch, denn $y_{3}$ kann nicht sowohl 2 als auch 3 sein. Eine Alternative gibt es hier nicht, da sowohl die fünfte als auch die sechste Ungleichung mit Gleichheit erfüllt sein müssen.
|
||||
|
||||
Da es somit keine eindeutig bestimmbaren Zahlen $y_{i}^{*}$ mit $i = \{1,2,3,4,5\}$ gibt, die zusammen mit der vorgeschlagenen Lösung die komplementären Schlupfbedingungen erfüllen, entspricht die vorgeschlagene Lösung nicht der optimalen Strategie.
|
||||
\end{document}
|
||||
285
optimierung/Uebungsblatt8.tex
Normal file
285
optimierung/Uebungsblatt8.tex
Normal file
@ -0,0 +1,285 @@
|
||||
\documentclass[10pt,a4paper,oneside,ngerman,numbers=noenddot]{scrartcl}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage[ngerman]{babel}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{amsfonts}
|
||||
\usepackage{amssymb}
|
||||
\usepackage{paralist}
|
||||
\usepackage{gauss}
|
||||
\usepackage{pgfplots}
|
||||
\usepackage[locale=DE,exponent-product=\cdot,detect-all]{siunitx}
|
||||
\usepackage{tikz}
|
||||
\usetikzlibrary{matrix,fadings,calc,positioning,decorations.pathreplacing,arrows,decorations.markings}
|
||||
\usepackage{polynom}
|
||||
\polyset{style=C, div=:,vars=x}
|
||||
\pgfplotsset{compat=1.8}
|
||||
\pagenumbering{arabic}
|
||||
% ensures that paragraphs are separated by empty lines
|
||||
\parskip 12pt plus 1pt minus 1pt
|
||||
\parindent 0pt
|
||||
% define how the sections are rendered
|
||||
\def\thesection{\arabic{section})}
|
||||
\def\thesubsection{\alph{subsection})}
|
||||
\def\thesubsubsection{(\roman{subsubsection})}
|
||||
% some matrix magic
|
||||
\makeatletter
|
||||
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
|
||||
\hskip -\arraycolsep
|
||||
\let\@ifnextchar\new@ifnextchar
|
||||
\array{#1}}
|
||||
\makeatother
|
||||
|
||||
\begin{document}
|
||||
\author{Jan Branitz (6326955), Jim Martens (6420323),\\
|
||||
Stephan Niendorf (6242417)}
|
||||
\title{Hausaufgaben zum 9. Dezember}
|
||||
\maketitle
|
||||
\section{} %1
|
||||
\subsection{} %a
|
||||
\begin{alignat*}{4}
|
||||
\text{minimiere}\; & y_{1} \,&+&\, 2y_{2} \,&+&\, 3y_{3} && \\
|
||||
\multicolumn{8}{l}{\text{unter den Nebenbedingungen}} && \\
|
||||
\;& 2y_{1} \,&+&\, 3y_{2} \,&+&\, y_{3} \,&\geq & 5 \\
|
||||
\;& 3y_{1} \,&+&\, y_{2} \,&+&\, y_{3} \,&\geq & -7 \\
|
||||
\;-& y_{1} \,&+&\, 4y_{2} \,&-&\, 2y_{3} \,&\geq & 3 \\
|
||||
\;& y_{1} \,&-&\, 2y_{2} \,&-&\, y_{3} \,&=& 1 \\
|
||||
\multicolumn{6}{r}{$y_{2}, y_{3}$} \,&\geq &\, 0
|
||||
\end{alignat*}
|
||||
\subsection{} %b
|
||||
\begin{alignat*}{9}
|
||||
\text{maximiere}\; -& y_{1} &+& 16y_{2} &+& 5y_{3} &+& 8y_{4} &+& y_{5} &-& 4y_{6} &-& 10y_{7} &+& 9y_{8} && \\
|
||||
\multicolumn{18}{l}{\text{unter den Nebenbedingungen}} && \\
|
||||
& 2y_{1} &+& y_{2} &+& y_{3} &+& 2y_{4} &+& y_{5} &+& 4y_{6} &-& 4y_{7} &+& y_{8} &\leq &\, -2 \\
|
||||
-& 4y_{1} &+& 5y_{2} && &+& 4y_{4} &-& 3y_{5} &-& 3y_{6} &+& 3y_{7} &+& 2y_{8} &=&\, 3 \\
|
||||
& y_{1} &+& y_{2} &+& y_{3} &-& y_{4} &+& y_{5} && &-& 5y_{7} &+& y_{8} &=&\, 22 \\
|
||||
\multicolumn{16}{r}{$y_{4}, y_{5}, y_{6}, y_{7}$} \,&\geq &\, 0
|
||||
\end{alignat*}
|
||||
\section{} %2
|
||||
\subsection{} %a
|
||||
Das LP-Problem:
|
||||
\begin{alignat*}{3}
|
||||
\text{maximiere}\; & 40x_{1} \,&+&\, 70x_{2} && \\
|
||||
\multicolumn{6}{l}{\text{unter den Nebenbedingungen}} && \\
|
||||
\;& x_{1} \,&+&\, x_{2} \,&\leq & 100 \\
|
||||
\;& 10x_{1} \,&+&\, 50x_{2} \,&\leq & 4000 \\
|
||||
\multicolumn{4}{r}{$x_{1}, x_{2}$} \,&\geq &\, 0
|
||||
\end{alignat*}
|
||||
|
||||
Das duale Problem:
|
||||
\begin{alignat*}{3}
|
||||
\text{minimiere}\; & 100y_{1} \,&+&\, 4000y_{2} && \\
|
||||
\multicolumn{6}{l}{\text{unter den Nebenbedingungen}} && \\
|
||||
\;& y_{1} \,&+&\, 10y_{2} \,&\geq & 40 \\
|
||||
\;& y_{1} \,&+&\, 50y_{2} \,&\geq & 70 \\
|
||||
\multicolumn{4}{r}{$y_{1}, y_{2}$} \,&\geq &\, 0
|
||||
\end{alignat*}
|
||||
|
||||
\subsubsection{} %i
|
||||
\underline{Starttableau}:
|
||||
\begin{alignat*}{4}
|
||||
x_{3} \,&=&\, 100 \,&-&\, x_{1} \,&-&\, x_{2} \\
|
||||
x_{4} \,&=&\, 4000 \,&-&\, 10x_{1} \,&-&\, 50x_{2} \\ \cline{1 - 7}
|
||||
z &=& &&\, 40x_{1} \,&+&\, 70x_{2}
|
||||
\end{alignat*}
|
||||
|
||||
\underline{1. Iteration}:
|
||||
|
||||
Eingangsvariable: $x_{2}$\\
|
||||
Ausgangsvariable: $x_{4}$
|
||||
|
||||
Es folgt
|
||||
\begin{alignat*}{2}
|
||||
50x_{2} \,&=&&\, 4000 - 10x_{1} - x_{4} \\
|
||||
x_{2} \,&=&&\, 80 - \frac{1}{5}x_{1} - \frac{1}{50}x_{4} \\
|
||||
x_{3} \,&=&&\, 100 - x_{1} - \left(80 - \frac{1}{5}x_{1} - \frac{1}{50}x_{4}\right) \\
|
||||
&=&&\, 100 - x_{1} - 80 + \frac{1}{5}x_{1} + \frac{1}{50}x_{4} \\
|
||||
&=&&\, 20 - \frac{4}{5}x_{1} + \frac{1}{50}x_{4} \\
|
||||
z \,&=&&\, 40x_{1} + 70\left(80 - \frac{1}{5}x_{1} - \frac{1}{50}x_{4}\right) \\
|
||||
&=&&\, 40x_{1} + 5600 - 14x_{1} - \frac{7}{5}x_{4} \\
|
||||
&=&&\, 5600 + 26x_{1} - \frac{7}{5}x_{4}
|
||||
\end{alignat*}
|
||||
|
||||
\underline{Ergebnis der 1. Iteration}:
|
||||
\begin{alignat*}{4}
|
||||
x_{2} \,&=&\, 80 \,&-&\, \frac{1}{5}x_{1} \,&-&\, \frac{1}{50}x_{4} \\
|
||||
x_{3} \,&=&\, 20 \,&-&\, \frac{4}{5}x_{1} \,&+&\, \frac{1}{50}x_{4} \\ \cline{1 - 7}
|
||||
z &=& 5600 \,&+&\, 26x_{1} \,&-&\, \frac{7}{5}x_{4}
|
||||
\end{alignat*}
|
||||
|
||||
\underline{2. Iteration}:
|
||||
|
||||
Eingangsvariable: $x_{1}$\\
|
||||
Ausgangsvariable: $x_{3}$
|
||||
|
||||
Es folgt
|
||||
\begin{alignat*}{2}
|
||||
\frac{4}{5}x_{1} \,&=&&\, 20 + \frac{1}{50}x_{4} - x_{3} \\
|
||||
x_{1} \,&=&&\, 25 + \frac{1}{40}x_{4} - \frac{5}{4}x_{3} \\
|
||||
x_{2} \,&=&&\, 80 - \frac{1}{5}\left(25 + \frac{1}{40}x_{4} - \frac{5}{4}x_{3}\right) - \frac{1}{50}x_{4} \\
|
||||
&=&&\, 80 - 5 + \frac{1}{200}x_{4} - \frac{1}{4}x_{3} - \frac{1}{50}x_{4} \\
|
||||
&=&&\, 75 - \frac{3}{200}x_{4} - \frac{1}{4}x_{3} \\
|
||||
z \,&=&&\, 5600 + 26\left(25 + \frac{1}{40}x_{4} - \frac{5}{4}x_{3}\right) - \frac{7}{5}x_{4} \\
|
||||
&=&&\, 5600 + 650 + \frac{13}{20}x_{4} - \frac{65}{2}x_{3} - \frac{7}{5}x_{4} \\
|
||||
&=&&\, 6250 - \frac{3}{4}x_{4} - \frac{65}{2}x_{3}
|
||||
\end{alignat*}
|
||||
|
||||
\underline{Ergebnis der 2. Iteration}:
|
||||
\begin{alignat*}{4}
|
||||
x_{1} \,&=&\, 25 \,&-&\, \frac{1}{40}x_{4} \,&-&\, \frac{5}{4}x_{3} \\
|
||||
x_{2} \,&=&\, 75 \,&-&\, \frac{3}{200}x_{4} \,&-&\, \frac{1}{4}x_{3} \\ \cline{1 - 7}
|
||||
z &=& 6250 \,&-&\, \frac{3}{4}x_{4} \,&-&\, \frac{65}{2}x_{3}
|
||||
\end{alignat*}
|
||||
|
||||
Wie hier deutlich wird, ist $x_{1}^{*} = 25, x_{2}^{*} = 75$ eine optimale Lösung des primalen Problems.
|
||||
|
||||
\underline{Startlösung ("`zulässige Basislösung am Anfang"')}:
|
||||
\[
|
||||
x_{1} = 0, x_{2} = 0, x_{3} = 100, x_{4} = 4000 \text{ mit } z = 0
|
||||
\]
|
||||
\underline{Zulässige Basislösung nach der 1. Iteration}:
|
||||
\[
|
||||
x_{1} = 0, x_{2} = 80, x_{3} = 20, x_{4} = 0 \text{ mit } z = 5600
|
||||
\]
|
||||
\underline{Zulässige Basislösung nach der 2. Iteration}:
|
||||
\[
|
||||
x_{1} = 25, x_{2} = 75, x_{3} = 0, x_{4} = 0 \text{ mit } z = 6250
|
||||
\]
|
||||
|
||||
Durch Einsetzen von $y_{1}^{*} = 32.5$ und $y_{2}^{*} = 0.75$ in die Zielfunktion des dualen Problems ergibt sich folgendes:
|
||||
\[
|
||||
100 \cdot \frac{65}{2} + 4000 \cdot \frac{3}{4} = 3250 + 3000 = 6250
|
||||
\]
|
||||
|
||||
Die beiden Zielfunktionswerte stimmen überein. Nach dem Dualitätssatz folgt daraus, dass $y_{1}^{*} = 32.5, y_{2}^{*} = 0.75$ tatsächlich eine optimale Lösung für das duale Problem darstellt.
|
||||
\subsubsection{} %ii
|
||||
Zum Überprüfen der vorgeschlagenen Lösung werden die Werte zunächst in die Ungleichungen des LP-Problems eingesetzt.
|
||||
|
||||
Erste Ungleichung:
|
||||
\begin{alignat*}{2}
|
||||
25 + 75 &\leq & 100 \\
|
||||
100 &\leq & 100
|
||||
\end{alignat*}
|
||||
|
||||
Zweite Ungleichung:
|
||||
\begin{alignat*}{2}
|
||||
10 \cdot 25 + 50 \cdot 75 &\leq & 4000 \\
|
||||
4000 &\leq & 4000
|
||||
\end{alignat*}
|
||||
|
||||
Da beide Ungleichungen mit Gleichheit erfüllt sind, lassen sich keine Rückschlüsse auf $y$-Werte ziehen. Da beide $x$-Werte größer als $0$ sind, müssen beide Ungleichungen im dualen Problem mit Gleichheit erfüllt sein.
|
||||
|
||||
\begin{alignat*}{2}
|
||||
I \;& y_{1} + 10y_{2} &=& 40 \\
|
||||
II \;& y_{1} + 50y_{2} &=& 70 \\
|
||||
II - I \;& 40y_{2} &=& 30 \\
|
||||
\;& y_{2} &=& \frac{3}{4} \\
|
||||
\intertext{Einsetzen von $y_{2}$ in $I$}
|
||||
I \;& y_{1} + 10 \cdot \frac{3}{4} &=& 40 \\
|
||||
\;& y_{1} + \frac{15}{2} &=& 40 \\
|
||||
\;& y_{1} &=& \frac{65}{2}
|
||||
\end{alignat*}
|
||||
|
||||
Es ergeben sich somit die eindeutig bestimmten Zahlen $y_{1}^{*} = \frac{65}{2}, y_{2}^{*} = \frac{3}{4}$. Diese Zahlen erfüllen zusammen mit der vorgeschlagenen Lösung die komplementären Schlupfbedingungen.
|
||||
Schließlich muss noch geprüft werden, ob diese Zahlen auch eine zulässige Lösung des dualen Problems sind. Dafür werden diese eingesetzt:
|
||||
|
||||
Erste Ungleichung:
|
||||
\begin{alignat*}{2}
|
||||
1 \cdot \frac{65}{2} + 10 \cdot \frac{3}{4} &\geq & 40 \\
|
||||
40 &\geq & 40
|
||||
\end{alignat*}
|
||||
|
||||
Zweite Ungleichung:
|
||||
\begin{alignat*}{2}
|
||||
1 \cdot \frac{65}{2} + 50 \cdot \frac{3}{4} &\geq & 70 \\
|
||||
70 &\geq & 70
|
||||
\end{alignat*}
|
||||
|
||||
Da alle zwei Ungleichungen mit den herausgefundenen Zahlen gültig sind, stellen die gefundenen Zahlen eine zulässige Lösung des dualen Problems dar.
|
||||
\subsection{} %b
|
||||
\underline{Starttableau}:
|
||||
\begin{alignat*}{4}
|
||||
x_{3} \,&=&\, 100 \,&-&\, x_{1} \,&-&\, x_{2} \\
|
||||
x_{4} \,&=&\, 4000 + t \,&-&\, 10x_{1} \,&-&\, 50x_{2} \\ \cline{1 - 7}
|
||||
z &=& &&\, 40x_{1} \,&+&\, 70x_{2}
|
||||
\end{alignat*}
|
||||
|
||||
\underline{1. Iteration}:
|
||||
|
||||
\textbf{Es wird vorausgesetzt, dass $0 \leq t \leq 1000$ gilt.} Für $t=0$ gilt im Folgenden genau das Gleiche wie in 2a i). Für $t=1000$ kann eine der Ausgangsvariablen nach Belieben gewählt werden, da beide potentiellen Ausgangsvariablen $x_{2}$ gleichermaßen beschränken. Da in den meisten Fällen jedoch $t$ kleiner als $1000$ ist, wird $x_{4}$ als Ausgangsvariable gewählt.
|
||||
|
||||
Eingangsvariable: $x_{2}$\\
|
||||
Ausgangsvariable: $x_{4}$
|
||||
|
||||
Es folgt
|
||||
\begin{alignat*}{2}
|
||||
50x_{2} \,&=&&\, 4000 + t - 10x_{1} - x_{4} \\
|
||||
x_{2} \,&=&&\, 80 + \frac{1}{50}t - \frac{1}{5}x_{1} - \frac{1}{50}x_{4} \\
|
||||
x_{3} \,&=&&\, 100 - x_{1} - \left(80 + \frac{1}{50}t - \frac{1}{5}x_{1} - \frac{1}{50}x_{4}\right) \\
|
||||
&=&&\, 100 - x_{1} - 80 - \frac{1}{50}t + \frac{1}{5}x_{1} + \frac{1}{50}x_{4} \\
|
||||
&=&&\, 20 - \frac{1}{50}t - \frac{4}{5}x_{1} + \frac{1}{50}x_{4} \\
|
||||
z \,&=&&\, 40x_{1} + 70\left(80 + \frac{1}{50}t - \frac{1}{5}x_{1} - \frac{1}{50}x_{4}\right) \\
|
||||
&=&&\, 40x_{1} + 5600 + \frac{7}{5}t - 14x_{1} - \frac{7}{5}x_{4} \\
|
||||
&=&&\, 5600 + \frac{7}{5}t + 26x_{1} - \frac{7}{5}x_{4}
|
||||
\end{alignat*}
|
||||
|
||||
\underline{Ergebnis der 1. Iteration}:
|
||||
\begin{alignat*}{4}
|
||||
x_{2} \,&=&\, 80 + \frac{1}{50}t \,&-&\, \frac{1}{5}x_{1} \,&-&\, \frac{1}{50}x_{4} \\
|
||||
x_{3} \,&=&\, 20 - \frac{1}{50}t \,&-&\, \frac{4}{5}x_{1} \,&+&\, \frac{1}{50}x_{4} \\ \cline{1 - 7}
|
||||
z &=& 5600 + \frac{7}{5}t \,&+&\, 26x_{1} \,&-&\, \frac{7}{5}x_{4}
|
||||
\end{alignat*}
|
||||
|
||||
\underline{2. Iteration}:
|
||||
|
||||
\textbf{Es wird vorausgesetzt, dass $t \leq 1000$ gilt.} Könnte $t$ größer sein, dann würde die Möglichkeit bestehen, dass $x_{3}$ in der Basislösung nach der ersten Iteration einen negativen Wert hat.
|
||||
|
||||
Eingangsvariable: $x_{1}$\\
|
||||
Ausgangsvariable: $x_{3}$
|
||||
|
||||
Es folgt
|
||||
\begin{alignat*}{2}
|
||||
\frac{4}{5}x_{1} \,&=&&\, 20 - \frac{1}{50}t + \frac{1}{50}x_{4} - x_{3} \\
|
||||
x_{1} \,&=&&\, 25 - \frac{1}{40}t + \frac{1}{40}x_{4} - \frac{5}{4}x_{3} \\
|
||||
x_{2} \,&=&&\, 80 + \frac{1}{50}t - \frac{1}{5}\left(25 - \frac{1}{40}t + \frac{1}{40}x_{4} - \frac{5}{4}x_{3}\right) - \frac{1}{50}x_{4} \\
|
||||
&=&&\, 80 + \frac{1}{50}t - 5 + \frac{1}{200}t - \frac{1}{200}x_{4} - \frac{1}{4}x_{3} - \frac{1}{50}x_{4} \\
|
||||
&=&&\, 75 + \frac{1}{40}t - \frac{1}{40}x_{4} - \frac{1}{4}x_{3} \\
|
||||
z \,&=&&\, 5600 + \frac{7}{5}t + 26\left(25 - \frac{1}{40}t + \frac{1}{40}x_{4} - \frac{5}{4}x_{3}\right) - \frac{7}{5}x_{4} \\
|
||||
&=&&\, 5600 + \frac{7}{5}t + 650 - \frac{13}{20}t + \frac{13}{20}x_{4} - \frac{65}{2}x_{3} - \frac{7}{5}x_{4} \\
|
||||
&=&&\, 6250 + \frac{3}{4}t - \frac{3}{4}x_{4} - \frac{65}{2}x_{3}
|
||||
\end{alignat*}
|
||||
|
||||
\underline{Ergebnis der 2. Iteration}:
|
||||
\begin{alignat*}{4}
|
||||
x_{1} \,&=&\, 25 - \frac{1}{40}t \,&-&\, \frac{1}{40}x_{4} \,&-&\, \frac{5}{4}x_{3} \\
|
||||
x_{2} \,&=&\, 75 + \frac{1}{40}t \,&-&\, \frac{1}{40}x_{4} \,&-&\, \frac{1}{4}x_{3} \\ \cline{1 - 7}
|
||||
z &=& 6250 + \frac{3}{4}t \,&-&\, \frac{3}{4}x_{4} \,&-&\, \frac{65}{2}x_{3}
|
||||
\end{alignat*}
|
||||
|
||||
Wie hier deutlich wird, ist $x_{1}^{*} = 25, x_{2}^{*} = 75$ eine optimale Lösung des primalen Problems.
|
||||
|
||||
\underline{Startlösung ("`zulässige Basislösung am Anfang"')}:
|
||||
\[
|
||||
x_{1} = 0, x_{2} = 0, x_{3} = 100, x_{4} = 4000 + t \text{ mit } z = 0
|
||||
\]
|
||||
\underline{Zulässige Basislösung nach der 1. Iteration}:
|
||||
\[
|
||||
x_{1} = 0, x_{2} = 80 + \frac{1}{50}t, x_{3} = 20 - \frac{1}{50}t, x_{4} = 0 \text{ mit } z = 5600 + \frac{7}{5}t
|
||||
\]
|
||||
\underline{Zulässige Basislösung nach der 2. Iteration}:
|
||||
\[
|
||||
x_{1} = 25 - \frac{1}{40}t, x_{2} = 75 + \frac{1}{40}t, x_{3} = 0, x_{4} = 0 \text{ mit } z = 6250 + \frac{3}{4}t
|
||||
\]
|
||||
|
||||
Wie im Folgenden zu sehen ist, entsprechen die Werte der optimalen Lösung den in (7.24) auf Skriptseite 67 angenommenen Werten.
|
||||
\[
|
||||
x_{1} = 25 - \frac{1}{40}t = 25 - \frac{25}{1000}t = 25 - 0.025t
|
||||
\]
|
||||
\[
|
||||
x_{2} = 75 + \frac{1}{40}t = 75 + \frac{25}{1000}t = 75 + 0.025t
|
||||
\]
|
||||
Im Folgenden ist zu sehen, dass tatsächlich ein zusätzlicher Gewinn von $0.75t$ erzielt wird.
|
||||
\[
|
||||
z = 6250 + \frac{3}{4}t = 6250 + \frac{75}{100}t = 6250 + 0.75t
|
||||
\]
|
||||
\end{document}
|
||||
286
prosem/VortragProsem.tex
Normal file
286
prosem/VortragProsem.tex
Normal file
@ -0,0 +1,286 @@
|
||||
\documentclass[14pt]{beamer}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Meta informations:
|
||||
\newcommand{\trauthor}{Horst Hansen}
|
||||
\newcommand{\trtype}{} %{Proseminar} %{Seminar} %{Workshop}
|
||||
\newcommand{\trcourse}{Knowledge Processing with Neural Networks}
|
||||
\newcommand{\trtitle}{Neural Networks for Artificial Agents}
|
||||
\newcommand{\trmatrikelnummer}{6543210}
|
||||
\newcommand{\tremail}{hansen@informatik.uni-hamburg.de}
|
||||
\newcommand{\trinstitute}{Dept. Informatik -- Knowledge Technology, WTM}
|
||||
\newcommand{\trwebsiteordate}{{http://www.informatik.uni-hamburg.de/WTM/}}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Languages:
|
||||
|
||||
% Falls die Ausarbeitung in Deutsch erfolgt:
|
||||
% \usepackage[german]{babel}
|
||||
% \usepackage[T1]{fontenc}
|
||||
% \usepackage[latin1]{inputenc}
|
||||
% \usepackage[latin9]{inputenc}
|
||||
% \selectlanguage{german}
|
||||
|
||||
% If the thesis is written in English:
|
||||
\usepackage[english]{babel}
|
||||
\selectlanguage{english}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Bind packages:
|
||||
\usepackage{beamerthemesplit}
|
||||
\usetheme{Boadilla}
|
||||
%\usetheme{Copenhagen}
|
||||
%\usetheme{Darmstadt}
|
||||
%\usetheme{Frankfurt}
|
||||
%\usetheme{Ilmenau}
|
||||
%\usetheme{JuanLesPins}
|
||||
%\usetheme{Madrid}
|
||||
%\usetheme{Warsaw }
|
||||
%\usecolortheme{dolphin}
|
||||
%\setbeamertemplate{sections/subsections in toc}[sections numbered]
|
||||
%\beamertemplatenavigationsymbolsempty
|
||||
%\setbeamertemplate{headline}[default] % deaktiviert die Kopfzeile
|
||||
\setbeamertemplate{navigation symbols}{}% deaktiviert Navigationssymbole
|
||||
%\useinnertheme{rounded}
|
||||
|
||||
\usepackage{acronym} % Acronyms
|
||||
\usepackage{algorithmic} % Algorithms and Pseudocode
|
||||
\usepackage{algorithm} % Algorithms and Pseudocode
|
||||
\usepackage{amsfonts} % AMS Math Packet (Fonts)
|
||||
\usepackage{amsmath} % AMS Math Packet
|
||||
\usepackage{amssymb} % Additional mathematical symbols
|
||||
\usepackage{amsthm}
|
||||
\usepackage{color} % Enables defining of colors via \definecolor
|
||||
\usepackage{fancybox} % Gleichungen einrahmen
|
||||
\usepackage{fancyhdr} % Paket zur schickeren der Gestaltung der
|
||||
\usepackage{graphicx} % Inclusion of graphics
|
||||
%\usepackage{latexsym} % Special symbols
|
||||
\usepackage{longtable} % Allow tables over several parges
|
||||
\usepackage{listings} % Nicer source code listings
|
||||
\usepackage{lmodern}
|
||||
\usepackage{multicol} % Content of a table over several columns
|
||||
\usepackage{multirow} % Content of a table over several rows
|
||||
\usepackage{rotating} % Alows to rotate text and objects
|
||||
\usepackage[section]{placeins} % Ermoeglich \Floatbarrier fuer Gleitobj.
|
||||
\usepackage[hang]{subfigure} % Allows to use multiple (partial) figures in a fig
|
||||
%\usepackage[font=footnotesize,labelfont=rm]{subfig} % Pictures in a floating environment
|
||||
\usepackage{tabularx} % Tables with fixed width but variable rows
|
||||
\usepackage{url,xspace,boxedminipage} % Accurate display of URLs
|
||||
|
||||
\definecolor{uhhRed}{RGB}{254,0,0} % Official Uni Hamburg Red
|
||||
\definecolor{uhhGrey}{RGB}{136,136,136} % Official Uni Hamburg Grey
|
||||
\definecolor{uhhLightGrey}{RGB}{180,180,180} % Official Uni Hamburg LightGrey
|
||||
\definecolor{uhhLightLightGrey}{RGB}{220,220,220} % Official Uni Hamburg LightLightGrey
|
||||
\setbeamertemplate{itemize items}[ball]
|
||||
\setbeamercolor{title}{fg=uhhRed,bg=white}
|
||||
\setbeamercolor{title in head/foot}{bg=uhhRed}
|
||||
\setbeamercolor{block title}{bg=uhhGrey,fg=white}
|
||||
\setbeamercolor{block body}{bg=uhhLightLightGrey,fg=black}
|
||||
\setbeamercolor{section in head/foot}{bg=black}
|
||||
\setbeamercolor{frametitle}{bg=white,fg=uhhRed}
|
||||
\setbeamercolor{author in head/foot}{bg=black,fg=white}
|
||||
\setbeamercolor{author in footline}{bg=white,fg=black}
|
||||
\setbeamercolor*{item}{fg=uhhRed}
|
||||
\setbeamercolor*{section in toc}{fg=black}
|
||||
\setbeamercolor*{separation line}{bg=black}
|
||||
\setbeamerfont*{author in footline}{size=\scriptsize,series=\mdseries}
|
||||
\setbeamerfont*{institute}{size=\footnotesize}
|
||||
|
||||
\newcommand{\opticalseperator}{0.0025\paperwidth}
|
||||
|
||||
\institute{Universit\"at Hamburg\\\trinstitute}
|
||||
\title{\trtitle}
|
||||
\subtitle{\trtype}
|
||||
\author{\trauthor}
|
||||
\date{}
|
||||
\logo{}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Configurationen:
|
||||
%\hypersetup{pdfpagemode=FullScreen}
|
||||
|
||||
\hyphenation{whe-ther} % Manually use: "\-" in a word: Staats\-ver\-trag
|
||||
|
||||
%\lstloadlanguages{C} % Set the default language for listings
|
||||
\DeclareGraphicsExtensions{.pdf,.svg,.jpg,.png,.eps} % first try pdf, then eps, png and jpg
|
||||
\graphicspath{{./src/}} % Path to a folder where all pictures are located
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Costom Definitions:
|
||||
\setbeamertemplate{title page}
|
||||
{
|
||||
\vbox{}
|
||||
\vspace{0.4cm}
|
||||
\begin{centering}
|
||||
\begin{beamercolorbox}[sep=8pt,center,colsep=-4bp]{title}
|
||||
\usebeamerfont{title}\inserttitle\par%
|
||||
\ifx\insertsubtitle\@empty%
|
||||
\else%
|
||||
\vskip0.20em%
|
||||
{\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
|
||||
\fi%
|
||||
\end{beamercolorbox}%
|
||||
\vskip0.4em
|
||||
\begin{beamercolorbox}[sep=8pt,center,colsep=-4bp,rounded=true,shadow=true]{author}
|
||||
\usebeamerfont{author}\insertauthor \\ \insertinstitute
|
||||
\end{beamercolorbox}
|
||||
|
||||
\vfill
|
||||
\begin{beamercolorbox}[ht=8ex,center]{}
|
||||
\includegraphics[width=0.20\paperwidth]{wtmIcon.pdf}
|
||||
\end{beamercolorbox}%
|
||||
\begin{beamercolorbox}[sep=8pt,center,colsep=-4bp,rounded=true,shadow=true]{institute}
|
||||
\usebeamerfont{institute}\trwebsiteordate
|
||||
\end{beamercolorbox}
|
||||
\vspace{-0.1cm}
|
||||
\end{centering}
|
||||
}
|
||||
|
||||
\setbeamertemplate{frametitle}
|
||||
{
|
||||
\begin{beamercolorbox}[wd=\paperwidth,ht=3.8ex,dp=1.2ex,leftskip=0pt,rightskip=4.0ex]{frametitle}%
|
||||
\usebeamerfont*{frametitle}\centerline{\insertframetitle}
|
||||
\end{beamercolorbox}
|
||||
\vspace{0.0cm}
|
||||
}
|
||||
|
||||
\setbeamertemplate{footline}
|
||||
{
|
||||
\leavevmode
|
||||
\vspace{-0.05cm}
|
||||
\hbox{
|
||||
\begin{beamercolorbox}[wd=.32\paperwidth,ht=4.8ex,dp=2.7ex,center]{author in footline}
|
||||
\hspace*{2ex}\usebeamerfont*{author in footline}\trauthor
|
||||
\end{beamercolorbox}%
|
||||
\begin{beamercolorbox}[wd=.60\paperwidth,ht=4.8ex,dp=2.7ex,center]{author in footline}
|
||||
\usebeamerfont*{author in footline}\trtitle
|
||||
\end{beamercolorbox}%
|
||||
\begin{beamercolorbox}[wd=.07\paperwidth,ht=4.8ex,dp=2.7ex,center]{author in footline}
|
||||
\usebeamerfont*{author in footline}\insertframenumber{}
|
||||
\end{beamercolorbox}
|
||||
}
|
||||
\vspace{0.15cm}
|
||||
}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Additional 'theorem' and 'definition' blocks:
|
||||
\newtheorem{axiom}{Axiom}[section]
|
||||
%\newtheorem{axiom}{Fakt}[section] % Wenn in Deutsch geschrieben wird.
|
||||
%Usage:%\begin{axiom}[optional description]%Main part%\end{fakt}
|
||||
|
||||
%Additional types of axioms:
|
||||
\newtheorem{observation}[axiom]{Observation}
|
||||
|
||||
%Additional types of definitions:
|
||||
\theoremstyle{remark}
|
||||
%\newtheorem{remark}[section]{Bemerkung} % Wenn in Deutsch geschrieben wird.
|
||||
\newtheorem{remark}[section]{Remark}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Provides TODOs within the margin:
|
||||
\newcommand{\TODO}[1]{\marginpar{\emph{\small{{\bf TODO: } #1}}}}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Abbreviations and mathematical symbols
|
||||
\newcommand{\modd}{\text{ mod }}
|
||||
\newcommand{\RS}{\mathbb{R}}
|
||||
\newcommand{\NS}{\mathbb{N}}
|
||||
\newcommand{\ZS}{\mathbb{Z}}
|
||||
\newcommand{\dnormal}{\mathit{N}}
|
||||
\newcommand{\duniform}{\mathit{U}}
|
||||
|
||||
\newcommand{\erdos}{Erd\H{o}s}
|
||||
\newcommand{\renyi}{-R\'{e}nyi}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Display of TOCs:
|
||||
\AtBeginSection[]
|
||||
{
|
||||
\setcounter{tocdepth}{2}
|
||||
\frame
|
||||
{
|
||||
\frametitle{Outline}
|
||||
\tableofcontents[currentsection]
|
||||
}
|
||||
}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Document:
|
||||
\begin{document}
|
||||
\renewcommand{\arraystretch}{1.2}
|
||||
|
||||
\begin{frame}[plain] % plain => kein Rahmen
|
||||
\titlepage
|
||||
\end{frame}
|
||||
%\setcounter{framenumber}{0}
|
||||
|
||||
\frame{
|
||||
\frametitle{Outline}
|
||||
\tableofcontents
|
||||
}
|
||||
|
||||
%%%%%%%%%%%%%%
|
||||
% Your Content
|
||||
|
||||
\section{Motivation and Question}
|
||||
|
||||
\frame[t]{
|
||||
\frametitle{Motivation}
|
||||
\begin{itemize}
|
||||
\item Add your motivation here
|
||||
\begin{itemize}
|
||||
\item Maybe with some details
|
||||
\begin{itemize}
|
||||
\item but not too much
|
||||
\end{itemize}
|
||||
\end{itemize}
|
||||
\item Use references \textsuperscript{[Author, 2010]}
|
||||
\end{itemize}
|
||||
}
|
||||
|
||||
\section{Basics and Definition}
|
||||
|
||||
\section{Approach}
|
||||
|
||||
\section{Results}
|
||||
|
||||
\section{Conclusion}
|
||||
|
||||
\frame[t]
|
||||
{
|
||||
\frametitle{Conclusion}
|
||||
|
||||
Novelty and contribution of this work:
|
||||
\begin{itemize}
|
||||
\item Sum up the approach
|
||||
\item Sum op the results
|
||||
\item ...
|
||||
\item Show that it solves the question
|
||||
\end{itemize}
|
||||
|
||||
\mbox{ }
|
||||
|
||||
Open Questions:
|
||||
\begin{itemize}
|
||||
\item Something
|
||||
\item ... is always missing
|
||||
\end{itemize}
|
||||
}
|
||||
|
||||
%%%%%%%%%%%%%%
|
||||
|
||||
\frame[c]{
|
||||
\frametitle{The End}
|
||||
\begin{center}
|
||||
Thank you for your attention.\\[1ex]
|
||||
Any question?\\[5ex]
|
||||
\end{center}
|
||||
\footnotesize
|
||||
Literature:
|
||||
\begin{itemize}
|
||||
\item Author , Author , Author, and Author. Name of the conference paper. \emph{In: Proceedings of the Conference Name}, 2008
|
||||
\item Author, Author, and Author. Name of the Article. \emph{Name of the Journal}, 42:111-133, 2010
|
||||
\item Author, and Author. \emph{Name of the Book}. Publisher, 2009
|
||||
\end{itemize}
|
||||
}
|
||||
|
||||
\end{document}
|
||||
@ -170,7 +170,7 @@
|
||||
|
||||
% Abstract gives a brief summary of the main points of a paper:
|
||||
\section*{Abstract}
|
||||
Your text here...
|
||||
Syntactic parsing and semantic analysis are two important methods for understanding natural language. Each of them has their individual strengths and weaknesses. But both of them have major issues with ambiguity once a restricted environment is left. Understanding unrestricted natural language is therefore far from being reached.
|
||||
|
||||
% Lists:
|
||||
\setcounter{tocdepth}{2} % depth of the table of contents (for Seminars 2 is recommented)
|
||||
@ -188,47 +188,49 @@
|
||||
\section{Introduction}
|
||||
\label{sec:introduction}
|
||||
|
||||
\begin{itemize}
|
||||
\item two kinds of natural language: spoken language and written language
|
||||
\item will concentrate on written language
|
||||
\item definition of syntax, semantics and pragmatics
|
||||
\item two important methods: syntactic parsing and semantic analysis
|
||||
\end{itemize}
|
||||
It's the dream of many Science-Fiction fans: A fully sentient AI. Let's ignore for a moment all the odds that are against it (morality, physics, etc.) and concentrate on one aspect that is mandatory for even much less ambitious dreams. Imagine a computer game in which you can talk natural language to the NPC counterparts so that they react appropriately to it. Well maybe that is still too ambitious. What about writing what you want to say? In that case the computer needs to understand what you are writing so that it can react to it.
|
||||
|
||||
This process of understanding natural language contains multiple methods. The first one is the syntactic parsing, the second one the semantic analysis. Syntactic parsing relies on a grammar that describes the set of possible input, also called syntax. The syntax specifies what are allowed sentence structures and how these are built.
|
||||
The semantic analysis relies on the semantics of a given input. That means what the given input means. An example: ``You run around the bush''. The semantic meaning of this sentence is that you are running around a bush. The pragmatics define what is the intended meaning of an input. In this example it's not that you run around the bush but actually that you take a long time to get to the point in a discussion. It's a so called idiom. This difference between semantic meaning, where just the sentence as it is written is considered, and pragmatic meaning, where the intended meaning is considered, generates ambiguity that is easy for humans to resolve but difficult for computers. But even the pragmatics in this example are ambigious, because it depends on the context what it actually means. If two persons are walking around in a forest and one starts running around the bush, the sentence of this example, would have the semantic meaning as it's pragmatic meaning.
|
||||
|
||||
On top of that the semantic meaning itself isn't always clear either. Sometimes words have multiple meanings, so that even the semantic meaning can have different possible interpretations.
|
||||
|
||||
In this paper both syntactic parsing and semantic analysis are presented. After the presentation of the methods, they are critically discussed to finally come to a conclusion.
|
||||
|
||||
\section{Evaluation of methods}
|
||||
\label{sec:evalMethods}
|
||||
\subsection{Syntactic Parsing}
|
||||
\label{subSec:syntacticParsing}
|
||||
Syntactic Parsing is used to create parse trees. These can be used for grammar checks in a text editor: ``A sentence that cannot be parsed may have grammatical errors''\footnote{\cite{Jurafsky2009b}, page 461}. But they more likely ``serve as an important intermediate stage of representation for semantic analysis''\footnote{\cite{Jurafsky2009b}, page 461}. There are different algorithms available to create such trees. The CYK\footnote{named after inventors John Cocke, Daniel Younger and Tadeo Kasami} algorithm will be explained further. But before the CYK algorithm is explained, the reason for its existance is presented.
|
||||
Syntactic Parsing is used to create parse trees. These can be used for grammar checks in a text editor: ``A sentence that cannot be parsed may have grammatical errors''\cite[p.~461]{Jurafsky2009b}. But they more likely ``serve as an important intermediate stage of representation for semantic analysis''\cite[p.~461]{Jurafsky2009b}. There are different algorithms available to create such trees. The CYK\footnote{named after inventors John Cocke, Daniel Younger and Tadeo Kasami} algorithm will be explained further. But before the CYK algorithm is explained, the reason for its existance is presented.
|
||||
|
||||
There are two classical ways of parsing a sentence. The one is bottom-up and the other one is top-down. Both approaches have their own advantages and disadvantages. In addition the ambiguity creates problems. To implement bottom-up and top-down search algorithms in the face of ambiguity, ``an agenda-based backtracking strategy''\footnote{\cite{Jurafsky2009b}, page 468} is used. The problem here is that every time the parser recognizes that the current parse tree is wrong, it has to backtrack and explore other parts of the sentence. This creates a huge amount of work duplication and is therefore inefficient.
|
||||
There are two classical ways of parsing a sentence. The one is bottom-up and the other one is top-down. Both approaches have their own advantages and disadvantages. In addition the ambiguity creates problems. To implement bottom-up and top-down search algorithms in the face of ambiguity, ``an agenda-based backtracking strategy''\cite[p.~468]{Jurafsky2009b} is used. The problem here is that every time the parser recognizes that the current parse tree is wrong, it has to backtrack and explore other parts of the sentence. This creates a huge amount of work duplication and is therefore inefficient.
|
||||
|
||||
A solution to these problems is offered by ``dynamic programming parsing methods''\footnote{\cite{Jurafsky2009b}, page 469}. The CYK algorithm is one of multiple algorithms based on dynamic programming.
|
||||
A solution to these problems is offered by ``dynamic programming parsing methods''\cite[p.~469]{Jurafsky2009b}. The CYK algorithm is one of multiple algorithms based on dynamic programming.
|
||||
|
||||
The CYK does only work with grammars in the Chomsky Normal Form (CNF). Every context-free grammar can be converted to CNF without loss in expressiveness. Therefore this restriction does no harm but simplifies the parsing. For information on how context-free grammars can be converted to CNF, refer to Jurafsky\cite{Jurafsky2009b}.
|
||||
|
||||
CYK requires $\mathcal{O}(n^{2}m)$ space for the $P$ table (a table with probabilities), where ``$m$ is the number of nonterminal symbols in the grammar''\footnote{\cite{Russel2010}, page 893}, and uses $\mathcal{O}(n^{3}m)$ time. ``$m$ is constant for a particular grammar, [so it] is commonly described as $\mathcal{O}(n^{3})$''\footnote{\cite{Russel2010}, page 893}. There is no algorithm that is better than CYK for general context-free grammars\cite{Russel2010}.
|
||||
CYK requires $\mathcal{O}(n^{2}m)$ space for the $P$ table (a table with probabilities), where ``$m$ is the number of nonterminal symbols in the grammar''\cite[p.~893]{Russel2010}, and uses $\mathcal{O}(n^{3}m)$ time. ``$m$ is constant for a particular grammar, [so it] is commonly described as $\mathcal{O}(n^{3})$''\cite[p.~893]{Russel2010}. There is no algorithm that is better than CYK for general context-free grammars\cite{Russel2010}.
|
||||
|
||||
But how does CYK work? CYK doesn't examine all parse trees. It just examines the most probable one and computes the probability of that tree. All the other parse trees are present in the $P$ table and could be enumerated with a little work (in exponential time). But the strength and beauty of CYK is, that they don't have to be enumerated. CYK defines ``the complete state space defined by the `apply grammar rule' operator''\footnote{\cite{Russel2010}, page 894}. You can search just a part of this space with $A^{*}$ search.\cite{Russel2010} ``With the $A^{*}$ algorithm [...] the first parse found will be the most probable''\footnote{\cite{Russel2010}, page 895}.
|
||||
But how does CYK work? CYK doesn't examine all parse trees. It just examines the most probable one and computes the probability of that tree. All the other parse trees are present in the $P$ table and could be enumerated with a little work (in exponential time). But the strength and beauty of CYK is, that they don't have to be enumerated. CYK defines ``the complete state space defined by the `apply grammar rule' operator''\cite[p.~894]{Russel2010}. You can search just a part of this space with $A^{*}$ search.\cite{Russel2010} ``With the $A^{*}$ algorithm [...] the first parse found will be the most probable''\cite[p.~895]{Russel2010}.
|
||||
|
||||
But these probabilities need to be learned from somewhere. This somewhere is usually a ``treebank''\footnote{\cite{Russel2010}, page 895}, which contains a corpus of correctly parsed sentences. The best known is the Penn Treebank\cite{Russel2010}, which ``consists of 3 million words which have been annotated with part of speech and parse-tree structure, using human labor assisted by some automated tools''\footnote{\cite{Russel2010}, page 895}. The probabilities are then computed by counting and smoothing in the given data.\cite{Russel2010} There are other ways to learn the probabilities that are more difficult. For more information refer to Russel\cite{Russel2010}.
|
||||
But these probabilities need to be learned from somewhere. This somewhere is usually a ``treebank''\cite[p.~895]{Russel2010}, which contains a corpus of correctly parsed sentences. The best known is the Penn Treebank\cite{Russel2010}, which ``consists of 3 million words which have been annotated with part of speech and parse-tree structure, using human labor assisted by some automated tools''\cite[p.~895]{Russel2010}. The probabilities are then computed by counting and smoothing in the given data.\cite{Russel2010} There are other ways to learn the probabilities that are more difficult. For more information refer to Russel\cite{Russel2010}.
|
||||
|
||||
\subsection{Semantic Analysis}
|
||||
\label{subSec:semanticAnalysis}
|
||||
|
||||
Semantic analysis provides multiple approaches. In this paper the approach of ``syntax-driven semantic analysis''\footnote{\cite{Jurafsky2009}, page 617} is explained further. In this approach the output of a parser, the syntactic analysis, ``is passed as input to a semantic analyzer to produce a meaning representation''\footnote{\cite{Jurafsky2009}, page 618}.
|
||||
Semantic analysis provides multiple approaches. In this paper the approach of ``syntax-driven semantic analysis''\cite[p.~617]{Jurafsky2009} is explained further. In this approach the output of a parser, the syntactic analysis, ``is passed as input to a semantic analyzer to produce a meaning representation''\cite[p.~618]{Jurafsky2009}.
|
||||
|
||||
Therefore context-free grammar rules are augmented with ``semantic attachments''\footnote{\cite{Jurafsky2009}, page 618}. Every word and syntactic structure in a sentence gets such a semantic attachment. The tree with syntactic components is now traversed in a bottom-up manner. On the way the semantic attachments are combined to finally produce ``First-Order Logic''\footnote{\cite{Jurafsky2009a}, page 589} that can be interpreted in a meaningful way. This procedure has some prerequisites that will be explained first.
|
||||
Therefore context-free grammar rules are augmented with ``semantic attachments''\cite[p.~618]{Jurafsky2009}. Every word and syntactic structure in a sentence gets such a semantic attachment. The tree with syntactic components is now traversed in a bottom-up manner. On the way the semantic attachments are combined to finally produce ``First-Order Logic''\cite[p.~589]{Jurafsky2009a} that can be interpreted in a meaningful way. This procedure has some prerequisites that will be explained first.
|
||||
|
||||
The mentioned \textit{First-Order Logic} can be represented by a context-free grammar specification. It is beyond this paper to describe this specification completely. Jurafsky\cite{Jurafsky2009a} provides a detailed picture of the specification with all elements in figure 17.3. The most important aspects of this specification are explained here. The logic provides terms which can be functions, constants and variables. Functions have a term as argument. Syntactically they are the same as single-argument predicates. But functions represent one unique object.
|
||||
Predicates can have multiple terms as arguments. In addition the logic provides quantifiers ($\forall, \exists$) and connectives ($\wedge, \vee, \Rightarrow$).
|
||||
|
||||
Another prerequisite is the ``lambda notation''\footnote{\cite{Jurafsky2009a}, page 593}. A simple example of this notation is an expression of the following form\footnote{examples taken from Jurafsky\cite{Jurafsky2009a}, pp. 593-594}:
|
||||
Another prerequisite is the ``lambda notation''\cite[p.~593]{Jurafsky2009a}. A simple example of this notation is an expression of the following form\footnote{examples taken from Jurafsky\cite[pp.~593-594]{Jurafsky2009a}}:
|
||||
\[
|
||||
\lambda x.P(x)
|
||||
\]
|
||||
|
||||
The $\lambda$ can be reduced in a so called ``$\lambda$-reduction''\footnote{\cite{Jurafsky2009a}, page 593}. The expression above could be reduced in the following way:
|
||||
The $\lambda$ can be reduced in a so called ``$\lambda$-reduction''\cite[p.~593]{Jurafsky2009a}. The expression above could be reduced in the following way:
|
||||
|
||||
\begin{alignat*}{2}
|
||||
\lambda x.&P(x)&(A) \\
|
||||
@ -247,16 +249,16 @@
|
||||
&Near(Bacaro, Centro)
|
||||
\end{alignat*}
|
||||
|
||||
This technique is called ``currying''\footnote{\cite{Jurafsky2009a}, page 594} and is used to convert ``a predicate with multiple arguments into a sequence of single-argument predicates''\footnote{\cite{Jurafsky2009a}, page 594}.
|
||||
This technique is called ``currying''\cite[p.~594]{Jurafsky2009a} and is used to convert ``a predicate with multiple arguments into a sequence of single-argument predicates''\cite[p.~594]{Jurafsky2009a}.
|
||||
|
||||
After the prerequisites are now explained, it is time to start with the actual syntax-driven semantic analysis. It will be shown with an example provided by Jurafsky. Assume the sentence \textit{Every restaurant closed}. ``The target representation for this example should be the following''\footnote{\cite{Jurafsky2009}, page 621}.
|
||||
After the prerequisites are now explained, it is time to start with the actual syntax-driven semantic analysis. It will be shown with an example provided by Jurafsky. Assume the sentence \textit{Every restaurant closed}. ``The target representation for this example should be the following''\cite[p.~621]{Jurafsky2009}.
|
||||
|
||||
\begin{equation}
|
||||
\label{eq:tarRep}
|
||||
\forall x \,Restaurant(x) \Rightarrow \exists e \,Closed(e) \wedge ClosedThing(e,x)
|
||||
\end{equation}
|
||||
|
||||
The first step is to determine what the meaning representation of \textit{Every restaurant} should be. \textit{Every} is responsible for the $\forall$ quantifier and \textit{restaurant} specifies the category over which is quantified. This is called the ``restriction''\footnote{\cite{Jurafsky2009}, page 622} of the noun phrase. The meaning representation could be $\forall x\,Restaurant(x)$. It is a valid logical formula but it doesn't make much sense. ``It says that everything is a restaurant.''\footnote{\cite{Jurafsky2009}, page 622} ``Noun phrases like [this] are [usually] embedded in expressions that [say] something about the universally quantified variable. That is, we're probably trying to \textit{say something} about all restaurants. This notion is traditionally referred to as the \textit{NP}'s nuclear scope''\footnote{\cite{Jurafsky2009}, page 622}. In the given example, the nuclear scope is \textit{closed}. To represent this notion in the target representation, a dummy predicate $Q$ is added, which results in this expression:
|
||||
The first step is to determine what the meaning representation of \textit{Every restaurant} should be. \textit{Every} is responsible for the $\forall$ quantifier and \textit{restaurant} specifies the category over which is quantified. This is called the ``restriction''\cite[p.~622]{Jurafsky2009} of the noun phrase. The meaning representation could be $\forall x\,Restaurant(x)$. It is a valid logical formula but it doesn't make much sense. ``It says that everything is a restaurant.''\cite[p.~622]{Jurafsky2009} ``Noun phrases like [this] are [usually] embedded in expressions that [say] something about the universally quantified variable. That is, we're probably trying to \textit{say something} about all restaurants. This notion is traditionally referred to as the \textit{NP}'s nuclear scope''\cite[p.~622]{Jurafsky2009}. In the given example, the nuclear scope is \textit{closed}. To represent this notion in the target representation, a dummy predicate $Q$ is added, which results in this expression:
|
||||
\[
|
||||
\forall x\,Restaurant(x) \Rightarrow Q(x)
|
||||
\]
|
||||
@ -278,18 +280,34 @@
|
||||
\section{Critical discussion}
|
||||
\label{sec:critDiscussion}
|
||||
|
||||
Now that both methods have been presented with one selected approach each, it is time to discuss them critically. The CYK algorithm solves many problems like ambiguity; at least to a certain degree. But it also is problematic, because of the restriction to CNF. While in theory every context-free grammar can be converted to CNF, in practice it poses ``some non-trivial problems''\footnote{\cite{Jurafsky2009b}, page 475}. One of this problems can be explored in conjunction with the second presented method (semantic analysis). ``[T]he conversion to CNF will complicate any syntax-driven approach to semantic analysis''\footnote{\cite{Jurafsky2009b}, page 475}. A solution to this problem is some kind of post-processing in which the trees are converted back to the original grammar.\cite{Jurafsky2009b} Another option is to use a more complex dynamic programming algorithm that accepts any kind of context-free grammar. Such an algorithm is the ``Earley Algorithm''\footnote{\cite{Jurafsky2009b}, page 477}.
|
||||
Now that both methods have been presented with one selected approach each, it is time to discuss them critically. The CYK algorithm solves many problems like ambiguity; at least to a certain degree. But it also is problematic, because of the restriction to CNF. While in theory every context-free grammar can be converted to CNF, in practice it poses ``some non-trivial problems''\cite[p.~475]{Jurafsky2009b}. One of this problems can be explored in conjunction with the second presented method (semantic analysis). ``[T]he conversion to CNF will complicate any syntax-driven approach to semantic analysis''\cite[p.~475]{Jurafsky2009b}. A solution to this problem is some kind of post-processing in which the trees are converted back to the original grammar.\cite{Jurafsky2009b} Another option is to use a more complex dynamic programming algorithm that accepts any kind of context-free grammar. Such an algorithm is the ``Earley Algorithm''\cite[p.~477]{Jurafsky2009b}.
|
||||
|
||||
\begin{itemize}
|
||||
\item compares syntactic parsing and semantic analysis based on these criteria: meaning, complexity, usability for actual communication
|
||||
\end{itemize}
|
||||
The syntax-driven semantic analysis, as it has been presented, is a powerful method that is easy to understand. But it has one essential problem. It relies upon an existing set of grammar rules with semantic attachments to them. In a real world example such a table would contain thousands of grammar rules. While it is relatively easy to compute the final meaning representation with such a given table, it is very hard to create the table in the first place. The difficulty to create this table is split into two main issues. The first one being that you must find a grammar specification that fits all your use cases. This problem applies for the syntactic parsing as well. The second issue is that one has to find out the semantic attachments to the grammar rules.
|
||||
|
||||
This initial workload to create a state, in which the semantic analysis works, is a unique effort. In a restricted environment with a limited set of words and topics, this workload is of low importance. Even if it takes one month to create such a table by hand or by computing it, the subsequent analysis of input based on this table is rather quick and the initial workload is therefore acceptable. But this is only true for restricted environments. If someone tried to use syntax-driven semantic analysis for the complete language of modern English, the creation of such a table would outweigh any possible usage.
|
||||
|
||||
Comparing the complexity of the two methods it shows a mirror-like image. For the parsing the creation of the grammar is comparatively easy. The presented CYK algorithm works with context-free grammars which are a very restricted set compared to natural languages. But even within these context-free grammars there are ambiguities inside the texts themselves. The creation of the parse trees is therefore more of a problem.
|
||||
|
||||
Syntax-driven semantic analysis on the other hand requires a decent amount of work to add semantic attachments to grammar rules. But once this has been done, it works very fast.
|
||||
|
||||
Both methods require a unique work for one specific usage. This unique workload is the grammar creation for the parsing and the extension of the grammar with semantic attachments for the semantic analysis. The less restricted the usage environment, the more complex the initial workload becomes. The same is true for the recurring workload inside one specific usage.
|
||||
|
||||
Judging by the state-of-the-art of computer technology, parsing does still pose a significant challenge once the restricted field of programming languages is left. The semantic analysis as the second method in the chain has therefore even more problems to date. As the presented syntax-driven approach does only work with parse trees, a semantic analysis can only be undertaken once the syntactic parsing succeeds.
|
||||
|
||||
The ambiguity remains one of the bigges issues for both methods. Especially the syntax-driven semantic analysis does only consider the semantic meaning alone. It's not it's fault as the analysis doesn't know the context. The presented approach looks at each sentence in a sandbox. The generated meaning representations are therefore only of limited use for a less restricted grammar.
|
||||
|
||||
\section{Conclusion}
|
||||
\label{sec:concl}
|
||||
|
||||
\begin{itemize}
|
||||
\item
|
||||
\end{itemize}
|
||||
Syntactic parsing is an important method on the way to understand natural language. The usage of dynamic programming algorithms circumvents many of the issues that classical top-down or bottom-up parsing algorithms face. Ambiguity is the most prominent of those issues. The best algorithm for context-free grammars is the CYK algorithm, which is a dynamic programming algorithm. But in practice it is very restricted, because it only works with grammars in CNF. But there are more complex dynamic programming algorithms that allow any kind of context-free grammar.
|
||||
|
||||
Semantic analysis is the second method in the chain to understand natural language and therefore important as well. There are different approaches to the analysis. One of them is the syntax-driven approach that depends on parse trees. This dependency creates a delay effect: As long as a certain peace of text cannot be parsed, it definitely can't be analyzed for it's semantic meaning either. This is not an issue for restricted environments like programming languages or a very restricted subset of a natural language's grammar. But it is a major issue for real natural language, because there already the parsing does pose significant challenges.
|
||||
|
||||
Looking into the future both methods require substantial improvements on the algorithm side to reach a point where understanding non-restricted natural languages becomes possible. But as it is right now it is not possible to create dialog systems that interact fully natural with humans. To make any kind of language interaction, the set of possible words and sentence structures must be restricted. But even if that is given (like in a flight check-in automaton), the computer has only a finite set of possible cases. The programmer can add tons of if-clauses or comparable statements to check for different cases but in the end it's all finite so that many of the user inputs must lead to the same output or no output at all. This fact has led to the current situation in which the most interaction with a computer happens via a restricted interface in which the user can only choose from a limited set of options (by clicking on a button, selecting an item of a list, etc.).
|
||||
|
||||
In addition the ambiguity of natural language is a major issue. Going back to the example in the introduction, the syntax-driven semantic analysis does only work properly if the semantic meaning of the input has no ambiguity. But even than the generated meaning representation does not represent the pragmatic meaning. A dialog system is therefore far from being reached, because every input of a human can have dozens of different meanings. The intended meaning can sometimes depend on a thought that this human had while typing the input. As the computer doesn't have the ability to read thoughts, it would be impossible for the computer to determine the intended meaning of the input.
|
||||
|
||||
In a mission critical environment this ambiguity could lead to catastrophic results, because the computer, simply put, ``didn't get it''. This risk limits the usability of natural language communication with a computer for propably a long time to a very restricted set of use cases.
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% hier werden - zum Ende des Textes - die bibliographischen Referenzen
|
||||
|
||||
@ -13,131 +13,105 @@ Abgebende: Jim 2martens, Britta 2noack, Jan-Simon 0giesel
|
||||
; Die Rückgabe einer Liste mit dem Buchstaben an erster Stelle und einer
|
||||
; Liste als zweitem Element, die wiederum den Schlüssel an erster Stelle
|
||||
; enthält, erlaubt ein einfaches Auswerten der Zuordnung.
|
||||
(define (daten char)
|
||||
(case (char->integer char)
|
||||
([65] (list char 'Alfa))
|
||||
([66] (list char 'Bravo))
|
||||
([67] (list char 'Charlie))
|
||||
([68] (list char 'Delta))
|
||||
([69] (list char 'Echo))
|
||||
([70] (list char 'Foxtrott))
|
||||
([71] (list char 'Golf))
|
||||
([72] (list char 'Hotel))
|
||||
([73] (list char 'India))
|
||||
([74] (list char 'Juliett))
|
||||
([75] (list char 'Kilo))
|
||||
([76] (list char 'Lima))
|
||||
([77] (list char 'Mike))
|
||||
([78] (list char 'November))
|
||||
([79] (list char 'Oscar))
|
||||
([80] (list char 'Papa))
|
||||
([81] (list char 'Quebec))
|
||||
([82] (list char 'Romeo))
|
||||
([83] (list char 'Sierra))
|
||||
([84] (list char 'Tango))
|
||||
([85] (list char 'Uniform))
|
||||
([86] (list char 'Viktor))
|
||||
([87] (list char 'Whiskey))
|
||||
([88] (list char 'X-ray))
|
||||
([89] (list char 'Yankee))
|
||||
([90] (list char 'Zulu))
|
||||
([48] (list char 'Nadazero))
|
||||
([49] (list char 'Unaone))
|
||||
([50] (list char 'Bissotwo))
|
||||
([51] (list char 'Terrathree))
|
||||
([52] (list char 'Kartefour))
|
||||
([53] (list char 'Pantafive))
|
||||
([54] (list char 'Sosisix))
|
||||
([55] (list char 'Setteseven))
|
||||
([56] (list char 'Oktoeight))
|
||||
([57] (list char 'Novenine))
|
||||
([44] (list char 'Decimal))
|
||||
([46] (list char 'Stop))
|
||||
)
|
||||
)
|
||||
(define buchstabiertafel
|
||||
'((#\A . Alfa)
|
||||
(#\B . Bravo)
|
||||
(#\C . Charlie)
|
||||
(#\D . Delta)
|
||||
(#\E . Echo)
|
||||
(#\F . Foxtrott)
|
||||
(#\G . Golf)
|
||||
(#\H . Hotel)
|
||||
(#\I . India)
|
||||
(#\J . Juliett)
|
||||
(#\K . Kilo)
|
||||
(#\L . Lima)
|
||||
(#\M . Mike)
|
||||
(#\N . November)
|
||||
(#\O . Oscar)
|
||||
(#\P . Papa)
|
||||
(#\Q . Quebec)
|
||||
(#\R . Romeo)
|
||||
(#\S . Sierra)
|
||||
(#\T . Tango)
|
||||
(#\U . Uniform)
|
||||
(#\V . Viktor)
|
||||
(#\W . Whiskey)
|
||||
(#\X . X-ray)
|
||||
(#\Y . Yankee)
|
||||
(#\Z . Zulu)
|
||||
(#\0 . Nadazero)
|
||||
(#\1 . Unaone)
|
||||
(#\2 . Bissotwo)
|
||||
(#\3 . Terrathree)
|
||||
(#\4 . Kartefour)
|
||||
(#\5 . Pantafive)
|
||||
(#\6 . Sosisix)
|
||||
(#\7 . Setteseven)
|
||||
(#\8 . Oktoeight)
|
||||
(#\9 . Novenine)
|
||||
(#\, . Decimal)
|
||||
(#\. . Stop)
|
||||
))
|
||||
|
||||
; 1.2
|
||||
(define (char->schlüssel char)
|
||||
(car (cdr (daten char))))
|
||||
(define (char->schlüssel char tafel)
|
||||
(cdr (assoc (char->upper char) tafel)))
|
||||
|
||||
; 1.3
|
||||
(define char_to_upperCase (λ (myChar)
|
||||
; x als ASCII Wert für myChar definieren
|
||||
(define x (char->integer myChar))
|
||||
; y als x-32 definieren
|
||||
(define y (- x 32))
|
||||
; wenn x < 91 (bereits upperCase) myChar direkt zurückgeben
|
||||
(if (< x 91)
|
||||
; wenn myChar bereits upperCase ist, direkt zurückgeben
|
||||
myChar
|
||||
; andernfalls wird y zurückgegeben
|
||||
(when (> x 96)
|
||||
; y stellt den gleichen Buchstaben wie x dar, bloß in upperCase
|
||||
; daher wird y zurückgegeben
|
||||
(integer->char y)))))
|
||||
(define (char->upper char)
|
||||
(let ([charInt (char->integer char)])
|
||||
(cond ([<= 96 charInt 122] (integer->char (- charInt 32)))
|
||||
([<= 65 charInt 90] (integer->char charInt))
|
||||
(else char))))
|
||||
|
||||
; 1.4
|
||||
(define (buchstabiere text)
|
||||
(let ([xs (string->list text)])
|
||||
(if [empty? xs]
|
||||
'()
|
||||
(cons (char->schlüssel (char_to_upperCase(car xs))) (buchstabiere (list->string (cdr xs))))
|
||||
)
|
||||
))
|
||||
(define (buchstabiere text tafel)
|
||||
(letrec ((rec (λ (xs)
|
||||
(if (null? xs)
|
||||
null
|
||||
(cons (char->schlüssel (car xs) tafel)
|
||||
(rec (cdr xs)))))))
|
||||
(rec (string->list text))))
|
||||
|
||||
(require se3-bib/flaggen-module)
|
||||
; 2.1
|
||||
; Analoger Entwurf wie bei 1.1, diesmal mit den Flaggen.
|
||||
(define (flaggenData char)
|
||||
(case (char->integer char)
|
||||
([65] (list char A))
|
||||
([66] (list char B))
|
||||
([67] (list char C))
|
||||
([68] (list char D))
|
||||
([69] (list char E))
|
||||
([70] (list char F))
|
||||
([71] (list char G))
|
||||
([72] (list char H))
|
||||
([73] (list char I))
|
||||
([74] (list char J))
|
||||
([75] (list char K))
|
||||
([76] (list char L))
|
||||
([77] (list char M))
|
||||
([78] (list char N))
|
||||
([79] (list char O))
|
||||
([80] (list char P))
|
||||
([81] (list char Q))
|
||||
([82] (list char R))
|
||||
([83] (list char S))
|
||||
([84] (list char T))
|
||||
([85] (list char U))
|
||||
([86] (list char V))
|
||||
([87] (list char W))
|
||||
([88] (list char X))
|
||||
([89] (list char Y))
|
||||
([90] (list char Z))
|
||||
([48] (list char Z0))
|
||||
([49] (list char Z1))
|
||||
([50] (list char Z2))
|
||||
([51] (list char Z3))
|
||||
([52] (list char Z4))
|
||||
([53] (list char Z5))
|
||||
([54] (list char Z6))
|
||||
([55] (list char Z7))
|
||||
([56] (list char Z8))
|
||||
([57] (list char Z9))
|
||||
)
|
||||
)
|
||||
|
||||
; 2.2
|
||||
(define (char->flagge char)
|
||||
(car (cdr (flaggenData char))))
|
||||
|
||||
; 2.3
|
||||
(define (buchstabiereFlagge text)
|
||||
(let ([xs (string->list text)])
|
||||
(if [empty? xs]
|
||||
'()
|
||||
(cons (char->flagge (char_to_upperCase(car xs))) (buchstabiereFlagge (list->string (cdr xs))))
|
||||
)
|
||||
(define flaggentafel
|
||||
`((#\A . ,A)
|
||||
(#\B . ,B)
|
||||
(#\C . ,C)
|
||||
(#\D . ,D)
|
||||
(#\E . ,E)
|
||||
(#\F . ,F)
|
||||
(#\G . ,G)
|
||||
(#\H . ,H)
|
||||
(#\I . ,I)
|
||||
(#\J . ,J)
|
||||
(#\K . ,K)
|
||||
(#\L . ,L)
|
||||
(#\M . ,M)
|
||||
(#\N . ,N)
|
||||
(#\O . ,O)
|
||||
(#\P . ,P)
|
||||
(#\Q . ,Q)
|
||||
(#\R . ,R)
|
||||
(#\S . ,S)
|
||||
(#\T . ,T)
|
||||
(#\U . ,U)
|
||||
(#\V . ,V)
|
||||
(#\W . ,W)
|
||||
(#\X . ,X)
|
||||
(#\Y . ,Y)
|
||||
(#\Z . ,Z)
|
||||
(#\0 . ,Z0)
|
||||
(#\1 . ,Z1)
|
||||
(#\2 . ,Z2)
|
||||
(#\3 . ,Z3)
|
||||
(#\4 . ,Z4)
|
||||
(#\5 . ,Z5)
|
||||
(#\6 . ,Z6)
|
||||
(#\7 . ,Z7)
|
||||
(#\8 . ,Z8)
|
||||
(#\9 . ,Z9)
|
||||
))
|
||||
198
se3/G08_B04_Jim-2martens_Britta-2noack_Jan-Simon-0giesel.rkt
Normal file
198
se3/G08_B04_Jim-2martens_Britta-2noack_Jan-Simon-0giesel.rkt
Normal file
@ -0,0 +1,198 @@
|
||||
#lang racket
|
||||
|
||||
#|
|
||||
SE 3 Funktional Blatt 4
|
||||
Abgebende: Jim 2martens, Britta 2noack, Jan-Simon 0giesel
|
||||
|#
|
||||
|
||||
; 1)
|
||||
; 1. (max (min 2 (- 2 5)) 0) -> 0
|
||||
; zunächst wird (- 2 5) ausgeführt, was -3 ergibt
|
||||
; als nächstes wird (min 2 -3) ausgeführt, was -3 ergibt
|
||||
; dann kommt (max -3 0) mit dem Ergebnis 0
|
||||
; 2. '(+ (- 2 13) 2) -> (+ (- 2 13) 2)
|
||||
; das Quote verzögert die Auswertung, wodurch der Ausdruck nicht ausgewertet wird
|
||||
; 3. (cadr '(Alle Jahre wieder)) -> 'Jahre
|
||||
; zunächst wird (cdr '(Alle Jahre wieder)) ausgeführt mit dem Ergebnis '(Jahre wieder)
|
||||
; anschließend wird (car '(Jahre wieder)) mit dem Ergebnis 'Jahre ausgeführt
|
||||
; 4. (cddr '(kommt (das Weihnachtfest))) -> '()
|
||||
; zunächst wird (cdr '(kommt (das Weihnachtfest))) ausgeführt mit dem Ergebnis '((das Weihnachtfest))
|
||||
; anschließend wird (cdr '((das Weihnachtfest))) ausgeführt mit dem Ergebnis '()
|
||||
; dies liegt an der doppelt geschachtelten Liste:
|
||||
; (cons 'kommt (list (list 'das 'Weihnachtfest))) -> '(kommt (das Weihnachtfest))
|
||||
; 5. (cons 'Listen '(ganz einfach und)) -> '(Listen ganz einfach und)
|
||||
; da '(ganz einfach und) eine Liste ist, verkettet cons 'Listen schlichtweg mit der Liste
|
||||
; 6. (cons 'Paare 'auch) -> '(Paare . auch)
|
||||
; hier verkettet cons zwei einfache Elemente, wodurch ein Paar entsteht, welches keine Liste ist
|
||||
; 7. (equal? (list 'Racket 'Prolog 'Java) '(Racket Prolog Java)) -> #t
|
||||
; list erzeugt eine Liste mit den angegebenen Elementen und '(Racket Prolog Java) ist ebenfalls eine Liste mit den gleichen Elementen
|
||||
; 8. (eq? (list 'Racket 'Prolog 'Java) (cons 'Racket '(Prolog Java))) -> #f
|
||||
; list erzeugt wieder eine Liste und cons verknüpft hier ein einfaches Element mit einer Liste, wodurch wieder eine Liste entsteht;
|
||||
; allerdings sind die beiden Listen nicht identisch, aber genau das prüft eq?
|
||||
|
||||
; 2)
|
||||
; 1.
|
||||
; <notmeldung> ::= <ueberschrift><notfallort><notfallart><hilfeleistung><peilzeichen><unterschrift><over>
|
||||
; <ueberschrift> ::= <hierist><line-end><schiffname3mal><rufzeichen><line-end><summary><line-end>
|
||||
; <summary> ::= "MAYDAY "<schiffname>" ICH BUCHSTABIERE "<snamechars>" "<rufzeichen>
|
||||
; <snamechars> ::= <string>
|
||||
; <schiffname3mal>::= <schiffname>" "<schiffname>" "<schiffname>
|
||||
; <schiffname> ::= <word>
|
||||
; <notfallort> ::= <standort><zeitpunkt>
|
||||
; <notfallart> ::= <string><line-end>
|
||||
; <hilfeleistung> ::= <string><line-end><lines>
|
||||
; <peilzeichen> ::= "ICH SENDE DEN TRÄGER --"<line-end>
|
||||
; <unterschrift> ::= <word>" "<rufzeichen><line-end>
|
||||
; <rufzeichen> ::= <word>" "<word>" "<word>" "<word>
|
||||
; <lines> ::= <string><line-end> | <string><line-end><lines>
|
||||
; <standort> ::= "NOTALLPOSITION "<string><line-end>
|
||||
; <zeitpunkt> ::= "NOTFALLZEIT "<time>" UTC"<line-end>
|
||||
; <time> ::= <hour><minute>
|
||||
; <hour> ::= "0"<digit> | "1"<digit> | "2"<hdigit>
|
||||
; <minute> ::= "0"<digit> | "1"<digit> | "2"<digit> | "3"<digit> | "4"<digit> | "5"<digit>
|
||||
; <digit> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
|
||||
; <hdigit> ::= "0" | "1" | "2" | "3"
|
||||
; <string> ::= <word> | <word>" "<string>
|
||||
; <word> ::= <letter> | <letter><word>
|
||||
; <line-end> ::= <EOL>
|
||||
; <over> ::= "OVER"
|
||||
|
||||
; 2.2
|
||||
(define buchstabiertafel
|
||||
'((#\A . ALFA)
|
||||
(#\B . BRAVO)
|
||||
(#\C . CHARLIE)
|
||||
(#\D . DELTA)
|
||||
(#\E . ECHO)
|
||||
(#\F . FOXTROTT)
|
||||
(#\G . GOLF)
|
||||
(#\H . HOTEL)
|
||||
(#\I . INDIA)
|
||||
(#\J . JULIETT)
|
||||
(#\K . KILO)
|
||||
(#\L . LIMA)
|
||||
(#\M . MIKE)
|
||||
(#\N . NOVEMBER)
|
||||
(#\O . OSCAR)
|
||||
(#\P . PAPA)
|
||||
(#\Q . QUEBEC)
|
||||
(#\R . ROMEO)
|
||||
(#\S . SIERRA)
|
||||
(#\T . TANGO)
|
||||
(#\U . UNIFORM)
|
||||
(#\V . VIKTOR)
|
||||
(#\W . WHISKEY)
|
||||
(#\X . X-RAY)
|
||||
(#\Y . YANKEE)
|
||||
(#\Z . ZULU)
|
||||
(#\0 . NADAZERO)
|
||||
(#\1 . UNAONE)
|
||||
(#\2 . BISSOTWO)
|
||||
(#\3 . TERRATHREE)
|
||||
(#\4 . KARTEFOUR)
|
||||
(#\5 . PANTAFIVE)
|
||||
(#\6 . SOSISIX)
|
||||
(#\7 . SETTESEVEN)
|
||||
(#\8 . OKTOEIGHT)
|
||||
(#\9 . NOVENINE)
|
||||
(#\, . DECIMAL)
|
||||
(#\. . STOP)
|
||||
))
|
||||
|
||||
(define (char->schlüssel char tafel)
|
||||
(cdr (assoc (char->upper char) tafel)))
|
||||
|
||||
(define (char->upper char)
|
||||
(let ([charInt (char->integer char)])
|
||||
(cond ([<= 96 charInt 122] (integer->char (- charInt 32)))
|
||||
([<= 65 charInt 90] (integer->char charInt))
|
||||
(else char))))
|
||||
|
||||
(define (liste->string liste)
|
||||
(letrec ((rec (λ (string xs)
|
||||
(if (null? xs)
|
||||
string
|
||||
(if (empty? string)
|
||||
(rec (symbol->string (car xs)) (cdr xs))
|
||||
(rec (string-append string " " (symbol->string (car xs))) (cdr xs)))))))
|
||||
|
||||
(rec "" liste)))
|
||||
|
||||
(define (buchstabiere text tafel)
|
||||
(letrec ((rec (λ (xs)
|
||||
(if (null? xs)
|
||||
null
|
||||
(cons (char->schlüssel (car xs) tafel)
|
||||
(rec (cdr xs)))))))
|
||||
(liste->string (rec (string->list text)))))
|
||||
|
||||
|
||||
|
||||
(define mayday "MAYDAY")
|
||||
(define notposition "NOTFALLPOSITION")
|
||||
(define notzeit "NOTFALLZEIT")
|
||||
(define space " ")
|
||||
(define linebreak "\n")
|
||||
(define hierist "HIER IST")
|
||||
(define buchstabieren "ICH BUCHSTABIERE")
|
||||
(define ruf "RUFZEICHEN")
|
||||
(define senden "ICH SENDE DEN TRÄGER --")
|
||||
|
||||
(define (generiereNotmeldung schiffname rufzeichen position weitereAngaben)
|
||||
(display (string-append mayday space mayday space mayday linebreak
|
||||
hierist linebreak
|
||||
schiffname space schiffname space schiffname (buchstabiere rufzeichen buchstabiertafel) linebreak
|
||||
mayday space schiffname space buchstabieren (buchstabiere schiffname buchstabiertafel) (buchstabiere rufzeichen buchstabiertafel) linebreak
|
||||
ruf (buchstabiere rufzeichen buchstabiertafel) linebreak
|
||||
notposition space position linebreak
|
||||
weitereAngaben
|
||||
senden linebreak
|
||||
schiffname (buchstabiere rufzeichen buchstabiertafel) linebreak
|
||||
"OVER")))
|
||||
; 2.3
|
||||
(display "BABETTE:\n")
|
||||
(generiereNotmeldung "BABETTE" "DEJY" "UNGEFÄHR 10 SM NORDÖSTLICH LEUCHTTURM KIEL" "SCHWERER WASSEREINBRUCH WIR SINKEN\nKEINE VERLETZTEN\nVIER MANN GEHEN IN DIE RETTUNGSINSEL\nSCHNELLE HILFE ERFORDERLICH\n")
|
||||
(display "\n\nAMIRA:\n")
|
||||
(generiereNotmeldung "AMIRA" "AMRY" "57°46'N, 006°31'E\nNOTFALLZEIT 0640 UTC" "KENTERUNG WIR SINKEN\n9 MANN AN BORD\nSCHIFF 15 M LANG\nGRÜNER RUMPF\n")
|
||||
|
||||
; 3)
|
||||
; bei innerer Reduktion werden die Terme von innen nach außen reduziert
|
||||
; bei äußerer Reduktion werden die Terme von außen nach innen reduziert
|
||||
; innere Reduktion:
|
||||
; (hoch3 (* 3 (+ 1 (hoch3 2))))
|
||||
; -> (hoch3 (* 3 (+ 1 (* 2 2 2)))) ; (hoch3)
|
||||
; -> (hoch3 (* 3 (+ 1 8))) ; (*)
|
||||
; -> (hoch3 (* 3 9)) ; (+)
|
||||
; -> (hoch3 27) ; (*)
|
||||
; -> (* 27 27 27) ; (hoch3)
|
||||
; -> 19683 ; (*)
|
||||
; äußere Reduktion:
|
||||
; (* (* 3 (+ 1 (hoch3 2))) (* 3 (+ 1 (hoch3 2))) (* 3 (+ 1 (hoch3 2)))) ; (hoch3)
|
||||
; -> (* (* 3 (+ 1 (* 2 2 2))) (* 3 (+ 1 (hoch3 2))) (* 3 (+ 1 (hoch3 2)))) ; (hoch3)
|
||||
; -> (* (* 3 (+ 1 8)) (* 3 (+ 1 (hoch3 2))) (* 3 (+ 1 (hoch3 2)))) ; (*)
|
||||
; -> (* (* 3 9) (* 3 (+ 1 (hoch3 2))) (* 3 (+ 1 (hoch3 2)))) ; (+)
|
||||
; -> (* 27 (* 3 (+ 1 (hoch3 2))) (* 3 (+ 1 (hoch3 2)))) ; (*)
|
||||
; -> (* 27 (* 3 (+ 1 (* 2 2 2))) (* 3 (+ 1 (hoch3 2)))) ; (hoch3)
|
||||
; -> (* 27 (* 3 (+ 1 8)) (* 3 (+ 1 (hoch3 2)))) ; (*)
|
||||
; -> (* 27 (* 3 9) (* 3 (+ 1 (hoch3 2)))) ; (+)
|
||||
; -> (* 27 27 (* 3 (+ 1 (hoch3 2)))) ; (*)
|
||||
; -> (* 27 27 (* 3 (+ 1 (* 2 2 2)))) ; (hoch3)
|
||||
; -> (* 27 27 (* 3 (+ 1 8))) ; (*)
|
||||
; -> (* 27 27 (* 3 9)) ; (+)
|
||||
; -> (* 27 27 27) ; (*)
|
||||
; -> 19683 ; (*)
|
||||
|
||||
; In Racket wird die strikte innere Reduktion für Funktionen angewendet.
|
||||
; Für Spezialformen wird je nach Spezialform eine andere Strategie angewendet.
|
||||
; Allgemein kann jedoch gesagt werden, dass dort von außen nach innen gegangen wird.
|
||||
|
||||
; Wenn Alyssa das Programm benutzt, dann entsteht eine Endlosschleife, da
|
||||
; cond aufgrund der inneren Reduktion niemals aufgerufen wird. Pro Rekursionsaufruf
|
||||
; werden zunächst alle drei Parameter ausgewertet. Ab dem fünften Rekursionsschritt
|
||||
; wird (> counter max-count) zwar zu false ausgewertet, aber erst wenn der faculty
|
||||
; Aufruf komplett ausgewertet ist, wird new-if aufgerufen. Da in jedem Rekursionsschritt
|
||||
; faculty aufgerufen wird, entsteht eine Endlosschleife.
|
||||
|
||||
; Anhand dieses Beispiels wird deutlich, dass zunächst die Bedingung ausgewertet werden muss
|
||||
; und abhängig von dieser dann entweder nur die then-clause oder nur die else-clause. Bei jeder Rekursion
|
||||
; muss dies passieren, da sonst die Abbruchbedingung nie zum Abbruch führt.
|
||||
220
se3/G08_B05_Jim-2martens_Britta-2noack_Jan-Simon-0giesel.rkt
Normal file
220
se3/G08_B05_Jim-2martens_Britta-2noack_Jan-Simon-0giesel.rkt
Normal file
@ -0,0 +1,220 @@
|
||||
#lang racket
|
||||
|
||||
#|
|
||||
SE 3 Funktional Blatt 5
|
||||
Abgebende: Jim 2martens, Britta 2noack, Jan-Simon 0giesel
|
||||
|#
|
||||
|
||||
; 1)
|
||||
; Folgende Teilprobleme sind zu lösen:
|
||||
; - bestimmen der rezessiven Merkmale des Vaters
|
||||
; - bestimmen der rezessiven Merkmale der Mutter
|
||||
; - bestimmen der vererbten Merkmale des Vaters
|
||||
; - bestimmen der vererbten Merkmale der Mutter
|
||||
; - bestimmen der sichtbaren Merkmale von Kindern
|
||||
; - anzeigen eines Schmetterlings
|
||||
; - bestimmen von beliebig vielen Kindern
|
||||
|
||||
; Das Programm hat die Hauptfunktion mendel, die als Parameter die dominanten
|
||||
; Merkmale des Vaters und der Mutter, sowie die Anzahl der Kinder bekommt.
|
||||
|
||||
; Davon ausgehend werden dann zufällig die rezessiven Merkmale des Vaters bzw. der Mutter
|
||||
; gewählt. Dafür wird eine Funktion randomRezessiv benötigt, die ebendies bewerkstelligt.
|
||||
|
||||
; randomRezessiv greift auf die Dominanzliste zurück. Dafür wird eine Zugriffsfunktion
|
||||
; key->wert benutzt. Zusätzlich wird eine Hilfsfunktion (randomList) benutzt, um
|
||||
; von der Liste der dominierten Merkmale ein zufälliges Merkmal auszuwählen.
|
||||
|
||||
; randomSelection wählt aus gegebenen dominanten und rezessiven Merkmalen zufällig eine Liste
|
||||
; an Merkmalen aus, die dann die vererbten Merkmale darstellen.
|
||||
|
||||
; sichtbar ermittelt bei gegebenen Merkmalen des Vaters und der Mutter
|
||||
; die sichtbaren Elemente.
|
||||
|
||||
; zeigeSchmetterling zeigt einen Schmetterling bei gegebenen Merkmalen in einer Liste an.
|
||||
|
||||
; Die Datenstruktur zum Speichern des Genoms ist sehr einfach:
|
||||
; Es ist eine Liste von Listen, deren erstes Element jeweils ein Merkmal darstellt
|
||||
; und deren zweites Element jeweils eine Liste von Merkmalen darstellt,
|
||||
; die von dem Merkmal an erster Stelle dominiert werden.
|
||||
|
||||
; Durch diesen Entwurf lassen sich die Teilprobleme leicht lösen und es
|
||||
; wird eine optimale Anzahl an Funktionen erreicht, die nicht mehr aber auch
|
||||
; nicht weniger machen, als benötigt wird.
|
||||
|
||||
; Datenstruktur der Dominanzabhängigkeiten, wobei der Wert immer eine Liste
|
||||
; all jener Merkmale ist, die von dem key dominiert werden
|
||||
(define dominanzliste
|
||||
'((punkte . (streifen sterne))
|
||||
(streifen . (sterne))
|
||||
(sterne . (sterne))
|
||||
(rot . (gruen blau gelb))
|
||||
(gruen . (blau gelb))
|
||||
(blau . (gelb))
|
||||
(gelb . (gelb))
|
||||
(gerade . (gekruemmt geschweift))
|
||||
(gekruemmt . (geschweift))
|
||||
(geschweift . (geschweift))
|
||||
(rhombisch . (hexagonal elliptisch))
|
||||
(hexagonal . (elliptisch))
|
||||
(elliptisch . (elliptisch))
|
||||
))
|
||||
|
||||
; Datenstruktur für Übersetzung, um show-butterfly korrekt aufzurufen
|
||||
(define translationlist
|
||||
'((punkte . dots)
|
||||
(streifen . stripes)
|
||||
(sterne . stars)
|
||||
(rot . red)
|
||||
(gruen . green)
|
||||
(blau . blue)
|
||||
(gelb . yellow)
|
||||
(gerade . straight)
|
||||
(gekruemmt . curved)
|
||||
(geschweift . curly)
|
||||
(rhombisch . rhomb)
|
||||
(hexagonal . hexagon)
|
||||
(elliptisch . ellipse)
|
||||
))
|
||||
|
||||
; gibt den Wert von key in tafel zurück
|
||||
(define (key->wert key tafel)
|
||||
(cdr (assoc key tafel)))
|
||||
|
||||
; wählt ein zufälliges Element einer Liste aus
|
||||
(define (randomListe xs)
|
||||
(car (shuffle xs)))
|
||||
|
||||
; wählt zu einer gegebenen Liste an dominanten Merkmalen die rezessiven Merkmale aus
|
||||
(define (randomRezessiv dominant)
|
||||
(letrec ((help (λ (xs result)
|
||||
(if (empty? xs)
|
||||
result
|
||||
(help
|
||||
(cdr xs)
|
||||
(cons
|
||||
(randomListe (key->wert (car xs) dominanzliste))
|
||||
result
|
||||
))
|
||||
))))
|
||||
(reverse (help dominant '()))))
|
||||
|
||||
; wählt von den gegebenen Elementen zufällig eines aus
|
||||
(define (randomElement x y)
|
||||
(let ((r (random 2)))
|
||||
(if (= r 0)
|
||||
x
|
||||
y)))
|
||||
|
||||
; wählt aus der Liste der dominanten und rezessiven Merkmale zufällig
|
||||
; Merkmale aus
|
||||
(define (randomSelection dominant rezessiv)
|
||||
(letrec ((select (λ (xs ys result)
|
||||
(if (empty? xs)
|
||||
result
|
||||
(select (cdr xs) (cdr ys) (cons (randomElement (car xs) (car ys))
|
||||
result))
|
||||
))))
|
||||
(reverse (select dominant rezessiv '()))))
|
||||
|
||||
; bestimmt aus den zufälligen Merkmalen des Vaters und der Mutter die sichtbaren Elemente
|
||||
; beim Kind
|
||||
(define (sichtbar vaterMerkmale mutterMerkmale)
|
||||
(letrec ((rec (λ (xs ys result)
|
||||
(if (empty? xs)
|
||||
result
|
||||
(if (empty? (filter (λ (x) (equal? x (car ys))) (key->wert (car xs) dominanzliste)))
|
||||
(rec (cdr xs) (cdr ys) (cons (car ys) result))
|
||||
(rec (cdr xs) (cdr ys) (cons (car xs) result))
|
||||
)))))
|
||||
(reverse (rec vaterMerkmale mutterMerkmale '()))))
|
||||
|
||||
(require se3-bib/butterfly-module)
|
||||
|
||||
(define (zeigeSchmetterling merkmale)
|
||||
(show-butterfly (key->wert (cadr merkmale) translationlist)
|
||||
(key->wert (car merkmale) translationlist)
|
||||
(key->wert (caddr merkmale) translationlist)
|
||||
(key->wert (cadddr merkmale) translationlist)
|
||||
))
|
||||
; zeigt (in dieser Reihenfolge) den Vater, die Mutter und die Kinder
|
||||
(define (mendel vaterDominant mutterDominant anzahlKinder)
|
||||
(let ((vaterRezessiv (randomRezessiv vaterDominant))
|
||||
(mutterRezessiv (randomRezessiv mutterDominant))
|
||||
)
|
||||
(letrec ((rec (λ (counter result)
|
||||
(if (= 0 counter)
|
||||
result
|
||||
(rec (- counter 1)
|
||||
(cons (sichtbar
|
||||
(randomSelection vaterDominant vaterRezessiv)
|
||||
(randomSelection mutterDominant mutterRezessiv))
|
||||
result))))))
|
||||
(map zeigeSchmetterling (cons vaterDominant (cons mutterDominant (rec anzahlKinder '()))))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
; Austesten des Falles von einem Vater, der als dominante Merkmale die absolut
|
||||
; dominantesten Merkmale hat und einer Mutter, die als dominante Merkmale die absolut
|
||||
; schwächsten Merkmale hat
|
||||
|
||||
; diese Daten testen einen möglichen Extremfall
|
||||
; bei diesem Fall sind die vererbten Merkmale der Mutter immer dieselben
|
||||
; ein Merkmal der Mutter wird sich daher nur durchsetzen, wenn der Vater dies als
|
||||
; rezessives Merkmal hat und das rezessive Merkmal vom Vater vererbt wird
|
||||
(mendel '(punkte rot gerade rhombisch) '(sterne gelb geschweift elliptisch) 2)
|
||||
|
||||
; Austesten des Falles, dass sowohl Vater als auch Mutter die schwächsten Merkmale
|
||||
; als dominante Merkmale haben
|
||||
; bei diesem Extremfall sehen die Kinder genau gleich aus (alle von 1 bis n)
|
||||
(mendel '(sterne gelb geschweift elliptisch) '(sterne gelb geschweift elliptisch) 2)
|
||||
|
||||
; Austesten des Falles, dass beide Elternteile die dominantesten Merkmale
|
||||
; als dominante Merkmale haben. Die Kinder können hier die größten Unterschiede aufweisen.
|
||||
; In den meisten Fällen werden sie aber so aussehen, wie die Eltern.
|
||||
(mendel '(punkte rot gerade rhombisch) '(punkte rot gerade rhombisch) 2)
|
||||
|
||||
; 2)
|
||||
; überprüft, ob ein Element in einer Liste ist
|
||||
(define (in-list? element list)
|
||||
(if (pair? (member element list))
|
||||
#t
|
||||
#f))
|
||||
|
||||
(define erbbarliste
|
||||
'((punkte . (punkte streifen sterne))
|
||||
(streifen . (streifen sterne))
|
||||
(sterne . (sterne))
|
||||
(rot . (rot gruen blau gelb))
|
||||
(gruen . (gruen blau gelb))
|
||||
(blau . (blau gelb))
|
||||
(gelb . (gelb))
|
||||
(gerade . (gerade gekruemmt geschweift))
|
||||
(gekruemmt . (gekruemmt geschweift))
|
||||
(geschweift . (geschweift))
|
||||
(rhombisch . (rhombisch hexagonal elliptisch))
|
||||
(hexagonal . (hexagonal elliptisch))
|
||||
(elliptisch . (elliptisch))
|
||||
))
|
||||
|
||||
; überprüft, ob das Kind von den Eltern abstammen kann
|
||||
(define (testeElternschaft sichtbarVater sichtbarMutter sichtbarKind)
|
||||
(letrec ((rec (λ (xs ys zs valid)
|
||||
(if (or (not valid) (empty? xs))
|
||||
valid
|
||||
(rec (cdr xs)
|
||||
(cdr ys)
|
||||
(cdr zs)
|
||||
(or (in-list? (car zs) (key->wert (car xs) erbbarliste))
|
||||
(in-list? (car zs) (key->wert (car ys) erbbarliste))
|
||||
))
|
||||
))))
|
||||
(rec sichtbarVater sichtbarMutter sichtbarKind #t)))
|
||||
|
||||
(display "\nKönnen Anton und Antonia die Eltern von Toni sein:")
|
||||
(testeElternschaft '(sterne gruen geschweift rhombisch) '(streifen blau gekruemmt hexagonal) '(sterne rot gekruemmt rhombisch))
|
||||
(display "\nKönnen Anton und Antonia die Eltern von Tini sein:")
|
||||
(testeElternschaft '(sterne gruen geschweift rhombisch) '(streifen blau gekruemmt hexagonal) '(punkte gruen gerade rhombisch))
|
||||
(display "\nKönnen Anton und Antonia die Eltern von Tina sein:")
|
||||
(testeElternschaft '(sterne gruen geschweift rhombisch) '(streifen blau gekruemmt hexagonal) '(streifen gelb geschweift elliptisch))
|
||||
115
se3/G08_B06_Jim-2martens_Britta-2noack_Jan-Simon-0giesel.rkt
Normal file
115
se3/G08_B06_Jim-2martens_Britta-2noack_Jan-Simon-0giesel.rkt
Normal file
@ -0,0 +1,115 @@
|
||||
#lang racket
|
||||
|
||||
#|
|
||||
SE 3 Funktional Blatt 6
|
||||
Abgebende: Jim 2martens, Britta 2noack, Jan-Simon 0giesel
|
||||
|#
|
||||
|
||||
; 1)
|
||||
;
|
||||
; kopfstueck ist eine lineare Rekursion, da pro else-Aufruf,
|
||||
; die Funktion nur einmal sich selbst aufruft.
|
||||
; Daher kann kopfstueck keine Baumrekursion sein.
|
||||
; kopfstueck wird auch nicht als Argument für kopfstueck verwendet,
|
||||
; womit auch geschachtelte Rekursion mit nein zu beantworten ist.
|
||||
; Da sich kopfstueck direkt rekursiv aufruft, ist es eine direkte
|
||||
; und keine indirekte Rekursion.
|
||||
|
||||
; endstueck ist ebenso linear, keine Baumrekursion, keine geschachtelte
|
||||
; Rekursion, eine direkte Rekursion und keine indirekte Rekursion.
|
||||
|
||||
; merge ist eine lineare Rekursion, da pro Fallunterscheidung
|
||||
; merge nur einmal aufgerufen wird. Demnach ist es keine Baumrekursion.
|
||||
; Es ist ebenso wenig eine geschachtelte Rekursion, da es sich selbst
|
||||
; nicht als Argument übergeben wird.
|
||||
; merge ist eine direkte Rekursion, da es sich direkt aufruft.
|
||||
; Deswegen ist merge keine indirekte Rekursion.
|
||||
|
||||
; merge-sort ist keine lineare Rekursion, da es in jeder Fallunterscheidung
|
||||
; zweimal aufgerufen wird. merge-sort ist keine geschachtelte Rekursion,
|
||||
; da es sich selbst nicht als Argument übergeben wird.
|
||||
; merge-sort ist eine direkte Rekursion, da es sich direkt aufruft.
|
||||
; Demnach ist merge-sort keine indirekte Rekursion.
|
||||
|
||||
; ___________________________________________________________________________________________________________________
|
||||
; | | lineare Rekursion | Baumrekursion | geschachtelte Rekursion | direkte Rekursion | indirekte Rekursion|
|
||||
; |____________|___________________|_______________|_________________________|___________________|____________________|
|
||||
; | kopfstueck | ja | nein | nein | ja | nein |
|
||||
; | endstueck | ja | nein | nein | ja | nein |
|
||||
; | merge | ja | nein | nein | ja | nein |
|
||||
; | merge-sort | nein | ja | nein | ja | nein |
|
||||
; --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
; 2)
|
||||
(require 2htdp/image)
|
||||
(require lang/posn)
|
||||
|
||||
; erzeugt einen Tannenbaum mit n Ebenen
|
||||
(define (tannenbaum n)
|
||||
(letrec ((leaves (λ (width x result)
|
||||
(if [= x 0]
|
||||
result
|
||||
; rekursiver Aufruf, um die nächsthöhere Ebene zu generieren
|
||||
(leaves
|
||||
(/ width 1.5)
|
||||
(- x 1)
|
||||
(cons
|
||||
; erzeugt ein Trapez, welches als eine Ebene fungiert
|
||||
(polygon
|
||||
(list (make-posn 0 0)
|
||||
(make-posn width 0)
|
||||
(make-posn (+ (/ width 2) (* (/ width 2) 0.2)) (* -1 (/ width 4)))
|
||||
(make-posn (- (/ width 2) (* (/ width 2) 0.2)) (* -1 (/ width 4))))
|
||||
"solid"
|
||||
"darkgreen")
|
||||
result)))
|
||||
)))
|
||||
; Anwenden von above/align auf alle Blätter, den Stamm und den Stern
|
||||
(apply above/align
|
||||
(cons "center"
|
||||
(cons (star-polygon 20 5 2 "solid" "gold")
|
||||
(leaves 180 n `(,(rectangle 30 30 "solid" "brown") . ()))
|
||||
)))
|
||||
|
||||
))
|
||||
|
||||
; erzeugt einen Monitor
|
||||
(define (monitor content)
|
||||
(above/align
|
||||
"center"
|
||||
(overlay
|
||||
(text content 24 "red")
|
||||
(rectangle 160 90 "solid" "blue")
|
||||
(rectangle 165 95 "solid" "gray")
|
||||
)
|
||||
(polygon
|
||||
(list (make-posn 0 0)
|
||||
(make-posn 80 0)
|
||||
(make-posn 55 -10)
|
||||
(make-posn 25 -10))
|
||||
"solid"
|
||||
"gray")
|
||||
))
|
||||
|
||||
; erzeugt ein Star Citizen Poster
|
||||
(define scPoster (overlay
|
||||
(above
|
||||
(text "Star Citizen" 34 "gold")
|
||||
(text "Squadron 42" 28 "gold"))
|
||||
(rectangle 185 85 "solid" "royalblue")
|
||||
(rectangle 200 100 "solid" "black")))
|
||||
|
||||
; linker Tannenbaum
|
||||
(display (tannenbaum 8))
|
||||
; Monitor
|
||||
(display (monitor "cout << 0x2a;"))
|
||||
; Abstand zwischen Monitor und Poster
|
||||
(display " ")
|
||||
; Star Citizen Poster
|
||||
(display scPoster)
|
||||
; Abstand zwischen Monitor und Poster
|
||||
(display " ")
|
||||
; Monitor
|
||||
(display (monitor "6.12.13"))
|
||||
; rechter Tannenbaum
|
||||
(display (tannenbaum 8))
|
||||
136
sonstiges/Wordpress-Vortrag.tex
Normal file
136
sonstiges/Wordpress-Vortrag.tex
Normal file
@ -0,0 +1,136 @@
|
||||
\documentclass{beamer}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage[ngerman]{babel}
|
||||
%\usepackage{paralist}
|
||||
\useoutertheme{infolines}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{hyperref}
|
||||
\usepackage{listings}
|
||||
\usetheme{Berkeley}
|
||||
\pagenumbering{arabic}
|
||||
\def\thesection{\arabic{section})}
|
||||
\def\thesubsection{\alph{subsection})}
|
||||
\def\thesubsubsection{(\roman{subsubsection})}
|
||||
\setbeamertemplate{navigation symbols}{}
|
||||
\graphicspath{ {src/} }
|
||||
\lstset{language=PHP}
|
||||
|
||||
\begin{document}
|
||||
\author{Jim Martens}
|
||||
\title{Warum sich ein eigenes CMS lohnt}
|
||||
|
||||
\section{Situation}
|
||||
\begin{frame}{Situation}
|
||||
\begin{itemize}
|
||||
\item Wordpress erhielt 2009 den Overall Best Open Source CMS Award
|
||||
\item 2010 folgte Hall of Fame CMS
|
||||
\item gilt als eines der beliebtesten CMS weltweit
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}
|
||||
\centering
|
||||
Warum man dennoch ein eigenes CMS schreiben sollte?
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}[fragile]{Darum}
|
||||
aus wp-login.php Zeile 207 ff. (etwas HTML ausgelassen, gekennzeichnet durch Kommentar)
|
||||
\begin{lstlisting}
|
||||
function login_footer($input_id = '') {
|
||||
global $interim_login;
|
||||
if ( ! $interim_login ): ?>
|
||||
<p id="backtoblog"><!-- something --></p>
|
||||
<?php endif; ?>
|
||||
\end{lstlisting}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}
|
||||
\centering
|
||||
Warum ist der gezeigte Code nicht so toll?
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}{Deswegen}
|
||||
\begin{itemize}
|
||||
\item \texttt{global} is Bad Practice
|
||||
\begin{itemize}
|
||||
\item stammt aus PHP 4 Zeiten
|
||||
\item nicht objektorientiert
|
||||
\end{itemize}
|
||||
\item keine Trennung zwischen Businesslogik und Ausgabe
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\section{Verbesserung}
|
||||
\begin{frame}
|
||||
\centering
|
||||
Wie kann man es besser machen?
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}{So kann man es besser machen}
|
||||
\begin{itemize}
|
||||
\item OOP-Framework wie Symfony 2 nutzen
|
||||
\begin{itemize}
|
||||
\item[$\rightarrow$] klare Trennung zwischen Businesslogik und Ausgabe
|
||||
\item[$\rightarrow$] Object-Relational Mapping (Doctrine)
|
||||
\item[$\rightarrow$] Templateengine (Twig)
|
||||
\item[$\rightarrow$] Dependency Management (Composer)
|
||||
\item[$\rightarrow$] einfache Konfigurierbarkeit
|
||||
\item[$\rightarrow$] Unterstützung für Unit- und Integrationstests (PHPUnit)
|
||||
\item[$\rightarrow$] hohe Code Coverage der Unittests
|
||||
\end{itemize}
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\section{Call for Action}
|
||||
\begin{frame}
|
||||
\centering
|
||||
Warum erzähle ich euch das eigentlich alles?
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}{Planung}
|
||||
\begin{itemize}
|
||||
\item habe bereits ein CMS auf Basis des WoltLab Community Framework (WCF) entwickelt
|
||||
\item das wird vsl. Januar/Februar RC-Status erreichen (Betaseite: beta.plugins-zum-selberbauen.de)
|
||||
\item nächstes Projekt: WCF-Funktionen mit Symfony mergen
|
||||
\begin{itemize}
|
||||
\item ACP, Paketsystem, einfache Installation
|
||||
\item Mehrsprachigkeit, User und Benutzergruppen
|
||||
\item flexibles Stilsystem, Event Listener
|
||||
\end{itemize}
|
||||
\item und dann, ja dann: CMS mit Symfony und WCF-Erweiterungen
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}
|
||||
\centering
|
||||
Warum interessiert euch das?
|
||||
\end{frame}
|
||||
|
||||
\begin{frame}{Anforderungsprofil}
|
||||
\begin{itemize}
|
||||
\item praktische Erfahrung sammeln mit OOP-Entwicklung
|
||||
\item Voraussetzungen: PHP-Kenntnis (>= 5.3), OOP-Kenntnis, Bereitschaft sich einzuarbeiten, Coding-Standards einhalten
|
||||
\item Git als VCS (github.com/frmwrk123/symfony-wcf)
|
||||
\item Lizenz: LGPL
|
||||
\item keine Zeitvorgabe - it's done when it's done
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\section{Fertig}
|
||||
\begin{frame}{Ich habe fertig}
|
||||
\centering
|
||||
Vielen Dank für Eure Aufmerksamkeit!
|
||||
\end{frame}
|
||||
|
||||
|
||||
\section{Quellen}
|
||||
\begin{frame}{Quellen}
|
||||
\begin{itemize}
|
||||
\item http://webdesign.about.com/b/2010/11/22/wordpress-wins-best-cms-award.html
|
||||
\item http://wordpress.org/news/2009/11/wordpress-wins-cms-award/
|
||||
\item http://symfony.com/doc/master
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
\end{document}
|
||||
Reference in New Issue
Block a user