1
0
mirror of https://github.com/2martens/uni.git synced 2026-05-06 19:36:26 +02:00

20 Commits

Author SHA1 Message Date
dad77a8dff MATH2-Inf-10: Blatt 10 Aufgabe 2 komplett bearbeitet. 2013-12-18 15:19:22 +01:00
d013e0533e AD-5: usepackage-Statement verschoben. 2013-12-18 14:27:56 +01:00
5bdf5a2487 Added *.pyg files to gitignore. 2013-12-18 14:27:30 +01:00
f5e1a36683 finished 4 and 5, used minted instead of verbatim to find out if it looks nice 2013-12-17 22:56:18 +01:00
6507d7a749 AD-5: Laufzeit in 4b ergänzt. 2013-12-17 20:32:10 +01:00
eb6256a57f Fehlende Aufgaben bearbeitet
* G.wurzel in G.root geändert
* 4b, 5a und 5b bearbeitet
2013-12-17 20:30:01 +01:00
a324b8291d AD-5: Aufgabe 6 angepasst. 2013-12-17 16:39:37 +01:00
6afc457d64 AD-5: Aufgabe 6 bearbeitet. 2013-12-17 11:51:54 +01:00
f768bb15bf AD-5: 4a verbessert. 2013-12-17 11:00:22 +01:00
f589ab47c7 MATH2-Inf-9: Blatt 9 Augabe 1a korrigiert. 2013-12-16 20:32:04 +01:00
2b0d06f6ea MATH2-Inf-8: Blatt 8 korrigiert. 2013-12-16 20:31:50 +01:00
300490a93b AD-5: Aufgabe 4a mit Pseudocode ergänzt. 2013-12-15 12:50:47 +01:00
abf82e25d7 AD-5: Aufgabe 4a bearbeitet. 2013-12-14 16:16:12 +01:00
d7c4eed8f1 SE3-7: Aufgabe 2.4 korrigiert. 2013-12-14 11:15:13 +01:00
36556eb9b4 AD-5: Aufgaben 1-3 bearbeitet. 2013-12-12 18:04:45 +01:00
a051729612 GDB-4: Aufgabe 2 korrigiert. 2013-12-12 16:01:41 +01:00
3b2a28a11d GDB-4: Aufgabe 4 korrigiert. 2013-12-12 15:34:07 +01:00
9913b6fc95 SE3: Blatt 7 ohne Zusatzaufgabe bearbeitet. 2013-12-12 15:23:44 +01:00
7818e3b603 MATH2-Inf-9: Aufgabenblatt komplett bearbeitet. 2013-12-11 17:08:35 +01:00
88562703a2 MK: Feedback ergänzt. 2013-12-10 11:54:53 +01:00
8 changed files with 1202 additions and 18 deletions

1
.gitignore vendored
View File

@ -26,6 +26,7 @@
*.pdf
*.pdfsync
*.ps
*.pyg
*.snm
*.synctex.gz
*.toc

View File

@ -0,0 +1,300 @@
\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}
\usepackage{minted}
\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
Dieser folgende Pseudocode beschreibt eine leichte Abänderung, die vorzeitig abbricht, wenn sich nach einem kompletten Durchlauf aller Kanten nichts geändert hat. Nach $m$ Durchläufen hat der Algorithmus alle kürzeste Pfade mit maximal $m$ Kanten entdeckt. In einem weiteren Durchlauf wird sich dann nichts mehr ändern, da keine neuen kürzesten Pfade mehr gefunden werden können, wodurch die geänderte Variante abbricht. Um die Abbruchbedingung zu erreichen muss $m$ nicht bekannt sein, da nach $m+1$ Durchläufen die Abbruchbedingung immer gegeben ist.
\begin{minted}{python}
function BellmanFord(G,s)
InitializeSingleSource(G,s)
for i = 1, ... |V| - 1
changed = false
for all edges (u,v) in E
changedTmp = Relax(u,v)
if (!changed)
changed = changedTmp
if (!changed)
break
for all edges (u,v) in E
if v.dist > u.dist + w(u,v)
return false
return true
\end{minted}
% \begin{verbatim}
% function BellmanFord(G,s)
% InitializeSingleSource(G,s)
% for i = 1, ... |V| - 1
% changed = false
% for all edges (u,v) in E
% changedTmp = Relax(u,v)
% if (!changed)
% changed = changedTmp
% if (!changed)
% break
% for all edges (u,v) in E
% if v.dist > u.dist + w(u,v)
% return false
% return true
% \end{verbatim}
\section{} %2
\begin{minted}{python}
function DAG-SP(G,s)
sort vertices topologically
InitializeSingleSource(G,s)
for each u in V in topological sort order
for each v in Adj(u)
Relax(u,v)
\end{minted}
% \begin{verbatim}
% function DAG-SP(G,s)
% sort vertices topologically
% InitializeSingleSource(G,s)
% for each u in V in topological sort order
% for each v in Adj(u)
% Relax(u,v)
% \end{verbatim}
\section{} %3
Wir wissen, dass der Dijkstra-Algorithmus für rein positive Kantengewichte funktioniert. Es bleibt also nur zu zeigen, dass die kürzesten Wege zu den Knoten korrekt berechnet werden, die eine Kante von dem Startknoten entfernt sind. Ferner ist bekannt, dass Dijkstra zuerst den Knoten besucht, der am billigsten zu erreichen ist. Damit geht der Algorithmus die Kante mit dem kleinsten Gewicht zu erst (einschließlich negative Gewichte). Der somit erreichte Knoten kann also gar nicht billiger zu erreichen sein, da jeder andere Pfad dorthin aus mindestens zwei Kanten besteht, die zusammen bestenfalls das gleiche Gewicht haben wie die gegangene Kante.
Dies ist so, da die erste Kante vom Startknoten zu einem anderen Knoten minimal so klein sein kann, wie die zuerst gegangene Kante, da andernfalls die zuerst gegangene Kante nicht das geringste Gewicht gehabt hätte. Die zweite Kante muss mindestens 0 als Gewicht haben, womit nur ein gleich großes oder größeres Gesamtgewicht entstehen kann, als durch die zuerst gegangene Kante verwendet wurde.
\section{} %4
\subsection{} %a
In einem Baum gibt es keine Zyklen. Daher gibt es genau einen direkten Weg (ohne Umwege mit mehrmaligem Besuchen eines Knotens) zu jedem Knoten von dem Wurzelknoten aus. Demnach müssen einfach vom Wurzelknoten aus alle Knoten besucht werden. Dabei wird ähnlich wie in der Breitensuche vorgegangen, indem zunächst alle Knoten, die direkt mit dem Wurzelknoten per Kante verbunden sind, besucht werden und anschließend alle Knoten, die zwei Kanten vom Wurzelknoten entfernt sind, etc. Dabei wird eine Variable zu Beginn auf 0 gesetzt und bei jedem Knoten wird geschaut, ob seine Entfernung zum Wurzelknoten größer ist als diese Variable. Wenn dem so ist, dann wird die Variable entsprechend angepasst. Nach einmaligem Besuchen jedes Knotens hat man damit die längste Entfernung eines Knotens von dem Wurzelknoten ermittelt.
In Pseudocode sieht das dann so aus:
\begin{minted}{python}
function berechneDurchmesser(G)
longestPath = 0
current = G.root
queue.enqueue(current.getChilds())
while (!empty(queue))
current = queue.dequeue()
parent = current.parent
distance = parent.getDistance() + w(parent,current)
current.setDistance(distance)
if (distance > longestPath)
longestPath = distance
childs = current.getChilds()
if (!empty(childs))
queue.enqueue(current.getChilds())
\end{minted}
% \begin{verbatim}
% function berechneDurchmesser(G)
% longestPath = 0
% current = G.root
% queue.enqueue(current.getChilds())
% while (!empty(queue))
% current = queue.dequeue()
% parent = current.parent
% distance = parent.getDistance() + w(parent,current)
% current.setDistance(distance)
% if (distance > longestPath)
% longestPath = distance
% childs = current.getChilds()
% if (!empty(childs))
% queue.enqueue(current.getChilds())
% \end{verbatim}
\subsection{} %b
\begin{minted}{python}
def Durchmesser(G):
laengsterWeg = 0
for v1 in G.kanten:
for v2 in G.kanten with v1 != v2:
P = findeKuerzestenWeg(v1, v2)
if P.laenge() > laengsterWeg:
laengsterWeg = P.laenge()
return laengsterWeg
\end{minted}
% \begin{verbatim}
% Diam(G)
% longestPath = 0
% for each v1 in G.vertices
% for each v2 in G.vertices with v1 != v2
% find shortest path P from v1 to v2
% if P.length > longestPath
% longestPath = P.length
% return longestPath
% \end{verbatim}
Die Laufzeit dieses Algorithmus beträgt $\mathcal{O}(|V|^3)$.
\section{} %5
\subsection{} %a
Man konstruiert einen vollständigen Graphen aus der Matrix, in welchem die Knoten Währungen repräsentieren, und als Kantengewichte die Werte verwendet werden.
Gibt es nun in diesem Graphen einen Zyklus, in dem das Produkt aller Kantengewichte ungleich 1 ist, existiert Währungsarbitrage. Ansonsten ist dies nicht der Fall.
\subsection{} %b
Nein, unsere Lösung kann nicht zu negativen Zyklen führen, denn dafür müssten negative Werte in der Matrix vorhanden sein.
Würden solche Zyklen existieren, bedeuteten sie, man verliere all sein Geld bei einem Tausch, und müsste außerdem eine Strafe zahlen.
\section{} %6
\begin{tikzpicture}[shorten >=1pt,node distance=1.1cm]
\node[state] (s) {s};
\node[state] (a) [above right=1.5 and 1.0 of s] {A};
\node[state] (b) [below right=1.5 and 1.0 of s] {B};
\node[state] (d) [above right=1.0 and 1.0 of a] {D};
\node[state] (c) [right=of a] {C};
\node[state] (f) [below right=1.0 and 1.25 of a] {F};
\node[state] (e) [right=1.0 of c] {E};
\node[state] (g) [right=of f] {G};
\path[every node/.style={font=\scriptsize},->]
(s) edge node [above] {30} (a)
(s) edge node [below] {18} (b)
(a) edge node [above] {21} (c)
(a) edge node [above] {38} (d)
(a) edge node [below] {22} (f)
(c) edge node [right] {22} (f)
(c) edge node [above] {20} (e)
(f) edge node [above] {9} (g)
(b) edge node [left] {30} (a);
\end{tikzpicture}
Da dies ein gerichteter Graph ohne Zyklen ist und auch keine negativen Kantengewichte vorkommen, kann der Dijkstra-Algorithmus angewendet werden. Da von 9 bis 17 Uhr Fahrer bezahlt werden müssen, kommen nur die Pfade in Betrachtung, die zu einer Senke führen. Senken sind D, E und G. Derjenige dieser Knoten welcher als erster vom Algorithmus gefunden wird (über den eindeutig bestimmbaren Weg), ist auch der kürzeste Pfad vom Startknoten aus, der die Bedingungen erfüllt.
Es ergibt sich folgende Abfolge:
\begin{verbatim}
S = {s}
d(s) = 0
while 1.
U = {A, B}
for all u in U -> u = A
for all pre(u) in S that are predecessors of u -> pre(u) = s
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 0 + 30
for all u in U -> u = B
for all pre(u) in S that are predecessors of u -> pre(u) = s
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 0 + 18
u* = B
d(u*) = 18
S = {s, B}
while 2.
U = {A}
for all u in U -> u = A
for all pre(u) in S that are predecessors of u -> pre(u) = s
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 0 + 30
for all pre(u) in S that are predecessors of u -> pre(u) = B
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 18 + 30
u* = A
d(u*) = 30
S = {S, B, A}
while 3.
U = {D, C, F}
for all u in U -> u = D
for all pre(u) in S that are predecessors of u -> pre(u) = A
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 30 + 38
for all u in U -> u = C
for all pre(u) in S that are predecessors of u -> pre(u) = A
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 30 + 21
for all u in U -> u = F
for all pre(u) in S that are predecessors of u -> pre(u) = A
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 30 + 22
u* = C
d(u*) = 51
S = {s, B, A, C}
while 4.
U = {D, F, E}
for all u in U -> u = D
for all pre(u) in S that are predecessors of u -> pre(u) = A
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 30 + 38
for all u in U -> u = F
for all pre(u) in S that are predecessors of u -> pre(u) = A
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 30 + 22
for all pre(u) in S that are predecessors of u -> pre(u) = C
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 51 + 22
for all u in U -> u = E
for all pre(u) in S that are predecessors of u -> pre(u) = C
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 51 + 20
u* = F
d(u*) = 52
S = {s, B, A, C, F}
while 5.
U = {D, E, G}
for all u in U -> u = D
for all pre(u) in S that are predecessors of u -> pre(u) = A
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 30 + 38
for all u in U -> u = E
for all pre(u) in S that are predecessors of u -> pre(u) = C
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 51 + 20
for all u in U -> u = G
for all pre(u) in S that are predecessors of u -> pre(u) = F
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 52 + 9
u* = G
d(u*) = 61
S = {s, B, A, C, F, G}
while 6.
U = {D, E}
for all u in U -> u = D
for all pre(u) in S that are predecessors of u -> pre(u) = A
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 30 + 38
for all u in U -> u = E
for all pre(u) in S that are predecessors of u -> pre(u) = C
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 51 + 22
u* = D
d(u*) = 68
S = {s, B, A, C, F, G, D}
while 7.
U = {E}
for all u in U -> u = E
for all pre(u) in S that are predecessors of u -> pre(u) = C
d'(u, pre(u)) = d(pre(u)) + w(pre(u), u)
d'(u, pre(u)) = 51 + 20
u* = E
d(u*) = 71
S = {s, B, A, C, F, G, D, E}
\end{verbatim}
Wie zu sehen ist wird die Senke G zuerst erreicht. Folgt man dem Weg zu G, so ergibt sich, dass der kürzeste Pfad von s über A und F nach G führt. Weniger Kosten als 61 sind daher nicht möglich.
\end{document}

View File

@ -58,7 +58,11 @@
RID INT(10) NOT NULL,
OID INT(10) NOT NULL,
Platz INT(3) NOT NULL,
CONSTRAINT pk_platzierung PRIMARY KEY (RID, OID)
CONSTRAINT pk_platzierung PRIMARY KEY (RID, OID),
CONSTRAINT fk_rennfahrer FOREIGN KEY (RID)
REFERENCES Rennfahrer (RID) ON DELETE CASCADE,
CONSTRAINT fk_rennort FOREIGN KEY (OID)
REFERENCES Rennort (OID) ON DELETE CASCADE
);
\end{verbatim}
\subsection{} %b
@ -173,14 +177,16 @@
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};
\node (sel) [below=2.0 of proj] {$\sigma_{Obst.Sorte\text{ LIKE 'K\%'}}$};
\node (sel2) [below=2.0 of sel] {$\sigma_{Obst.ONR=Person.Lieblingsobst}$};
\node (catProd) [below=2.0 of sel2] {x};
\node (person) [below left=2.0 and 2.0 of catProd] {Person};
\node (obst) [below right=2.0 and 2.0 of catProd] {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);
(sel) edge node [right] {2000} (sel2)
(sel2) edge node [right] {50000} (catProd)
(catProd) edge node [left] {2000} (person)
(catProd) edge node [right] {25} (obst);
\end{tikzpicture}
optimierter Operatorbaum:\\
@ -196,5 +202,5 @@
(sel) edge node [right] {25} (obst);
\end{tikzpicture}
Der zweite Operatorbaum ist klar performanter, da die Selektion der Obstsorte bereits vor dem Join stattfindet.
Der zweite Operatorbaum ist klar performanter, da die Selektion der Obstsorte bereits vor dem Join stattfindet und das kartesische Produkt und die zweite Selektion zu einem Join verbunden wurde.
\end{document}

View File

@ -8,5 +8,7 @@ Feedback zu Vortrag Elektronische Demokratie
* Vergleich basierend auf mehreren Quellen
* Definition der Begriffe
* miteinbeziehen des Publikums bei einem so populären Thema
* mehr Strukturierung im Vortrag (eigenes Feedback) -> sonst zu schnell fertig und zu viel Ausgedachtes
* Überblick mithilfe von unterschiedlichen Quellen zur Verfügung stellen
* Klare Differenzierung zwischen E-Democracy und E-Government
* sinnvolle Beispiele (was hat Star Citizen/Crowdfunding auch nur annähernd mit der vorgestellten Elektronischen Demokratie zu tun?)

View File

@ -0,0 +1,117 @@
\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}
\usepackage{multirow}
\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 6. Januar}
\maketitle
\section{} %1
\section{} %2
\subsection{} %a
\begin{alignat*}{9}
\text{minimiere}\; & 67w &+& 120k &+& 100h &+& 60f &+& 97b &+& 124n &+& 22s &+& 62m && \\
\multicolumn{18}{l}{\text{unter den Nebenbedingungen}} && \\
& 8w &+& 25k &+& 30h &+& 22f &+& 3b &+& 8n &+& 6s && &\geq &\, 75 \\
& w &+& 35k &+& 8h &+& f && &+& 33n &+& 13s &+& 98m &\geq &\, 90 \\
& 54w && && && &+& 42b &+& 4n &+& 63s && &\geq &\, 300 \\
\multicolumn{16}{r}{$w, k, h, f, b, n, s, m$} \,&\geq &\, 0
\end{alignat*}
\subsection{} %b
In das verlinkte Tool wird folgendes eingegeben:
\begin{verbatim}
Minimize p = 67w + 120k + 100h + 60f + 97b + 124n + 22s + 62m subject to
8w + 25k + 30h + 22f + 3b + 8n + 6s + 0m >= 75
w + 35k + 8h + f + 0b + 33n + 13s + 98m >= 90
54w + 0k + 0h + 0f + 42b + 4n + 63s + 0m >= 300
w >= 0
k >= 0
h >= 0
f >= 0
b >= 0
n >= 0
s >= 0
m >= 0
\end{verbatim}
Die Ausgabe ist:
\begin{verbatim}
Optimal Solution: p = 6801/28; w = 0, k = 0, h = 0, f = 87/56,
b = 0, n = 0, s = 381/56, m = 0
\end{verbatim}
\subsection{} %c
In das verlinkte Tool wird folgendes eingegeben:
\begin{verbatim}
Minimize p = 3x1 + 24x2 + 13x3 + 9x4 + 20x5 + 19x6 subject to
110x1 + 205x2 + 160x3 + 160x3 + 420x5 + 260x6 >= 2000
4x1 + 32x2 + 13x3 + 8x4 + 4x5 + 14x6 >= 55
2x1 + 12x2 + 54x3 + 285x4 + 22x5 + 80x6 >= 800
x1 <= 4
x2 <= 3
x3 <= 2
x4 <= 8
x5 <= 2
x6 <= 2
x1 >= 0
x2 >= 0
x3 >= 0
x4 >= 0
x5 >= 0
x6 >= 0
\end{verbatim}
Die Ausgabe ist:
\begin{verbatim}
Optimal Solution: p = 46621/380; x1 = 4, x2 = 0, x3 = 5/4,
x4 = 347/190, x5 = 2, x6 = 2
\end{verbatim}
\subsection{} %d
In das verlinkte Tool wird folgendes eingegeben:
\begin{verbatim}
Maximize p = 8a1 + 3a2 + 6b1 + 3b2 + 9c1 + 5c2 subject to
a1 + a2 <= 400
b1 + b2 <= 480
c1 + c2 <= 230
a1 + b1 + c1 <= 420
a2 + b2 + c2 <= 250
a1 >= 0
a2 >= 0
b1 >= 0
b2 >= 0
c1 >= 0
c2 >= 0
\end{verbatim}
Die Ausgabe ist:
\begin{verbatim}
Optimal Solution: p = 4550; a1 = 400, a2 = 0, b1 = 0, b2 = 40,
c1 = 20, c2 = 210
\end{verbatim}
\end{document}

View File

@ -117,8 +117,8 @@ Stephan Niendorf (6242417)}
\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} \\
&=&&\, 80 - 5 - \frac{1}{200}x_{4} + \frac{1}{4}x_{3} - \frac{1}{50}x_{4} \\
&=&&\, 75 - \frac{1}{40}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}
@ -127,7 +127,7 @@ Stephan Niendorf (6242417)}
\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}
x_{2} \,&=&\, 75 \,&-&\, \frac{1}{40}x_{4} \,&+&\, \frac{1}{4}x_{3} \\ \cline{1 - 7}
z &=& 6250 \,&-&\, \frac{3}{4}x_{4} \,&-&\, \frac{65}{2}x_{3}
\end{alignat*}
@ -242,8 +242,8 @@ Stephan Niendorf (6242417)}
\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} \\
&=&&\, 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}
@ -251,8 +251,8 @@ Stephan Niendorf (6242417)}
\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}
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*}

View File

@ -0,0 +1,561 @@
\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}
\usepackage{multirow}
\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 16. Dezember}
\maketitle
\section{} %1
\subsection{} %a
\begin{alignat*}{3}
\text{maximiere}\; & 2x_{1} \,&+&\, 3x_{2} && \\
\multicolumn{6}{l}{\text{unter den Nebenbedingungen}} && \\
\;& x_{1} \,&-&\, 4x_{2} \,&\leq & 2 \\
\;& x_{1} \,&&\, \,&\leq & 5 \\
\;& \,&&\, x_{2} \,&\leq & 8 \\
\multicolumn{4}{r}{$x_{1}, x_{2}$} \,&\geq &\, 0
\end{alignat*}
\underline{Eingangsdaten}:
\begin{alignat*}{2}
A &=& \begin{pmatrix}
x_{1} & x_{2} & x_{3} & x_{4} & x_{5} \\
1 & -4 & 1 & 0 & 0 \\
1 & 0 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 & 1
\end{pmatrix} \\
c^{T} &=& \begin{pmatrix}
x_{1} & x_{2} & x_{3} & x_{4} & x_{5} \\
2 & 3 & 0 & 0 & 0
\end{pmatrix} \\
b &=& \begin{pmatrix}
2 \\
5 \\
8
\end{pmatrix}
\end{alignat*}
\underline{Initialisierung}:
\begin{alignat*}{2}
x_{B}^{*} &=& \begin{pmatrix}
x_{3}^{*} \\
x_{4}^{*} \\
x_{5}^{*}
\end{pmatrix}
=
\begin{pmatrix}
2 \\
5 \\
8
\end{pmatrix} \\
B &=& \begin{pmatrix}
x_{3} & x_{4} & x_{5} \\
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{pmatrix}
\end{alignat*}
\underline{1. Iteration}
\textbf{1. Schritt} (Lösung von $y^{T}B = c_{B}^{T}$):\\
Es gilt $c_{B}^{T} = \begin{pmatrix} 0 & 0 & 0 \end{pmatrix}$. Das Gleichungssystem $y^{T}B = c_{B}^{T}$ lautet
\begin{alignat*}{3}
y_{1} & & &=& 0 \\
& y_{2} & &=& 0 \\
& & y_{3} &=& 0
\end{alignat*}
Also gilt $y^{T} = \begin{pmatrix} 0 & 0 & 0 \end{pmatrix}$.
\textbf{2. Schritt} (Bestimmung der Eingangsspalte a und gleichzeitig der Eingangsvariablen):\\
Es gilt $A_{N} = \begin{pmatrix} x_{1} & x_{2} \\ 1 & -4 \\ 1 & 0 \\ 0 & 1 \end{pmatrix},\; y^{T}A_{N} = \begin{pmatrix} 0 & 0 \end{pmatrix}$ und $c_{N}^{T} = \begin{pmatrix} 2 & 3 \end{pmatrix}$. Also kommt jede Spalte von $A_{N}$ als Eingangsspalte a infrage, wir wählen $a = \begin{pmatrix} -4 \\ 0 \\ 1 \end{pmatrix}$; die Eingangsvariable ist $x_{2}$.
\textbf{3. Schritt} (Lösung von $Bd = a$):\\
Das Gleichungssystem $Bd = a$ lautet
\begin{alignat*}{3}
d_{1} & & &=& -4 \\
& d_{2} & &=& 0 \\
& & d_{3} &=& 1
\end{alignat*}
Es folgt $d = \begin{pmatrix}-4 \\ 0 \\ 1 \end{pmatrix}$.
\textbf{4. Schritt} (Bestimmung der Ausgangsvariablen):\\
Die Ungleichung $x_{B}^{*} - td \geq 0$ lautet $\begin{pmatrix} 2 \\ 5 \\ 8\end{pmatrix} - t \begin{pmatrix}-4 \\ 0 \\ 1 \end{pmatrix} \geq \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix}$. Das größte t, das dies erfüllt, ist $t = 8$; für $t = 8$ gilt $\begin{pmatrix} 2 \\ 5 \\ 8\end{pmatrix} - t \begin{pmatrix}-4 \\ 0 \\ 1 \end{pmatrix} = \begin{pmatrix} 34 \\ 5 \\ 0 \end{pmatrix}$, Ausgangsvariable ist $x_{5}$.
\textbf{5. Schritt} (Update von $x_{B}^{*}$ und $B$):\\
$x_{B}^{*} = \begin{pmatrix} x_{3}^{*} \\ x_{4}^{*} \\ x_{2}^{*} \end{pmatrix} = \begin{pmatrix} 34 \\ 5 \\ 8 \end{pmatrix}$ und $B = \begin{pmatrix} x_{3} & x_{4} & x_{2} \\ 1 & 0 & -4 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}$.
\underline{2. Iteration}
\textbf{1. Schritt} (Lösung von $y^{T}B = c_{B}^{T}$):\\
Es gilt $c_{B}^{T} = \begin{pmatrix} 2 & 0 & 0 \end{pmatrix}$. Das Gleichungssystem $y^{T}B = c_{B}^{T}$ lautet
\begin{alignat*}{4}
y_{1} && &-& 4y_{3} &=& 34 \\
&& y_{2} && &=& 5 \\
&& && y_{3} &=& 8
\end{alignat*}
Also gilt $y^{T} = \begin{pmatrix} 66 & 5 & 8 \end{pmatrix}$.
\textbf{2. Schritt} (Bestimmung der Eingangsspalte a und gleichzeitig der Eingangsvariablen):\\
Es gilt $A_{N} = \begin{pmatrix} x_{1} & x_{5} \\ 1 & 0 \\ 1 & 0 \\ 0 & 1 \end{pmatrix},\; y^{T}A_{N} = \begin{pmatrix} 71 & 8 \end{pmatrix}$ und $c_{N}^{T} = \begin{pmatrix} 2 & 0 \end{pmatrix}$. Also kommt nur die erste Spalte von $A_{N}$ als Eingangsspalte a infrage, wir wählen $a = \begin{pmatrix} 1 \\ 1 \\ 0 \end{pmatrix}$; die Eingangsvariable ist $x_{1}$.
\textbf{3. Schritt} (Lösung von $Bd = a$):\\
Das Gleichungssystem $Bd = a$ lautet
\begin{alignat*}{4}
d_{1} && &-& 4d_{3} &=& 1 \\
&& d_{2} && &=& 1 \\
&& && d_{3} &=& 0
\end{alignat*}
Es folgt $d = \begin{pmatrix}1 \\ 1 \\ 0 \end{pmatrix}$.
\textbf{4. Schritt} (Bestimmung der Ausgangsvariablen):\\
Die Ungleichung $x_{B}^{*} - td \geq 0$ lautet $\begin{pmatrix} 34 \\ 5 \\ 8\end{pmatrix} - t \begin{pmatrix}1 \\ 1 \\ 0 \end{pmatrix} \geq \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix}$. Das größte t, das dies erfüllt, ist $t = 5$; für $t = 5$ gilt $\begin{pmatrix} 34 \\ 5 \\ 8\end{pmatrix} - t \begin{pmatrix}1 \\ 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 29 \\ 0 \\ 8 \end{pmatrix}$, Ausgangsvariable ist $x_{4}$.
\textbf{5. Schritt} (Update von $x_{B}^{*}$ und $B$):\\
$x_{B}^{*} = \begin{pmatrix} x_{3}^{*} \\ x_{1}^{*} \\ x_{2}^{*} \end{pmatrix} = \begin{pmatrix} 29 \\ 5 \\ 8 \end{pmatrix}$ und $B = \begin{pmatrix} x_{3} & x_{1} & x_{2} \\ 1 & 1 & -4 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}$.
\underline{3. Iteration}
\textbf{1. Schritt} (Lösung von $y^{T}B = c_{B}^{T}$):\\
Es gilt $c_{B}^{T} = \begin{pmatrix} 0 & 2 & 3 \end{pmatrix}$. Das Gleichungssystem $y^{T}B = c_{B}^{T}$ lautet
\begin{alignat*}{4}
y_{1} && && &=& 0 \\
y_{1} &+& y_{2} && &=& 2 \\
-4y_{1} && &+& y_{3} &=& 3
\end{alignat*}
Also gilt $y^{T} = \begin{pmatrix} 0 & 2 & 3 \end{pmatrix}$.
\textbf{2. Schritt} (Bestimmung der Eingangsspalte a und gleichzeitig der Eingangsvariablen):\\
Es gilt $A_{N} = \begin{pmatrix} x_{4} & x_{5} \\ 0 & 0 \\ 1 & 0 \\ 0 & 1 \end{pmatrix},\; y^{T}A_{N} = \begin{pmatrix} 2 & 3 \end{pmatrix}$ und $c_{N}^{T} = \begin{pmatrix} 0 & 0 \end{pmatrix}$. Wegen $2 \geq 0, 3 \geq 0$ ist die aktuelle Lösung optimal. Die optimale Lösung lautet $x_{1}^{*} = 5, x_{2}^{*} = 8$ mit $z^{*} = 2x_{1}^{*} + 3x_{2}^{*} = 34$.
\subsection{} %b
\begin{alignat*}{4}
\text{maximiere}\; & 3x_{1} \,&+&\, 2x_{2} \,&+&\, 2x_{3} && \\
\multicolumn{8}{l}{\text{unter den Nebenbedingungen}} && \\
\;& x_{1} \,&&\, \,&+&\, x_{3} \,&\leq & 8 \\
\;& x_{1} \,&+&\, x_{2} \,&&\, \,&\leq & 7 \\
\;& x_{1} \,&+&\, 2x_{2} \,&&\, \,&\leq & 12 \\
\multicolumn{6}{r}{$x_{1}, x_{2}, x_{3}$} \,&\geq &\, 0
\end{alignat*}
\underline{Eingangsdaten}:
\begin{alignat*}{2}
A &=& \begin{pmatrix}
x_{1} & x_{2} & x_{3} & x_{4} & x_{5} & x_{6} \\
1 & 0 & 1 & 1 & 0 & 0 \\
1 & 1 & 0 & 0 & 1 & 0\\
1 & 2 & 0 & 0 & 0 & 1
\end{pmatrix} \\
c^{T} &=& \begin{pmatrix}
x_{1} & x_{2} & x_{3} & x_{4} & x_{5} & x_{6} \\
3 & 2 & 2 & 0 & 0 & 0
\end{pmatrix} \\
b &=& \begin{pmatrix}
8 \\
7 \\
12
\end{pmatrix}
\end{alignat*}
\underline{Initialisierung}:
\begin{alignat*}{2}
x_{B}^{*} &=& \begin{pmatrix}
x_{4}^{*} \\
x_{5}^{*} \\
x_{6}^{*}
\end{pmatrix}
=
\begin{pmatrix}
8 \\
7 \\
12
\end{pmatrix} \\
B &=& \begin{pmatrix}
x_{4} & x_{5} & x_{6} \\
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{pmatrix}
\end{alignat*}
\underline{1. Iteration}
\textbf{1. Schritt} (Lösung von $y^{T}B = c_{B}^{T}$):\\
Es gilt $c_{B}^{T} = \begin{pmatrix} 0 & 0 & 0 \end{pmatrix}$. Das Gleichungssystem $y^{T}B = c_{B}^{T}$ lautet
\begin{alignat*}{3}
y_{1} & & &=& 0 \\
& y_{2} & &=& 0 \\
& & y_{3} &=& 0
\end{alignat*}
Also gilt $y^{T} = \begin{pmatrix} 0 & 0 & 0 \end{pmatrix}$.
\textbf{2. Schritt} (Bestimmung der Eingangsspalte a und gleichzeitig der Eingangsvariablen):\\
Es gilt $A_{N} = \begin{pmatrix} x_{1} & x_{2} & x_{3} \\ 1 & 0 & 1 \\ 1 & 1 & 0 \\ 1 & 2 & 0 \end{pmatrix},\; y^{T}A_{N} = \begin{pmatrix} 0 & 0 & 0 \end{pmatrix}$ und $c_{N}^{T} = \begin{pmatrix} 3 & 2 & 2 \end{pmatrix}$. Also kommt jede Spalte von $A_{N}$ als Eingangsspalte a infrage, wir wählen $a = \begin{pmatrix} 1 \\ 1 \\ 1 \end{pmatrix}$; die Eingangsvariable ist $x_{1}$.
\textbf{3. Schritt} (Lösung von $Bd = a$):\\
Das Gleichungssystem $Bd = a$ lautet
\begin{alignat*}{3}
d_{1} & & &=& 1 \\
& d_{2} & &=& 1 \\
& & d_{3} &=& 1
\end{alignat*}
Es folgt $d = \begin{pmatrix}1 \\ 1 \\ 1 \end{pmatrix}$.
\textbf{4. Schritt} (Bestimmung der Ausgangsvariablen):\\
Die Ungleichung $x_{B}^{*} - td \geq 0$ lautet $\begin{pmatrix} 8 \\ 7 \\ 12\end{pmatrix} - t \begin{pmatrix}1 \\ 1 \\ 1 \end{pmatrix} \geq \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix}$. Das größte t, das dies erfüllt, ist $t = 7$; für $t = 7$ gilt $\begin{pmatrix} 8 \\ 7 \\ 12\end{pmatrix} - t \begin{pmatrix}1 \\ 1 \\ 1 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \\ 5 \end{pmatrix}$, Ausgangsvariable ist $x_{5}$.
\textbf{5. Schritt} (Update von $x_{B}^{*}$ und $B$):\\
$x_{B}^{*} = \begin{pmatrix} x_{4}^{*} \\ x_{1}^{*} \\ x_{6}^{*} \end{pmatrix} = \begin{pmatrix} 1 \\ 7 \\ 5 \end{pmatrix}$ und $B = \begin{pmatrix} x_{4} & x_{1} & x_{6} \\ 1 & 1 & 0 \\ 0 & 1 & 0 \\ 0 & 1 & 1 \end{pmatrix}$.
\underline{2. Iteration}
\textbf{1. Schritt} (Lösung von $y^{T}B = c_{B}^{T}$):\\
Es gilt $c_{B}^{T} = \begin{pmatrix} 0 & 3 & 0 \end{pmatrix}$. Das Gleichungssystem $y^{T}B = c_{B}^{T}$ lautet
\begin{alignat*}{4}
y_{1} && && &=& 0 \\
y_{1} &+& y_{2} &+& y_{3} &=& 3 \\
&& && y_{3} &=& 0
\end{alignat*}
Also gilt $y^{T} = \begin{pmatrix} 0 & 3 & 0 \end{pmatrix}$.
\textbf{2. Schritt} (Bestimmung der Eingangsspalte a und gleichzeitig der Eingangsvariablen):\\
Es gilt $A_{N} = \begin{pmatrix} x_{5} & x_{2} & x_{3} \\ 0 & 0 & 1 \\ 1 & 1 & 0 \\ 0 & 2 & 0 \end{pmatrix},\; y^{T}A_{N} = \begin{pmatrix} 3 & 3 & 0 \end{pmatrix}$ und $c_{N}^{T} = \begin{pmatrix} 0 & 2 & 2 \end{pmatrix}$. Also kommt nur die dritte Spalte von $A_{N}$ als Eingangsspalte a infrage, wir wählen $a = \begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix}$; die Eingangsvariable ist $x_{3}$.
\textbf{3. Schritt} (Lösung von $Bd = a$):\\
Das Gleichungssystem $Bd = a$ lautet
\begin{alignat*}{4}
d_{1} &+& d_{2} && &=& 1 \\
&& d_{2} && &=& 0 \\
&& d_{2} &+& d_{3} &=& 0
\end{alignat*}
Es folgt $d = \begin{pmatrix}1 \\ 0 \\ 0 \end{pmatrix}$.
\textbf{4. Schritt} (Bestimmung der Ausgangsvariablen):\\
Die Ungleichung $x_{B}^{*} - td \geq 0$ lautet $\begin{pmatrix} 1 \\ 7 \\ 5\end{pmatrix} - t \begin{pmatrix}1 \\ 0 \\ 0 \end{pmatrix} \geq \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix}$. Das größte t, das dies erfüllt, ist $t = 1$; für $t = 1$ gilt $\begin{pmatrix} 1 \\ 7 \\ 5\end{pmatrix} - t \begin{pmatrix}1 \\ 0 \\ 0 \end{pmatrix} = \begin{pmatrix} 0 \\ 7 \\ 5 \end{pmatrix}$, Ausgangsvariable ist $x_{4}$.
\textbf{5. Schritt} (Update von $x_{B}^{*}$ und $B$):\\
$x_{B}^{*} = \begin{pmatrix} x_{3}^{*} \\ x_{1}^{*} \\ x_{6}^{*} \end{pmatrix} = \begin{pmatrix} 1 \\ 7 \\ 5 \end{pmatrix}$ und $B = \begin{pmatrix} x_{3} & x_{1} & x_{6} \\ 1 & 1 & 0 \\ 0 & 1 & 0 \\ 0 & 1 & 1 \end{pmatrix}$.
\underline{3. Iteration}
\textbf{1. Schritt} (Lösung von $y^{T}B = c_{B}^{T}$):\\
Es gilt $c_{B}^{T} = \begin{pmatrix} 2 & 1 & 0 \end{pmatrix}$. Das Gleichungssystem $y^{T}B = c_{B}^{T}$ lautet
\begin{alignat*}{4}
y_{1} && && &=& 2 \\
y_{1} &+& y_{2} &+& y_{3} &=& 1 \\
&& && y_{3} &=& 0
\end{alignat*}
Also gilt $y^{T} = \begin{pmatrix} 2 & -1 & 0 \end{pmatrix}$.
\textbf{2. Schritt} (Bestimmung der Eingangsspalte a und gleichzeitig der Eingangsvariablen):\\
Es gilt $A_{N} = \begin{pmatrix} x_{5} & x_{2} & x_{4} \\ 0 & 0 & 1 \\ 1 & 1 & 0 \\ 0 & 2 & 0 \end{pmatrix},\; y^{T}A_{N} = \begin{pmatrix} -1 & -1 & 2 \end{pmatrix}$ und $c_{N}^{T} = \begin{pmatrix} 0 & 2 & 0\end{pmatrix}$. Also kommen nur die ersten beiden Spalten von $A_{N}$ als Eingangsspalte a infrage, wir wählen $a = \begin{pmatrix} 0 \\ 1 \\ 2 \end{pmatrix}$; die Eingangsvariable ist $x_{2}$.
\textbf{3. Schritt} (Lösung von $Bd = a$):\\
Das Gleichungssystem $Bd = a$ lautet
\begin{alignat*}{4}
d_{1} &+& d_{2} && &=& 0\\
&& d_{2} && &=& 1 \\
&& d_{2} &+& d_{3} &=& 2
\end{alignat*}
Es folgt $d = \begin{pmatrix} -1 \\ 1 \\ 1 \end{pmatrix}$.
\textbf{4. Schritt} (Bestimmung der Ausgangsvariablen):\\
Die Ungleichung $x_{B}^{*} - td \geq 0$ lautet $\begin{pmatrix} 1 \\ 7 \\ 5\end{pmatrix} - t \begin{pmatrix}-1 \\ 1 \\ 1 \end{pmatrix} \geq \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix}$. Das größte t, das dies erfüllt, ist $t = 5$; für $t = 5$ gilt $\begin{pmatrix} 1 \\ 7 \\ 5\end{pmatrix} - t \begin{pmatrix} -1 \\ 1 \\ 1 \end{pmatrix} = \begin{pmatrix} 6 \\ 2 \\ 0 \end{pmatrix}$, Ausgangsvariable ist $x_{6}$.
\textbf{5. Schritt} (Update von $x_{B}^{*}$ und $B$):\\
$x_{B}^{*} = \begin{pmatrix} x_{3}^{*} \\ x_{1}^{*} \\ x_{2}^{*} \end{pmatrix} = \begin{pmatrix} 6 \\ 2 \\ 5 \end{pmatrix}$ und $B = \begin{pmatrix} x_{3} & x_{1} & x_{2} \\ 1 & 1 & 0 \\ 0 & 1 & 1 \\ 0 & 1 & 2 \end{pmatrix}$.
\underline{4. Iteration}
\textbf{1. Schritt} (Lösung von $y^{T}B = c_{B}^{T}$):\\
Es gilt $c_{B}^{T} = \begin{pmatrix} 2 & 3 & 2 \end{pmatrix}$. Das Gleichungssystem $y^{T}B = c_{B}^{T}$ lautet
\begin{alignat*}{4}
y_{1} && && &=& 2 \\
y_{1} &+& y_{2} &+& y_{3} &=& 3 \\
&& y_{2} &+& 2y_{3} &=& 2
\end{alignat*}
Es ergibt sich dieses LGS:
\begin{alignat*}{3}
I & y_{2} &+& y_{3} &=& 1 \\
II & y_{2} &+& 2y_{3} &=& 2 \\
II - I & && y_{3} &=& 1
\end{alignat*}
Also gilt $y^{T} = \begin{pmatrix} 2 & 0 & 1 \end{pmatrix}$.
\textbf{2. Schritt} (Bestimmung der Eingangsspalte a und gleichzeitig der Eingangsvariablen):\\
Es gilt $A_{N} = \begin{pmatrix} x_{5} & x_{6} & x_{4} \\ 0 & 0 & 1 \\ 1 & 0 & 0 \\ 0 & 1 & 0 \end{pmatrix},\; y^{T}A_{N} = \begin{pmatrix} 0 & 1 & 2 \end{pmatrix}$ und $c_{N}^{T} = \begin{pmatrix} 0 & 0 & 0\end{pmatrix}$. Wegen $0 \geq 0, 1 \geq 0, 2 \geq 0$ ist die aktuelle Lösung optimal. Die optimale Lösung lautet $x_{1}^{*} = 2, x_{2}^{*} = 5, x_{3}^{*} = 6$ mit $z^{*} = 3x_{1}^{*} + 2x_{2}^{*} + 2x_{3}^{*} = 28$.
\section{} %2
\begin{alignat*}{5}
\text{maximiere}\; & 5x_{1} \,&+&\, 6x_{2} \,&+&\, 9x_{3} \,&+&\, 8x_{4} && \\
\multicolumn{10}{l}{\text{unter den Nebenbedingungen}} && \\
\;& x_{1} \,&+&\, 2x_{2} \,&+&\, 3x_{3} \,&+&\, x_{4} \,&\leq & 5 \\
\;& x_{1} \,&+&\, x_{2} \,&+&\, 2x_{3} \,&+&\, 3x_{4} \,&\leq & 3 \\
\multicolumn{8}{r}{$x_{1}, x_{2}, x_{3}, x_{4}$} \,&\geq &\, 0
\end{alignat*}
\underline{Eingangsdaten}:
\begin{alignat*}{2}
A &=& \begin{pmatrix}
x_{1} & x_{2} & x_{3} & x_{4} & x_{5} & x_{6} \\
1 & 2 & 3 & 1 & 1 & 0 \\
1 & 1 & 2 & 3 & 0 & 1\\
\end{pmatrix} \\
c^{T} &=& \begin{pmatrix}
x_{1} & x_{2} & x_{3} & x_{4} & x_{5} & x_{6} \\
5 & 6 & 9 & 8 & 0 & 0
\end{pmatrix} \\
b &=& \begin{pmatrix}
5 \\
3
\end{pmatrix}
\end{alignat*}
\underline{Initialisierung}:
\begin{alignat*}{2}
x_{B}^{*} &=& \begin{pmatrix}
x_{5}^{*} \\
x_{6}^{*}
\end{pmatrix}
=
\begin{pmatrix}
5 \\
3
\end{pmatrix} \\
B &=& \begin{pmatrix}
x_{5} & x_{6} \\
1 & 0 \\
0 & 1
\end{pmatrix}
\end{alignat*}
\underline{1. Iteration}
\textbf{1. Schritt} (Lösung von $y^{T}B = c_{B}^{T}$):\\
Es gilt $c_{B}^{T} = \begin{pmatrix} 0 & 0 \end{pmatrix}$. Das Gleichungssystem $y^{T}B = c_{B}^{T}$ lautet
\begin{alignat*}{2}
y_{1} & &=& 0 \\
& y_{2} &=& 0
\end{alignat*}
Also gilt $y^{T} = \begin{pmatrix} 0 & 0 \end{pmatrix}$.
\textbf{2. Schritt} (Bestimmung der Eingangsspalte a und gleichzeitig der Eingangsvariablen):\\
Es gilt $A_{N} = \begin{pmatrix} x_{1} & x_{2} & x_{3} & x_{4} \\ 1 & 2 & 3 & 1 \\ 1 & 1 & 2 & 3 \end{pmatrix},\; y^{T}A_{N} = \begin{pmatrix} 0 & 0 & 0 & 0\end{pmatrix}$ und $c_{N}^{T} = \begin{pmatrix} 5 & 6 & 9 & 8 \end{pmatrix}$. Also kommt jede Spalte von $A_{N}$ als Eingangsspalte a infrage, wir wählen $a = \begin{pmatrix} 3 \\ 2 \end{pmatrix}$; die Eingangsvariable ist $x_{3}$.
\textbf{3. Schritt} (Lösung von $Bd = a$):\\
Das Gleichungssystem $Bd = a$ lautet
\begin{alignat*}{2}
d_{1} & &=& 3 \\
& d_{2} &=& 2
\end{alignat*}
Es folgt $d = \begin{pmatrix}3 \\ 2 \end{pmatrix}$.
\textbf{4. Schritt} (Bestimmung der Ausgangsvariablen):\\
Die Ungleichung $x_{B}^{*} - td \geq 0$ lautet $\begin{pmatrix} 5 \\ 3 \end{pmatrix} - t \begin{pmatrix}3 \\ 2 \end{pmatrix} \geq \begin{pmatrix} 0 \\ 0 \end{pmatrix}$. Das größte t, das dies erfüllt, ist $t = \frac{3}{2}$; für $t = \frac{3}{2}$ gilt $\begin{pmatrix} 5 \\ 3 \end{pmatrix} - t \begin{pmatrix}3 \\ 2 \end{pmatrix} = \begin{pmatrix} \frac{1}{2} \\ 0 \end{pmatrix}$, Ausgangsvariable ist $x_{6}$.
\textbf{5. Schritt} (Update von $x_{B}^{*}$ und $B$):\\
$x_{B}^{*} = \begin{pmatrix} x_{5}^{*} \\ x_{3}^{*} \end{pmatrix} = \begin{pmatrix} \frac{1}{2} \\ \frac{3}{2} \end{pmatrix}$ und $B = \begin{pmatrix} x_{5} & x_{3} \\ 1 & 3 \\ 0 & 2 \end{pmatrix}$.
\underline{2. Iteration}
\textbf{1. Schritt} (Lösung von $y^{T}B = c_{B}^{T}$):\\
Es gilt $c_{B}^{T} = \begin{pmatrix} 0 & 9 \end{pmatrix}$. Das Gleichungssystem $y^{T}B = c_{B}^{T}$ lautet
\begin{alignat*}{3}
y_{1} && &=& 0 \\
3y_{1} &+& 2y_{2} &=& 9
\end{alignat*}
Also gilt $y^{T} = \begin{pmatrix} 0 & \frac{9}{2} \end{pmatrix}$.
\textbf{2. Schritt} (Bestimmung der Eingangsspalte a und gleichzeitig der Eingangsvariablen):\\
Es gilt $A_{N} = \begin{pmatrix} x_{1} & x_{2} & x_{6} & x_{4} \\ 1 & 2 & 1 & 1 \\ 1 & 1 & 0 & 3 \end{pmatrix},\; y^{T}A_{N} = \begin{pmatrix} \frac{9}{2} & \frac{9}{2} & 0 & \frac{27}{2} \end{pmatrix}$ und $c_{N}^{T} = \begin{pmatrix} 5 & 6 & 0 & 8 \end{pmatrix}$. Also kommen nur die ersten beiden Spalten von $A_{N}$ als Eingangsspalte a infrage, wir wählen $a = \begin{pmatrix} 2 \\ 1 \end{pmatrix}$; die Eingangsvariable ist $x_{2}$.
\textbf{3. Schritt} (Lösung von $Bd = a$):\\
Das Gleichungssystem $Bd = a$ lautet
\begin{alignat*}{3}
d_{1} &+& 3d_{2} &=& 2 \\
&& 2d_{2} &=& 1
\end{alignat*}
Es folgt $d = \begin{pmatrix}\frac{1}{2} \\ \frac{1}{2}\end{pmatrix}$.
\textbf{4. Schritt} (Bestimmung der Ausgangsvariablen):\\
Die Ungleichung $x_{B}^{*} - td \geq 0$ lautet $\begin{pmatrix} \frac{1}{2} \\ \frac{3}{2}\end{pmatrix} - t \begin{pmatrix}\frac{1}{2} \\ \frac{1}{2} \end{pmatrix} \geq \begin{pmatrix} 0 \\ 0 \end{pmatrix}$. Das größte t, das dies erfüllt, ist $t = 1$; für $t = 1$ gilt $\begin{pmatrix} \frac{1}{2} \\ \frac{3}{2}\end{pmatrix} - t \begin{pmatrix}\frac{1}{2} \\ \frac{1}{2} \end{pmatrix} = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$, Ausgangsvariable ist $x_{5}$.
\textbf{5. Schritt} (Update von $x_{B}^{*}$ und $B$):\\
$x_{B}^{*} = \begin{pmatrix} x_{2}^{*} \\ x_{3}^{*} \end{pmatrix} = \begin{pmatrix} 1 \\ 1 \end{pmatrix}$ und $B = \begin{pmatrix} x_{2} & x_{3} \\ 2 & 3 \\ 1 & 2 \end{pmatrix}$.
\underline{3. Iteration}
\textbf{1. Schritt} (Lösung von $y^{T}B = c_{B}^{T}$):\\
Es gilt $c_{B}^{T} = \begin{pmatrix} 6 & 9 \end{pmatrix}$. Das Gleichungssystem $y^{T}B = c_{B}^{T}$ lautet
\begin{alignat*}{3}
2y_{1} &+& y_{2} &=& 6 \\
3y_{1} &+& 2y_{2} &=& 9
\end{alignat*}
Daraus ergibt sich dieses LGS:
\begin{alignat*}{3}
I & 2y_{1} &+& y_{2} &=& 6 \\
II & 3y_{1} &+& 2y_{2} &=& 9 \\
II - I & y_{1} &+& y_{2} &=& 3 \\
\Leftrightarrow & y_{1} && &=& 3 - y_{2} \\
\intertext{Einsetzen in I}
\Rightarrow & 2(3 - y_{2}) &+& y_{2} &=& 6 \\
\Leftrightarrow & 6 - 2y_{2} &+& y_{2} &=& 6 \\
\Leftrightarrow & &-& y_{2} &=& 0 \\
\intertext{Einsetzen in I}
\Rightarrow & 2y_{1} && &=& 6 \\
\Leftrightarrow & y_{1} && &=& 3 \\
\intertext{Einsetzen in II}
\Rightarrow & 3 \cdot 3 && &=& 9 \\
\Leftrightarrow & 9 && &=& 9
\end{alignat*}
Also gilt $y^{T} = \begin{pmatrix} 3 & 0 \end{pmatrix}$.
\textbf{2. Schritt} (Bestimmung der Eingangsspalte a und gleichzeitig der Eingangsvariablen):\\
Es gilt $A_{N} = \begin{pmatrix} x_{1} & x_{6} & x_{5} & x_{4} \\ 1 & 0 & 1 & 1 \\ 1 & 1 & 0 & 3 \end{pmatrix},\; y^{T}A_{N} = \begin{pmatrix} 3 & 0 & 3 & 3 \end{pmatrix}$ und $c_{N}^{T} = \begin{pmatrix} 5 & 0 & 0 & 8\end{pmatrix}$. Also kommen nur die erste und die letzte Spalte von $A_{N}$ als Eingangsspalte a infrage, wir wählen $a = \begin{pmatrix} 1 \\ 3 \end{pmatrix}$; die Eingangsvariable ist $x_{4}$.
\textbf{3. Schritt} (Lösung von $Bd = a$):\\
Das Gleichungssystem $Bd = a$ lautet
\begin{alignat*}{3}
2d_{1} &+& 3d_{2} &=& 1\\
d_{1} &+& 2d_{2} &=& 3
\end{alignat*}
Daraus ergibt sich dieses LGS:
\begin{alignat*}{3}
I & 2d_{1} &+& 3d_{2} &=& 1 \\
II & d_{1} &+& 2d_{2} &=& 3 \\
I - II & d_{1} &+& d_{2} &=& -2 \\
\Leftrightarrow & d_{1} && &=& -2 - d_{2} \\
\intertext{Einsetzen in II}
\Rightarrow & -2 - d_{2} &+& 2d_{2} &=& 3 \\
\Leftrightarrow & && d_{2} &=& 5 \\
\intertext{Einsetzen in I}
\Rightarrow & 2d_{1} &+& 3 \cdot 5 &=& 1 \\
\Leftrightarrow & 2d_{1} && &=& - 14 \\
\Leftrightarrow & d_{1} && &=& -7 \\
\intertext{Einsetzen in II}
\Rightarrow & -7 &+& 2 \cdot 5 &=& 3 \\
\Leftrightarrow & -7 &+& 10 &=& 3 \\
\Leftrightarrow & && 3 &=& 3
\end{alignat*}
Es folgt $d = \begin{pmatrix} -7 \\ 5 \end{pmatrix}$.
\textbf{4. Schritt} (Bestimmung der Ausgangsvariablen):\\
Die Ungleichung $x_{B}^{*} - td \geq 0$ lautet $\begin{pmatrix} 1 \\ 1 \end{pmatrix} - t \begin{pmatrix}-7 \\ 5 \end{pmatrix} \geq \begin{pmatrix} 0 \\ 0 \end{pmatrix}$. Das größte t, das dies erfüllt, ist $t = \frac{1}{5}$; für $t = \frac{1}{5}$ gilt $\begin{pmatrix} 1 \\ 1\end{pmatrix} - t \begin{pmatrix} -7 \\ 5 \end{pmatrix} = \begin{pmatrix} \frac{12}{5} \\ 0 \end{pmatrix}$, Ausgangsvariable ist $x_{3}$.
\textbf{5. Schritt} (Update von $x_{B}^{*}$ und $B$):\\
$x_{B}^{*} = \begin{pmatrix} x_{2}^{*} \\ x_{4}^{*} \end{pmatrix} = \begin{pmatrix} \frac{12}{5} \\ \frac{1}{5} \end{pmatrix}$ und $B = \begin{pmatrix} x_{2} & x_{4} \\ 2 & 1 \\ 1 & 3 \end{pmatrix}$.
\underline{4. Iteration}
\textbf{1. Schritt} (Lösung von $y^{T}B = c_{B}^{T}$):\\
Es gilt $c_{B}^{T} = \begin{pmatrix} 6 & 8 \end{pmatrix}$. Das Gleichungssystem $y^{T}B = c_{B}^{T}$ lautet
\begin{alignat*}{3}
2y_{1} &+& y_{2} &=& 6 \\
y_{1} &+& 3y_{2} &=& 8
\end{alignat*}
Es ergibt sich dieses LGS:
\begin{alignat*}{3}
I & 2y_{1} &+& y_{2} &=& 6 \\
II & y_{1} &+& 3y_{2} &=& 8 \\
II & y_{1} && &=& 8 - 3y_{2} \\
\intertext{Einsetzen in I}
\Rightarrow & 2(8 - 3y_{2}) &+& y_{2} &=& 6 \\
\Leftrightarrow & 16 - 6y_{2} &+& y_{2} &=& 6 \\
\Leftrightarrow & &-& 5y_{2} &=& -10 \\
\Leftrightarrow & && y_{2} &=& 2 \\
\intertext{Einsetzen in II}
\Rightarrow & y_{1} &+& 3 \cdot 2 &=& 8 \\
\Leftrightarrow & y_{1} && &=& 2
\end{alignat*}
Also gilt $y^{T} = \begin{pmatrix} 2 & 2 \end{pmatrix}$.
\textbf{2. Schritt} (Bestimmung der Eingangsspalte a und gleichzeitig der Eingangsvariablen):\\
Es gilt $A_{N} = \begin{pmatrix} x_{1} & x_{5} & x_{6} & x_{3} \\ 1 & 1 & 0 & 3 \\ 1 & 0 & 1 & 2 \end{pmatrix},\; y^{T}A_{N} = \begin{pmatrix} 4 & 2 & 2 & 10 \end{pmatrix}$ und $c_{N}^{T} = \begin{pmatrix} 5 & 0 & 0 & 8\end{pmatrix}$. Also kommt nur die erste Spalte von $A_{N}$ als Eingangsspalte a infrage, wir wählen $a = \begin{pmatrix} 1 \\ 1 \end{pmatrix}$; die Eingangsvariable ist $x_{1}$.
\textbf{3. Schritt} (Lösung von $Bd = a$):\\
Das Gleichungssystem $Bd = a$ lautet
\begin{alignat*}{3}
2d_{1} &+& d_{2} &=& 1\\
d_{1} &+& 3d_{2} &=& 1
\end{alignat*}
Daraus ergibt sich dieses LGS:
\begin{alignat*}{3}
I & 2d_{1} &+& d_{2} &=& 1 \\
II & d_{1} &+& 3d_{2} &=& 1 \\
II & d_{1} && &=& 1 - 3d_{2} \\
\intertext{Einsetzen in I}
\Rightarrow & 2(1 - 3d_{2}) &+& d_{2} &=& 1 \\
\Leftrightarrow & 2 - 6d_{2} &+& d_{2} &=& 1 \\
\Leftrightarrow & &-& 5d_{2} &=& -1 \\
\Leftrightarrow & && d_{2} &=& \frac{1}{5} \\
\intertext{Einsetzen in II}
\Rightarrow & d_{1} &+& 3 \cdot \frac{1}{5} &=& 1 \\
\Leftrightarrow & d_{1} && &=& \frac{2}{5} \\
\intertext{Einsetzen in I}
\Rightarrow & 2 \cdot \frac{2}{5} &+& \frac{1}{5} &=& 1 \\
\Leftrightarrow & \frac{4}{5} &+& \frac{1}{5} &=& 1 \\
\Leftrightarrow & && 1 &=& 1
\end{alignat*}
Es folgt $d = \begin{pmatrix} \frac{2}{5} \\ \frac{1}{5} \end{pmatrix}$.
\textbf{4. Schritt} (Bestimmung der Ausgangsvariablen):\\
Die Ungleichung $x_{B}^{*} - td \geq 0$ lautet $\begin{pmatrix} \frac{12}{5} \\ \frac{1}{5} \end{pmatrix} - t \begin{pmatrix} \frac{2}{5} \\ \frac{1}{5} \end{pmatrix} \geq \begin{pmatrix} 0 \\ 0 \end{pmatrix}$. Das größte t, das dies erfüllt, ist $t = 1$; für $t = 1$ gilt $\begin{pmatrix} \frac{12}{5} \\ \frac{1}{5}\end{pmatrix} - t \begin{pmatrix} \frac{2}{5} \\ \frac{1}{5} \end{pmatrix} = \begin{pmatrix} 2 \\ 0 \end{pmatrix}$, Ausgangsvariable ist $x_{4}$.
\textbf{5. Schritt} (Update von $x_{B}^{*}$ und $B$):\\
$x_{B}^{*} = \begin{pmatrix} x_{2}^{*} \\ x_{1}^{*} \end{pmatrix} = \begin{pmatrix} 2 \\ 1 \end{pmatrix}$ und $B = \begin{pmatrix} x_{2} & x_{1} \\ 2 & 1 \\ 1 & 1 \end{pmatrix}$.
\underline{5. Iteration}
\textbf{1. Schritt} (Lösung von $y^{T}B = c_{B}^{T}$):\\
Es gilt $c_{B}^{T} = \begin{pmatrix} 6 & 5 \end{pmatrix}$. Das Gleichungssystem $y^{T}B = c_{B}^{T}$ lautet
\begin{alignat*}{3}
2y_{1} &+& y_{2} &=& 6 \\
y_{1} &+& y_{2} &=& 5
\end{alignat*}
Es ergibt sich dieses LGS:
\begin{alignat*}{3}
I & 2y_{1} &+& y_{2} &=& 6 \\
II & y_{1} &+& y_{2} &=& 5 \\
I - II & y_{1} && &=& 1 \\
\intertext{Einsetzen in II}
\Rightarrow & 1 &+& y_{2} &=& 5 \\
\Leftrightarrow & && y_{2} &=& 4 \\
\intertext{Einsetzen in I}
\Rightarrow & 2 \cdot 1 &+& 4 &=& 6 \\
\Leftrightarrow & && 6 &=& 6
\end{alignat*}
Also gilt $y^{T} = \begin{pmatrix} 1 & 4 \end{pmatrix}$.
\textbf{2. Schritt} (Bestimmung der Eingangsspalte a und gleichzeitig der Eingangsvariablen):\\
Es gilt $A_{N} = \begin{pmatrix} x_{4} & x_{5} & x_{6} & x_{3} \\ 1 & 1 & 0 & 3 \\ 3 & 0 & 1 & 2 \end{pmatrix},\; y^{T}A_{N} = \begin{pmatrix} 13 & 1 & 4 & 11 \end{pmatrix}$ und $c_{N}^{T} = \begin{pmatrix} 8 & 0 & 0 & 9\end{pmatrix}$. Wegen $13 \geq 8, 1 \geq 0, 4 \geq 0, 11 \geq 9$ ist die aktuelle Lösung optimal. Die optimale Lösung lautet $x_{1}^{*} = 1, x_{2}^{*} = 2, x_{3}^{*} = 0, x_{4}^{*} = 0$ mit $z^{*} = 5x_{1}^{*} + 6x_{2}^{*} + 9x_{3}^{*} + 8x_{4}^{*} = 21$.
\end{document}

View File

@ -0,0 +1,197 @@
#lang racket
#|
SE 3 Funktional Blatt 7
Abgebende: Jim 2martens, Britta 2noack, Jan-Simon 0giesel
|#
; 1)
; allgemeine rekursive Version
(define (produkt1 n f)
(letrec ((rec (λ (xs r)
(if [empty? xs]
r
(rec
(cdr xs)
(cons (* (car xs) f) r))))))
(reverse (rec n '()))))
; endrekursive Version
(define (produkt2 n f)
(let ((revList (reverse n)))
(letrec ((rec (λ (xs acc)
(if (empty? xs)
acc
(rec
(cdr xs)
(cons (* (car xs) f) acc)
)
))))
(rec revList '()))))
; Funktionen höherer Ordnung
(define (produkt3 n f)
(map (curryr * f) n))
; 2)
; 2.1
; Eine Liste mit sieben Elementen, die je eine Leuchtdiode
; repräsentieren. Jedes Element ist entweder #f oder #t.
; -1-
;| |
;2 3
;| |
; -4-
;| |
;5 6
;| |
; -7-
; Die Leuchtdioden werden in dieser Reihenfolge in der Liste
; angegeben.
; Die möglichen Zustände für die Zahlen 0-9 werden mithilfe
; einer Liste von oben beschriebenen Listen realisiert.
(define zustandstabelle
'((0 . (#t #t #t #f #t #t #t))
(1 . (#f #f #t #f #f #t #f))
(2 . (#t #f #t #t #t #f #t))
(3 . (#t #f #t #t #f #t #t))
(4 . (#f #t #t #t #f #t #f))
(5 . (#t #t #f #t #f #t #t))
(6 . (#t #t #f #t #t #t #t))
(7 . (#t #f #t #f #f #t #f))
(8 . (#t #t #t #t #t #t #t))
(9 . (#t #t #t #t #f #t #t))))
(define (key->value key tabelle)
(cdr (assoc key tabelle)))
; 2.2
(require 2htdp/image)
; erzeugte ein senkrechtes Segment
(define (zeichneSegmentSenkrecht active)
(if active
(rectangle 10 80 "solid" "Red")
(rectangle 10 80 "solid" "DimGray")
))
; erzeugt ein waagerechtes Segment
(define (zeichneSegmentWaagerecht active)
(if active
(rectangle 80 10 "solid" "Red")
(rectangle 80 10 "solid" "DimGray")
))
; zeichnet die Segmente
(define (zeichneSegmente zustand)
(beside
; Segmente 2 und 5
(above
(zeichneSegmentSenkrecht (cadr zustand))
(rectangle 10 10 "solid" "Black")
(zeichneSegmentSenkrecht (cadddr (cdr zustand)))
)
; Segmente 1, 4 und 7
(above
(zeichneSegmentWaagerecht (car zustand))
(rectangle 80 80 "solid" "Black")
(zeichneSegmentWaagerecht (cadddr zustand))
(rectangle 80 80 "solid" "Black")
(zeichneSegmentWaagerecht (cadddr (cdddr zustand)))
)
; Segmente 3 und 6
(above
(zeichneSegmentSenkrecht (caddr zustand))
(rectangle 10 10 "solid" "Black")
(zeichneSegmentSenkrecht (cadddr (cddr zustand)))
)
))
; zeigt eine Sieben-Segment-Anzeige
(define (zeigeSiebenSegment zustand)
(overlay
(zeichneSegmente zustand)
(rectangle 100 200 "solid" "Black")
))
; 2.3
(define (zeige-7segment t)
(let ((zustand (floor (/ t 28))))
(if (and [exact? zustand]
[< zustand 10])
(zeigeSiebenSegment (key->value zustand zustandstabelle))
(zeigeSiebenSegment (key->value (- zustand 10) zustandstabelle)))))
(require 2htdp/universe)
; zum Animieren auskommentieren
;(animate zeige-7segment)
; 2.4
; Für die Darstellung von 6 Anzeigen müssen 6 Zustands-
; variablen eingeführt werden, die den Zustand für jede
; der sechs Anzeigen repräsentieren.
; Dazu muss die eben definierte Funktion dahingehend
; erweitert werden.
; Die Anzeigen seien von links nach rechts mit 1 bis 6 bezeichnet.
; modT entspricht dem Rest der Division t durch 2419200.
; Anzeige 6 schaltet auf 1, wenn modT 28 ist und auf 2 wenn modT 56 ist, etc.
; Anzeige 5 schaltet auf 1, wenn Anzeige 1 auf 10 ist und
; auf 2 wenn 6 auf 20 ist, etc.
; Anzeige 4 schaltet auf 1, wenn Anzeige 5 auf 6 ist und
; auf 2 wenn 5 auf 12 ist, etc.
; Anzeige 3 schaltet auf 1, wenn Anzeige 4 auf 10 ist und
; auf 2 wenn 4 auf 20 ist, etc.
; Anzeige 2 schaltet auf 1, wenn Anzeige 3 auf 6 ist und
; auf 2 wenn 3 auf 12 ist, etc.
; Anzeige 1 schaltet auf 1, wenn Anzeige 2 auf 10 ist und
; auf 2 wenn 2 auf 20 ist, etc.
(define trenner
(underlay/xy
(underlay/xy
(rectangle 100 200 'solid 'black)
40
70
(rectangle 20 20 'solid 'red)
)
40
140
(rectangle 20 20 'solid 'red)
))
(define trenner2
(rectangle 10 200 "solid" "Black"))
; diese Funktion wird bis 99h 59m 59s zählen und dann wieder bei 0
; anfangen
(define (zeigedauer t)
(let* ((modT (modulo t 10080000)) ; 10080000 entspricht 100h
(zustand6 (floor (/ modT 28)))
(zustand5 (floor (/ zustand6 10)))
(zustand4 (floor (/ zustand5 6)))
(zustand3 (floor (/ zustand4 10)))
(zustand2 (floor (/ zustand3 6)))
(zustand1 (floor (/ zustand2 10))))
(beside
(zeigeSiebenSegment (key->value (modulo zustand1 10) zustandstabelle))
trenner2
(zeigeSiebenSegment (key->value (modulo zustand2 10) zustandstabelle))
trenner
(zeigeSiebenSegment (key->value (modulo zustand3 6) zustandstabelle))
trenner2
(zeigeSiebenSegment (key->value (modulo zustand4 10) zustandstabelle))
trenner
(zeigeSiebenSegment (key->value (modulo zustand5 6) zustandstabelle))
trenner2
(zeigeSiebenSegment (key->value (modulo zustand6 10) zustandstabelle)))
))
; zum Animieren auskommentieren
; (animate zeigedauer)