Travelling Salesman Problem (TSP)

Slides:



Advertisements
Ähnliche Präsentationen
Message Passing Interface (MPI)
Advertisements

Anzahl der ausgefüllten und eingesandten Fragebögen: 211
Kapitel 9: Graphdurchlauf
Vorlesung: 1 Betriebliche Informationssysteme 2003 Prof. Dr. G. Hellberg Studiengang Informatik FHDW Vorlesung: Betriebliche Informationssysteme Teil3.
Einführung in die Informatik: Programmierung und Software-Entwicklung
LS 2 / Informatik Datenstrukturen, Algorithmen und Programmierung 2 (DAP2)
LS 2 / Informatik Datenstrukturen, Algorithmen und Programmierung 2 (DAP2)
Modelle und Methoden der Linearen und Nichtlinearen Optimierung (Ausgewählte Methoden und Fallstudien) U N I V E R S I T Ä T H A M B U R G November 2011.
Verteilte Software - Java - Prozedurale Programmierung 1
Prof. Dr.-Ing. habil. B. Steinbach - Informatik / Softwaretechnologie und Programmierungstechnik - Institut für Informatik Verteilte Software - Java -
1 JIM-Studie 2010 Jugend, Information, (Multi-)Media Landesanstalt für Kommunikation Baden-Württemberg (LFK) Landeszentrale für Medien und Kommunikation.
= = = = 47 = 47 = 48 = =
Binäre Bäume Richard Göbel.
Rechneraufbau & Rechnerstrukturen, Folie 2.1 © W. Oberschelp, G. Vossen W. Oberschelp G. Vossen Kapitel 2.
Mh9S170Nr6 a. x1= –9; x2 = 1 b. x1= –4; x2 = 1 c. x1= 1; x2 = 2 d. leer e. x1= –15; x2 = 4,2 f. x1= –3,53; x2 = 1,28 g. leer h. x1= 0,2; x2 = 2 i. x1=
3.1.4 Leser/Schreiber-Ausschluß (reader/writer exclusion)
Vorlesung: 1 Betriebliche Informationssysteme 2003 Prof. Dr. G. Hellberg Studiengang Informatik FHDW Vorlesung: Betriebliche Informationssysteme Teil2.
PKJ 2005/1 Stefan Dissmann Rückblick auf 2005 Was zuletzt in 2005 vorgestellt wurde: Klassen mit Attributen, Methoden und Konstruktoren Referenzen auf.
PKJ 2005/1 Stefan Dissmann Zusammenfassung Bisher im Kurs erarbeitete Konzepte(1): Umgang mit einfachen Datentypen Umgang mit Feldern Umgang mit Referenzen.
PKJ 2005/1 Stefan Dissmann Zusammenfassung der Vorwoche Variable stehen für (einen) Wert, der sich im Programmablauf ändern kann. Variablen besitzen einen.
Maxwell-Boltzmann Ausgewählte Themen des analogen Schaltungsentwurfs
Prof. Dr. Bernhard Wasmayr
Studienverlauf im Ausländerstudium
LS 2 / Informatik Datenstrukturen, Algorithmen und Programmierung 2 (DAP2)
Prof. Dr. Bernhard Wasmayr VWL 2. Semester
Kapitel 10: Graphalgorithmen
AWA 2007 Natur und Umwelt Natürlich Leben
FH-Hof Sortieren mit Binären Bäumen Richard Göbel.
Rechneraufbau & Rechnerstrukturen, Folie 12.1 © W. Oberschelp, G. Vossen W. Oberschelp G. Vossen Kapitel 12.
1 Status Index Politikergebnisse Management Index Reformfähigkeit Exekutivkapazität Beteiligungskompetenz Gestaltungsfähigkeit Ressourceneffizienz Internationale.
PRJ 2007/1 Stefan Dissmann Verkettete datenstruktur: Liste Problem: Liste, die eine beliebige Zahl von Elementen verwaltet Operationen: Erzeugen, Anfügen,
Bild 1.1 Copyright © Alfred Mertins | Signaltheorie, 2. Auflage Vieweg+Teubner PLUS Zusatzmaterialien Vieweg+Teubner Verlag | Wiesbaden.
20:00.
Die Geschichte von Rudi
Zusatzfolien zu B-Bäumen
WIRTSCHAFTSLAGE NOCH SCHWIERIG
In der Schule.
GWDG – Kurs Parallelrechner-Programmierung mit MPI MPI Punkt-zu-Punkt-Kommunikation Oswald Haan
Programmierung paralleler Algorithmen mit MPI
CHART 1 Ergebnisse in Prozent Dokumentation der Umfrage BR P4.T: n=1000 Telefonische CATI - Interviews repräsentativ für die oberösterreichische.
Eine Einführung in die CD-ROM
GBI Genios Wiso wiso bietet Ihnen das umfassendste Angebot deutsch- und englischsprachiger Literatur für die Wirtschafts- und Sozialwissenschaften. Wir.
für Weihnachten oder als Tischdekoration für das ganze Jahr
1 Ein kurzer Sprung in die tiefe Vergangenheit der Erde.
Wir üben die Malsätzchen
Werde Mahlreihen Profi !
Effiziente Algorithmen Hartmut Klauck Universität Frankfurt SS
Real Time Operating System
PROCAM Score Alter (Jahre)
Ertragsteuern, 5. Auflage Christiana Djanani, Gernot Brähler, Christian Lösel, Andreas Krenzin © UVK Verlagsgesellschaft mbH, Konstanz und München 2012.
Geometrische Aufgaben
Symmetrische Blockchiffren DES – der Data Encryption Standard
Zahlentheorie und Zahlenspiele Hartmut Menzer, Ingo Althöfer ISBN: © 2014 Oldenbourg Wissenschaftsverlag GmbH Abbildungsübersicht / List.
MINDREADER Ein magisch - interaktives Erlebnis mit ENZO PAOLO
1 (C)2006, Hermann Knoll, HTW Chur, FHO Quadratische Reste Definitionen: Quadratischer Rest Quadratwurzel Anwendungen.
Schutzvermerk nach DIN 34 beachten 20/05/14 Seite 1 Grundlagen XSoft Lösung :Logische Grundschaltung IEC-Grundlagen und logische Verknüpfungen.
Folie Beispiel für eine Einzelauswertung der Gemeindedaten (fiktive Daten)
Launch ON Global.vi System ID object name classname Services to suscribe Observer Control Ref vi-path Service name Step 1 : Objects register to the Global.vi´s,
1 Mathematical Programming Nichtlineare Programmierung.
GWDG – Kurs Parallelrechner-Programmierung mit MPI MPI Kollektive Operationen Oswald Haan
Unternehmensbewertung Thomas Hering ISBN: © 2014 Oldenbourg Wissenschaftsverlag GmbH Abbildungsübersicht / List of Figures Tabellenübersicht.
GWDG – Kurs Parallelrechner-Programmierung mit MPI MPI Punkt-zu-Punkt-Kommunikation Oswald Haan
Es war einmal ein Haus
Folie Einzelauswertung der Gemeindedaten
Numbers Greetings and Good-byes All about Me Verbs and Pronouns
Alois Schütte Advanced System Programming 2 Interprozeßkommunikation  2.1 JVM Ablaufumgebung  2.2 Java Native Interface (JNI)  Verwendung von.
Datum:17. Dezember 2014 Thema:IFRS Update zum Jahresende – die Neuerungen im Überblick Referent:Eberhard Grötzner, EMA ® Anlass:12. Arbeitskreis Internationale.
1 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt Wie.
Technische Kommunikation
1 Medienpädagogischer Forschungsverbund Südwest KIM-Studie 2014 Landesanstalt für Kommunikation Baden-Württemberg (LFK) Landeszentrale für Medien und Kommunikation.
 Präsentation transkript:

Travelling Salesman Problem (TSP) UNIVERSITÄT HAMBURG FACHBEREICH INFORMATIK Praktikum „Parallele Programmierung“ Travelling Salesman Problem (TSP) von Ihar Aleinikau Olesja Aleinikau & Timo Dahlbüdding

1. Problemstellung Aufgabe des TSP (auch des Rundreiseproblems): Ein Handlungsreisender soll, ausgehend von einer Stadt, weitere Städte (n-1-Stück) genau einmal durchreisen und am Ende wieder in die Ausgangsstadt zurückkehren. Gesucht ist die Reihenfolge, in der der Handlungsreisende die n Städte besuchen muss, damit die Reise möglichst kurz ist.

2. Lösungsansatz  

2. Lösungsansatz  

2. Lösungsansatz Lösung: Eine Karte von genmap zu generieren Definieren von Coordinator und Worker: Zyklen mit der Erwartung von Nachrichten Path Shortest; LIST queue; Path *path = new Path; queue.Insert(path, 0); Shortest.length = INT_MAX; debug("Coordinator started"); while (nwait < NumProcs-1) – Hauptbedingung in Coordinator void Coordinator() {     MPI_Status status;     Msg_t msg;     int* waiting = new int[NumProcs];     int nwait = 0;     int bpath = 0;    

2. Lösungsansatz Lösung: // Blocking receive     MPI_Recv(&msg, MSGSIZE, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);     debug("Coordinator got message: tag=%d, size=%d", status.MPI_TAG, MSGSIZE); Ausführen den Zyklus bis alle Worker fertig sind.

2. Lösungsansatz Lösung: void Worker() {     MPI_Status status;     Msg_t msg;     int shortestLength = INT_MAX;     debug("Worker %d started", myrank);     // Request path tag     MPI_Send(NULL, 0, MPI_INT, 0, GET_PATH_TAG, MPI_COMM_WORLD);     while(1) {     // Receive     MPI_Recv(&msg, MSGSIZE, MPI_INT, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &status);      // Process done tag if (status.MPI_TAG == DONE_TAG) { debug("Worker %d received DONE_TAG", myrank); break; } // Update best path tag if (status.MPI_TAG == UPDATE_BEST_PATH_TAG) { debug("Worker %d received UPDATE_BEST_PATH_TAG to %d", myrank, msg.length); shortestLength = msg.length; continue;

2. Lösungsansatz Lösung: Berechnen die kürzeste Rundreise:    case BEST_PATH_TAG:         if (msg.length < Shortest.length) {             bpath++;             debug("Got best path %d, source = %d, length = %d", bpath, status.MPI_SOURCE, msg.length);             Shortest.Set(msg.length, msg.city, NumCities);             for(int i = 1;i < NumProcs;i++)             MPI_Send(&(Shortest.length), 1, MPI_INT, i, UPDATE_BEST_PATH_TAG, MPI_COMM_WORLD);         }         break;

3. Ergebnisse Beispiel: n=5 mit 5 parallelen Prozessen (Coordinator und 4 Workers) root@debian:/home/wirox/Downloads/tsp# ./genmap.sh 5 |mpirun -np 5 ./tsp -d DEBUG: Started worker 0 DEBUG: Fill dist called from rank 0 DEBUG: Started worker 3 Number of cities: 5    48   13   12   24   47    23   23   16   67   38    32   61   27   25   37    90   29   56   50   53    23   64   40   36   85 DEBUG: Coordinator started DEBUG: Fill dist called from rank 3 DEBUG: Coordinator got message: tag=0, size=27 DEBUG: Worker 3 has obtained number of cities: 5 DEBUG: Coordinator got message: tag=1, size=27 DEBUG: Worker 3 has obtained dist matrix

3. Ergebnisse Beispiel: n=5 mit 5 parallelen Prozessen (Coordinator und 4 Workers) DEBUG: Worker 3 started DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Started worker 1 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=2, size=27

3. Ergebnisse Beispiel: n=5 mit 5 parallelen Prozessen (Coordinator und 4 Workers) DEBUG: Worker 4 started DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Worker 1 has obtained dist matrix DEBUG: Worker 1 started DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=3, size=27 DEBUG: Got best path 1, source = 4, length = 130 DEBUG: Coordinator got message: tag=4, size=27

3. Ergebnisse Beispiel: n=5 mit 5 parallelen Prozessen (Coordinator und 4 Workers) DEBUG: Worker 1 received UPDATE_BEST_PATH_TAG to 130 DEBUG: Worker 3 received UPDATE_BEST_PATH_TAG to 130 DEBUG: Worker 4 received UPDATE_BEST_PATH_TAG to 130 DEBUG: Coordinator got message: tag=3, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=3, size=27 DEBUG: Got best path 2, source = 3, length = 127 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Worker 1 received UPDATE_BEST_PATH_TAG to 127 DEBUG: Worker 3 received UPDATE_BEST_PATH_TAG to 127 DEBUG: Worker 4 received UPDATE_BEST_PATH_TAG to 127 DEBUG: Coordinator got message: tag=3, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=2, size=27

3. Ergebnisse Beispiel: n=5 mit 5 parallelen Prozessen (Coordinator und 4 Workers) DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=2, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Coordinator got message: tag=4, size=27 DEBUG: Started worker 2 DEBUG: Fill dist called from rank 2 DEBUG: Coordinator got message: tag=0, size=27 DEBUG: Worker 2 has obtained number of cities: 5 DEBUG: Coordinator got message: tag=1, size=27 DEBUG: Worker 2 has obtained dist matrix

3. Ergebnisse Beispiel: n=5 mit 5 parallelen Prozessen (Coordinator und 4 Workers) DEBUG: Worker 2 started DEBUG: Worker 2 received UPDATE_BEST_PATH_TAG to 130 DEBUG: Worker 2 received UPDATE_BEST_PATH_TAG to 127 DEBUG: Coordinator got message: tag=4, size=27 Shortest path:DEBUG: Worker 2 received DONE_TAG DEBUG: Worker 2 finished DEBUG: Worker 3 received DONE_TAG DEBUG: Worker 3 finished   0  2  3  1  4; length = 127 DEBUG: Worker 4 received DONE_TAG DEBUG: Worker 4 finished DEBUG: Worker 1 received DONE_TAG DEBUG: Worker 1 finished root@debian:/home/wirox/Downloads/tsp#

4. Fazit Somit habe ich gezeigt, wie das Rundreiseproblem in parallel ausgeführten Teilprozessen gelöst wird: Alle beteiligten Prozesse tauschen sich gegenseitig mit Nachrichten aus Jeder Prozess erhält eine für ihn explizit bestimmte Nachricht MPI ist Spezifikation zur Datenübertragung auf nachrichtengekoppelten Systemen Die Kommunikation erfolgt über Kommunikatoren innerhalb von bzw. zwischen Prozessgruppen

Vielen Dank für eure Aufmerksamkeit!