Technopedia Center
PMB University Brochure
Faculty of Engineering and Computer Science
S1 Informatics S1 Information Systems S1 Information Technology S1 Computer Engineering S1 Electrical Engineering S1 Civil Engineering

faculty of Economics and Business
S1 Management S1 Accountancy

Faculty of Letters and Educational Sciences
S1 English literature S1 English language education S1 Mathematics education S1 Sports Education
teknopedia

teknopedia

teknopedia

teknopedia

teknopedia
  • Registerasi
  • Brosur UTI
  • Kip Scholarship Information
  • Performance
  1. Weltenzyklopädie
  2. Min-Plus-Matrixmultiplikations-Algorithmus – Wikipedia
Min-Plus-Matrixmultiplikations-Algorithmus – Wikipedia
aus Wikipedia, der freien Enzyklopädie

Der Min-Plus-Matrixmultiplikations-Algorithmus ist ein Algorithmus der Graphentheorie, der die kürzesten Pfade eines Graphen berechnet. Er läuft mit einer speziellen Matrizenmultiplikation und hat zudem den Vorteil, dass bei jedem Berechnungsschritt automatisch alle Informationen über erreichbare Wege innerhalb der bisher angegebenen Anzahl der Berechnungsschritte verfügbar sind. Er ist allerdings sehr rechenintensiv und daher langsam.

Definitionen

[Bearbeiten | Quelltext bearbeiten]

Gegeben seien ein gerichteter Graph G = ( V , E ) {\displaystyle G=(V,E)} {\displaystyle G=(V,E)} und eine Matrix mit Gewichten c i , j {\displaystyle c_{i,j}} {\displaystyle c_{i,j}}, wobei die Indizes i {\displaystyle i} {\displaystyle i} und j {\displaystyle j} {\displaystyle j} über die Menge V {\displaystyle V} {\displaystyle V} laufen.

Bewertungsmatrix

[Bearbeiten | Quelltext bearbeiten]

Die Kostenmatrix oder Bewertungsmatrix K {\displaystyle K} {\displaystyle K} ist dann wie folgt definiert:

k i , j = { 0   f a l l s   i = j c i , j   f a l l s   ( i , j ) ∈ E ∞   s o n s t {\displaystyle k_{i,j}={\begin{cases}0~\mathrm {falls} ~i=j\\c_{i,j}~\mathrm {falls} ~(i,j)\in E\\\infty ~\mathrm {sonst} \end{cases}}} {\displaystyle k_{i,j}={\begin{cases}0~\mathrm {falls} ~i=j\\c_{i,j}~\mathrm {falls} ~(i,j)\in E\\\infty ~\mathrm {sonst} \end{cases}}}

Entfernungsmatrix

[Bearbeiten | Quelltext bearbeiten]

Die Entfernungsmatrix D {\displaystyle D} {\displaystyle D} ist wie folgt definiert

d i , j = { 0 ,   f a l l s   i = j L a ¨ n g e   d e s   k u ¨ r z e s t e n   W e g e s   v o n   i   n a c h   j ∞ ,   f a l l s   e s   k e i n e n   W e g   g i b t   {\displaystyle d_{i,j}={\begin{cases}0,~\mathrm {falls} ~i=j\\\mathrm {L{\ddot {a}}nge~des~k{\ddot {u}}rzesten~Weges~von~} i\mathrm {~nach~} j\\\infty ,~\mathrm {falls~es~keinen~Weg~gibt} ~\end{cases}}} {\displaystyle d_{i,j}={\begin{cases}0,~\mathrm {falls} ~i=j\\\mathrm {L{\ddot {a}}nge~des~k{\ddot {u}}rzesten~Weges~von~} i\mathrm {~nach~} j\\\infty ,~\mathrm {falls~es~keinen~Weg~gibt} ~\end{cases}}}

Matrizenoperation ⊕

[Bearbeiten | Quelltext bearbeiten]

F , G {\displaystyle F,G} {\displaystyle F,G} seien zwei n × n {\displaystyle n\times n} {\displaystyle n\times n}-Matrizen. Die Matrix H = F ⊕ G {\displaystyle H=F\oplus G} {\displaystyle H=F\oplus G} berechnet sich wie folgt:

h i , j = min { f i , l + g l , j ∣ l ∈ { 1 , … , n } } {\displaystyle h_{i,j}=\min\{f_{i,l}+g_{l,j}\mid l\in \{1,\dots ,n\}\}} {\displaystyle h_{i,j}=\min\{f_{i,l}+g_{l,j}\mid l\in \{1,\dots ,n\}\}}

wobei gelten soll a + ∞ = ∞ + a = ∞ {\displaystyle a+\infty =\infty +a=\infty } {\displaystyle a+\infty =\infty +a=\infty }.

⊕ {\displaystyle \oplus } {\displaystyle \oplus } ist also die Multiplikation von Matrizen über einem Halbring mit ( 0 , 1 , + , ⋅ ) := ( ∞ , 0 , min , + ) {\displaystyle (0,1,+,\cdot ):=(\infty ,0,\operatorname {min} ,+)} {\displaystyle (0,1,+,\cdot ):=(\infty ,0,\operatorname {min} ,+)}.

Statt K ⊕ K {\displaystyle K\oplus K} {\displaystyle K\oplus K} schreiben wir kurz K [ 2 ] {\displaystyle K^{[2]}} {\displaystyle K^{[2]}}.

K [ i + 1 ] = K [ i ] ⊕ K {\displaystyle K^{[i+1]}=K^{[i]}\oplus K} {\displaystyle K^{[i+1]}=K^{[i]}\oplus K}

Zusammenhang mit Kürzesten Pfaden

[Bearbeiten | Quelltext bearbeiten]

Für einen gerichteten Graph G = ( V , E ) {\displaystyle G=(V,E)} {\displaystyle G=(V,E)} mit positiven Kantengewichten c i , j {\displaystyle c_{i,j}} {\displaystyle c_{i,j}} (oder mit konservativer Gewichtsfunktion) gilt:

  • Die Matrix K [ p ] = ( k i , j [ p ] ) {\displaystyle K^{[p]}=(k_{i,j}^{[p]})} {\displaystyle K^{[p]}=(k_{i,j}^{[p]})} gibt die Länge der kürzesten Pfade mit maximal p {\displaystyle p} {\displaystyle p} Kanten an. Der Eintrag k i , j [ p ] {\displaystyle k_{i,j}^{[p]}} {\displaystyle k_{i,j}^{[p]}} gibt dabei die Länges des kürzesten Pfad (mit maximal p {\displaystyle p} {\displaystyle p} Kanten) von Knoten i {\displaystyle i} {\displaystyle i} zu Knoten j {\displaystyle j} {\displaystyle j} an.
  • Wenn n {\displaystyle n} {\displaystyle n} die Anzahl der Knoten ist dann gilt K [ p ] = D {\displaystyle K^{[p]}=D} {\displaystyle K^{[p]}=D} für alle p ≥ n − 1 {\displaystyle p\geq n-1} {\displaystyle p\geq n-1}.
  • Wenn K [ p + 1 ] = K [ p ] {\displaystyle K^{[p+1]}=K^{[p]}} {\displaystyle K^{[p+1]}=K^{[p]}} dann auch K [ p ] = D {\displaystyle K^{[p]}=D} {\displaystyle K^{[p]}=D}.

Algorithmus

[Bearbeiten | Quelltext bearbeiten]

Der Min-Plus-Matrixmultiplikations-Algorithmus berechnet nun ausgehend von der Kostenmatrix K {\displaystyle K} {\displaystyle K} des Graph K [ p ] {\displaystyle K^{[p]}} {\displaystyle K^{[p]}} sodass K [ p + 1 ] = K [ p ] = D {\displaystyle K^{[p+1]}=K^{[p]}=D} {\displaystyle K^{[p+1]}=K^{[p]}=D}.

Variante 1: Berechnet K [ 2 ] , K [ 3 ] , K [ 4 ] , . . . {\displaystyle K^{[2]},K^{[3]},K^{[4]},...} {\displaystyle K^{[2]},K^{[3]},K^{[4]},...} bis K [ p + 1 ] = K [ p ] {\displaystyle K^{[p+1]}=K^{[p]}} {\displaystyle K^{[p+1]}=K^{[p]}}. Dabei wird in jedem Schritt das Ergebnis des letzten Schrittes mit der Matrix K {\displaystyle K} {\displaystyle K} multipliziert.

Variante 2: Berechnet K [ 2 ] , K [ 4 ] , K [ 8 ] , . . . {\displaystyle K^{[2]},K^{[4]},K^{[8]},...} {\displaystyle K^{[2]},K^{[4]},K^{[8]},...} bis K [ 2 ∗ p ] = K [ p ] {\displaystyle K^{[2*p]}=K^{[p]}} {\displaystyle K^{[2*p]}=K^{[p]}}. Dabei wird in jedem Schritt das Ergebnis des letzten Schrittes quadriert.

Laufzeit

[Bearbeiten | Quelltext bearbeiten]

Im Folgenden verwenden wir die Landau-Notation, um das asymptotische Verhalten der Laufzeit anzugeben. Im worst case benötigt Variante 1 Θ ( n ) {\displaystyle \Theta \left(n\right)} {\displaystyle \Theta \left(n\right)} Matrixmultiplikationen während Variante 2 nur Θ ( log ⁡ n ) {\displaystyle \Theta \left(\log n\right)} {\displaystyle \Theta \left(\log n\right)} Matrixmultiplikationen benötigt. Die Laufzeit mit der naiven Implementierung der Min-Plus-Matrixmultiplikation ist dann in Θ ( n 4 ) {\displaystyle \Theta \left(n^{4}\right)} {\displaystyle \Theta \left(n^{4}\right)} für Variante 1 und in Θ ( n 3 ⋅ log ⁡ n ) {\displaystyle \Theta \left(n^{3}\cdot \log n\right)} {\displaystyle \Theta \left(n^{3}\cdot \log n\right)} für Variante 2. Damit hat der Algorithmus eine schlechtere Laufzeit als der vergleichbare Algorithmus von Floyd und Warshall dessen Laufzeit in O ( n 3 ) {\displaystyle {\mathcal {O}}(n^{3})} {\displaystyle {\mathcal {O}}(n^{3})} ist.

Die Laufzeit kann jedoch durch kompliziertere Implementierungen der Min-Plus-Matrixmultiplikation verbessert werden.

Siehe auch

[Bearbeiten | Quelltext bearbeiten]
  • Pathfinding

Quellen

[Bearbeiten | Quelltext bearbeiten]
  • Thomas H. Cormen, Charles Leiserson, Ronald L. Rivest, Clifford Stein: Introduction to Algorithms. 2. Auflage. MIT Press, 2001, ISBN 0-262-53196-8, S. 622–627
Abgerufen von „https://de.teknopedia.teknokrat.ac.id/w/index.php?title=Min-Plus-Matrixmultiplikations-Algorithmus&oldid=161816249“
Kategorie:
  • Algorithmus (Graphentheorie)

  • indonesia
  • Polski
  • العربية
  • Deutsch
  • English
  • Español
  • Français
  • Italiano
  • مصرى
  • Nederlands
  • 日本語
  • Português
  • Sinugboanong Binisaya
  • Svenska
  • Українська
  • Tiếng Việt
  • Winaray
  • 中文
  • Русский
Sunting pranala
Pusat Layanan

UNIVERSITAS TEKNOKRAT INDONESIA | ASEAN's Best Private University
Jl. ZA. Pagar Alam No.9 -11, Labuhan Ratu, Kec. Kedaton, Kota Bandar Lampung, Lampung 35132
Phone: (0721) 702022
Email: pmb@teknokrat.ac.id