Versionsvergleich
Aus ProgrammingWiki
Vergleich: 2009-05-04T08:47:08+00:00 → 2009-05-04T09:06:17+00:00
=Aufgabe 1= | |
'''Signatur:''' | |
{| | |
|- | |
| − | |Datentyp: ||priority queue |
| + | |Datentyp: ||priority_queue |
|- | |
| − | |Sorten: ||element, priority queue |
| + | |Sorten: ||element, priority_queue |
|- | |
|Konstruktoren: ||create: <math>\rightarrow</math> priority queue | |
|- | |
| − | | ||push: priority queue x element<math>\rightarrow</math> priority queue |
| + | | ||push: priority_queue <math>\times</math> element<math>\rightarrow</math> priority_queue |
|- | |
| − | |Prädikat: ||empty: priority queue <math>\rightarrow</math> {true, false} |
| + | |Prädikat: ||empty: priority_queue <math>\rightarrow</math> {true, false} |
|- | |
| − | |Selektoren: ||top: priority queue - <math>\{\epsilon\} \rightarrow</math> element |
| + | |Selektoren: ||top: priority_queue - <math>\{\epsilon\} \rightarrow</math> element |
|- | |
| − | | ||pop: priority queue - <math>\{\epsilon\} \rightarrow</math> priority queue |
| + | | ||pop: priority_queue - <math>\{\epsilon\} \rightarrow</math> priority_queue |
|} | |
'''Axiome:''' | |
{| | |
|- | |
|create = <math>\epsilon</math> ||erzeugt eine leere priority queue | |
|- | |
|empty(<math>\epsilon</math>) = true ||leere priority queue ist leer | |
|- | |
| − | |empty(push(priority queue, element)) = false ||nach push ist die priority queue nicht leer |
| + | |empty(push(priority_queue, element)) = false ||nach push ist die priority queue nicht leer |
|- | |
| − | |top(push(priority queue, element)) = element ||top gibt das Element mit der höchsten Priorität zurück |
| + | |top(push(priority_queue, element)) = element ||top gibt das Element mit der höchsten Priorität zurück |
|- | |
| − | |pop(push(priority queue, element)) = priority queue || pop entfernt das Element mit der höchsten Priorität |
| + | |pop(push(priority_queue, element)) = priority_queue || pop entfernt das Element mit der höchsten Priorität |
|} | |
=Aufgabe 2= | |
<ol> | |
<li>(10)</li> | |
<li>(10, 6.6)</li> | |
<li>(10, 9, 6.6)</li> | |
<li>(10, 9, 6.6, 5)</li> | |
<li>(10, 9, 6.6, 5, 1)</li> | |
<li>(9, 6.6, 5, 1) -> 10 wird gestrichen, da der Knoten nicht weiter expandiert werden kann, 9 wird expandiert</li> | |
<li>(12, 9, 6.6, 5, 1)</li> | |
<li>(12, 12, 9, 6.6, 5, 1) -> Die 12 aus dem zweiten Niveau steht immer noch vorn, da die 12 aus dem dritten Niveau nicht besser ist</li> | |
<li>(13, 12, 12, 9, 6.6, 5, 1)</li> | |
<li>(13, 12, 9, 6.6, 5, 1) -> 12 aus dem zweiten Niveau kann nicht mehr expandiert werden</li> | |
</ol> | |
=Aufgabe 3= | |
<center>[[Bild:Aufgabe3.png]]</center> | |
Der Ergebnissvektor lautet: <math>\vec{x}=(1,1,1,0)</math>. | |
=Aufgabe 4= | |
Um die Lösung des TSP zu überprüfen, stellen sie zuerst alle möglichen Rundreisen auf. | |
Zu jeder Rundreise berechnen sie die Länge. Die kürzeste Rundreise muss dann genau mit der übereinstimmen, | |
die wir mit branch and bound ermittelt haben. | |
=Aufgabe 5= | |
Kurzfassung der Lösung: | |
<center>[[Bild:Aufgabe5.png]]</center> | |
Die beste Route ist also Dresden, Görlitz, Zittau, Bautzen und zurück mit einer Länge von 255km. | |
Ausführliche Lösung: | |
Schritt 1: Ausgangsmatrix reduzieren | |
{|border="1" | |
|width="50pt"| '''von\nach''' | |
|width="50pt"| '''Dresden''' | |
|width="50pt"| '''Zittau''' | |
|width="50pt"| '''Görlitz''' | |
|width="50pt"| '''Bautzen''' | |
|width="50pt"| | |
|- | |
|'''Dresden''' ||<math>\infty</math> ||<math>108_{45}</math> ||<math>109_{46}</math> ||<math>63_0</math> ||63 | |
|- | |
|'''Zittau''' ||<math>114_{77}</math> ||<math>\infty</math> ||<math>37_0</math> ||<math>46_9</math> ||37 | |
|- | |
|'''Görlitz''' ||<math>110_{75}</math> ||<math>35_0</math> ||<math>\infty</math> ||<math>49_{14}</math> ||35 | |
|- | |
|'''Bautzen''' ||<math>65_{19}</math> ||<math>46_0</math> ||<math>51_5</math> ||<math>\infty</math> ||46 | |
|- | |
| ||19 ||0 ||0 ||0 ||'''200''' | |
|} | |
Schritt 2: Dresden - Zittau | |
{|border="1" | |
|width="50pt"| '''von\nach''' | |
|width="50pt"| '''Dresden''' | |
|width="50pt"| '''Zittau''' | |
|width="50pt"| '''Görlitz''' | |
|width="50pt"| '''Bautzen''' | |
|width="50pt"| | |
|- | |
|'''Dresden''' ||<math>\infty</math> ||<math>108_0</math> ||<math>\infty</math> ||<math>\infty</math> ||108 | |
|- | |
|'''Zittau''' ||<math>\infty</math> ||<math>\infty</math> ||<math>37_0</math> ||<math>46_9</math> ||37 | |
|- | |
|'''Görlitz''' ||110 ||35 ||<math>\infty</math> ||49 ||49 | |
|- | |
|'''Bautzen''' ||65 ||46 ||51 ||<math>\infty</math> ||51 | |
|- | |
| ||14 ||0 ||0 ||0 ||'''259''' | |
|} | |
Schritt 3: Dresden - Görlitz | |
{|border="1" | |
|width="50pt"| '''von\nach''' | |
|width="50pt"| '''Dresden''' | |
|width="50pt"| '''Zittau''' | |
|width="50pt"| '''Görlitz''' | |
|width="50pt"| '''Bautzen''' | |
|width="50pt"| | |
|- | |
|'''Dresden''' ||<math>\infty</math> ||<math>\infty</math> ||<math>109_0</math> ||<math>\infty</math> ||109 | |
|- | |
|'''Zittau''' ||<math>114_{68}</math> ||<math>\infty</math> ||<math>\infty</math> ||<math>46_0</math> ||46 | |
|- | |
|'''Görlitz''' ||<math>\infty</math> ||<math>35_0</math> ||<math>\infty</math> ||<math>49_{14}</math> ||35 | |
|- | |
|'''Bautzen''' ||<math>65_{19}</math> ||<math>46_0</math> ||<math>\infty</math> ||<math>\infty</math> ||46 | |
|- | |
| ||19 ||0 ||0 ||0 ||'''255''' | |
|} | |
Schritt 4: Dresden - Bautzen | |
{|border="1" | |
|width="50pt"| '''von\nach''' | |
|width="50pt"| '''Dresden''' | |
|width="50pt"| '''Zittau''' | |
|width="50pt"| '''Görlitz''' | |
|width="50pt"| '''Bautzen''' | |
|width="50pt"| | |
|- | |
|'''Dresden''' ||<math>\infty</math> ||<math>\infty</math> ||<math>\infty</math> ||<math>63_0</math> ||63 | |
|- | |
|'''Zittau''' ||<math>114_{77}</math> ||<math>\infty</math> ||<math>37_0</math> ||<math>\infty</math> ||37 | |
|- | |
|'''Görlitz''' ||<math>110_{75}</math> ||<math>35_0</math> ||<math>\infty</math> ||<math>\infty</math> ||35 | |
|- | |
|'''Bautzen''' ||<math>\infty</math> ||<math>46_0</math> ||<math>51_5</math> ||<math>\infty</math> ||46 | |
|- | |
| ||75 ||0 ||0 ||0 ||'''256''' | |
|} | |
Schritt 5: Dresden - Görlitz - Zittau | |
{|border="1" | |
|width="50pt"| '''von\nach''' | |
|width="50pt"| '''Dresden''' | |
|width="50pt"| '''Zittau''' | |
|width="50pt"| '''Görlitz''' | |
|width="50pt"| '''Bautzen''' | |
|width="50pt"| | |
|- | |
|'''Dresden''' ||<math>\infty</math> ||<math>\infty</math> ||<math>109_0</math> ||<math>\infty</math> ||109 | |
|- | |
|'''Zittau''' ||<math>\infty</math> ||<math>\infty</math> ||<math>\infty</math> ||<math>46_0</math> ||46 | |
|- | |
|'''Görlitz''' ||<math>\infty</math> ||<math>35_0</math> ||<math>\infty</math> ||<math>\infty</math> ||35 | |
|- | |
|'''Bautzen''' ||<math>65_{0}</math> ||<math>\infty</math> ||<math>\infty</math> ||<math>\infty</math> ||65 | |
|- | |
| ||0 ||0 ||0 ||0 ||'''255''' | |
|} | |
Schritt 6: Dresden - Görlitz - Bautzen | |
{|border="1" | |
|width="50pt"| '''von\nach''' | |
|width="50pt"| '''Dresden''' | |
|width="50pt"| '''Zittau''' | |
|width="50pt"| '''Görlitz''' | |
|width="50pt"| '''Bautzen''' | |
|width="50pt"| | |
|- | |
|'''Dresden''' ||<math>\infty</math> ||<math>\infty</math> ||<math>109_0</math> ||<math>\infty</math> ||109 | |
|- | |
|'''Zittau''' ||<math>114_{0}</math> ||<math>\infty</math> ||<math>\infty</math> ||<math>\infty</math> ||114 | |
|- | |
|'''Görlitz''' ||<math>\infty</math> ||<math>\infty</math> ||<math>\infty</math> ||<math>49_{0}</math> ||49 | |
|- | |
|'''Bautzen''' ||<math>\infty</math> ||<math>46_0</math> ||<math>\infty</math> ||<math>\infty</math> ||46 | |
|- | |
| ||0 ||0 ||0 ||0 ||'''318''' | |
|} | |
Schritt 7: Dresden - Görlitz - Zittau - Bautzen | |
{|border="1" | |
|width="50pt"| '''von\nach''' | |
|width="50pt"| '''Dresden''' | |
|width="50pt"| '''Zittau''' | |
|width="50pt"| '''Görlitz''' | |
|width="50pt"| '''Bautzen''' | |
|width="50pt"| | |
|- | |
|'''Dresden''' ||<math>\infty</math> ||<math>\infty</math> ||<math>109_0</math> ||<math>\infty</math> ||109 | |
|- | |
|'''Zittau''' ||<math>\infty</math> ||<math>\infty</math> ||<math>\infty</math> ||<math>46_0</math> ||46 | |
|- | |
|'''Görlitz''' ||<math>\infty</math> ||<math>35_0</math> ||<math>\infty</math> ||<math>\infty</math> ||35 | |
|- | |
|'''Bautzen''' ||<math>65_{0}</math> ||<math>\infty</math> ||<math>\infty</math> ||<math>\infty</math> ||65 | |
|- | |
| ||0 ||0 ||0 ||0 ||'''255''' | |
|} | |
[http://maps.google.de/maps?f=d&source=s_d&saddr=dresden&daddr=g%C3%B6rlitz+to:zittau+to:bautzen+to:dresden&hl=de&geocode=&mra=ls&sll=51.137085,14.35127&sspn=0.67297,1.388397&ie=UTF8&ll=51.060386,14.356384&spn=0.674088,1.388397&z=10 Google-Maps Ergebnis] |