1 / 42

Fighting State Explosion

Fighting State Explosion. Using Petri net Invariants in State Space Construction. Quelle. K. Schmidt: Using Petri net Invariants in State Space Construction Proc. 9th Conf. Tools and Algorithms for the Construction and Analysis of Systems LNCS 2619: Seite 473-488, Springer, 2003.

rasia
Télécharger la présentation

Fighting State Explosion

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Fighting State Explosion Using Petri net Invariants in State Space Construction

  2. Quelle K. Schmidt: Using Petri net Invariants in State Space Construction Proc. 9th Conf. Tools and Algorithms for the Construction and Analysis of Systems LNCS 2619: Seite 473-488, Springer, 2003

  3. Überblick • Grundidee • Depth-first-Algorithmus • S-Invarianten-Technik • T-Invarianten-Technik • Praktische Versuche • Fazit

  4. Überblick • Grundidee • Depth-first-Algorithmus • S-Invarianten-Technik • T-Invarianten-Technik • Praktische Versuche • Fazit

  5. Grundidee 5-speisende-Philosophen-System • 242 Zustände

  6. Grundidee • 10-Philosophen-System : 59048 Zustände • 500-Philosophen-System: 3500-1 Zustände • Eigenschaften wie Deadlockfreiheit werden durch Aufstellen des Erreichbarkeitsgraphen verifiziert. • Problem: Wie können die Zustände in einem begrenzten Speicher gebracht werden, damit z.B. ein Algorithmus zum Aufstellen des Erreichbarkeitsgraphen terminiert?

  7. Grundidee • mögliche Lösungsansätze: • Die Größe der Zustände wird komprimiert. S-Invarianten-Technik • Die Anzahl der gespeicherten Zustände wird reduziert. T-Invarianten-Technik

  8. Überblick • Grundidee • Depth-first-Algorithmus • S-Invarianten-Technik • T-Invarianten-Technik • Praktische Versuche • Fazit

  9. Depth-first-Algorithmus var V: set of markings initial; var E: set of edges initial; var current: marking initial MN; procedure StateGraph () vart: transition; var Enabled: set of transitions: begin V:=V U {current}; Enabled := {t| t T  current  t - } for t in Enabled do E := E U [current,current+t+- t -] current = current+t+- t -; if current  V then StateGraph(); fi current = current+t - - t+ ; doneend. // t - = W(.,t) // t + = W(t,.)

  10. Überblick • Grundidee • Depth-first-Algorithmus • S-Invarianten-Technik • T-Invarianten-Technik • Praktische Versuche • Fazit

  11. S-Invarianten-Technik Wiederholung: • Inzidenzmatrix C(N): • jede Stelle sS einer Zeile und jede Transition tT entspricht einer Spalte der Inzidenzmatrix • C(s,t) = W(t,s) + W(s,t) • S-Invariante: • Zeilenvektor y, mit y . C(N) = 0 (0 entspricht Nullvektor) • M  [MN  : y. M = y. MN

  12. S-Invarianten-Technik • Modifiziertes Producer-Consumer-Petrinetz Inzidenzmatrix:

  13. S-Invarianten-Technik S-Invariante: (1,1,0,0,0,0,0,0)

  14. S-Invarianten-Technik • Ziel der S-Invarianten-Technik: Zustandskompression Sei y eine S-Invariante mit y(s) ≠ 0 : y. M = y. MN sS y(s) . M(s) = y. MN y(s) . M(s) = y. MN - s'S\{s} y(s') . M(s') y. MN - s'S\{s} y(s') .M(s') M(s) = y(s)

  15. S-Invarianten-Technik • Producer-Consumer-Beispiel: y. MN - s'S\{s2} y(s') . M(s') M(s2) = = y(s2) (1,1,0,0,0,0,0,0) * (1,0,0,1,1,0,0,1) - M(s1) = = 1 - M(s1) 1 Nach Schalten von p: M(s2) = 1 - M(s1) = 1 - 0 = 1

  16. S-Invarianten-Technik • Partitionierung der Stellenmenge S: s6 P = signifikante Stellen R = redundante Stellen S = P U R, P ∩ R = 0 s2 s3 s1 P R s7 s5 s4 s8 für jede Stelle rR: S-Invariante y mit y(r) ≠ 0 und r'R\{r}: y(r') = 0 Markierungen aller redundanten Stellen können durch die Markierungen der signifikanten Stellen berechnet werden

  17. S-Invarianten-Technik • Wie erfolgt die Partitionierung der Stellenmenge S ? 1. Inzidenzmatrix C(N) transponieren 2. Transponierte Matrix CT(N) in Obere-Dreiecks-Form umwandeln 3. Einteilung in head- und tail-Variablen (signifikante Stellen = head-Variablen, redundante Stellen = tail-Variablen) 4. partial-assignment durchführen (eine tail-Variable wird mit 1, allen anderen mit 0 belegt) 5. Gleichung CT(N) . y = 0 lösen

  18. S-Invarianten-Technik • Ergebnis: • Bei n linear-unabhängigen S-Invarianten können n Komponenten der Markierung weggelassen werden • für zwei erreichbare Markierungen M und M' : M = M' sP: m(s) = m'(s)

  19. S-Invarianten-Technik var V: set of markings initial; var E: set of edges initial; var current: marking initial MN; procedure StateGraph () vart: transition; var Enabled: set of transitions: begin V:=V U {current}; Enabled := {t| t T  current  t - } for t in Enabled do E := E U [current,current+t+- t -] current = current+t+- t -; ifcurrent V then StateGraph(); fi current = current+t - - t+ ; doneend. • der aktuelle Zustand ist immer komplett (current) bekannt • P-Teil (current) der Markierung wird in V und E gespeichert • Korrektheit bleibt erhalten • S-Invarianten müssen nicht bekannt sein • kleinere Vektoren beschleunigen Suchen und Einfügen in V

  20. S-Invarianten-Technik • Nach Terminierung des Algorithmus sind folgende Erreichbarkeitsgraphen des Producer-Consumer-Beispiel gespeichert: Ohne S-Invarianten Kompression Mit S-Invarianten Kompression

  21. S-Invarianten Technik • Zusammenfassung: • 30 – 50% einer Markierung muss nicht in die Datenstruktur gespeichert werden • Laufzeitverbesserung durch Beschleunigung von Such- und Einfügeoperationen aufgrund von geschrumpften Vektoren in der Datenstruktur • Der Aufwand zur Berechnung der nötigen Informationen wird überkompensiert. • Informationen können aus der Inzidenzmatrix gewonnen werden

  22. Überblick • Grundidee • Depth-first-Algorithmus • S-Invarianten-Technik • T-Invarianten-Technik • Praktische Versuche • Fazit

  23. T-Invarianten-Technik • Wiederholung: • Zustandsgleichung: M' = M + C(N) . Parikh(w) • T-Invariante: • Ganzzahliger Spaltenvektor x, mit C(N) . x = 0 • x ist trivial, wenn x = 0 gilt. • Gilt M [w M (Zyklus), dann ist Parikh(w) eine T-Invariante.

  24. T-Invarianten-Technik • Producer-Consumer-Petrinetz Inzidenzmatrix:

  25. T-Invarianten-Technik T-Invariante: (1,1,1,1)

  26. T-Invarianten-Technik • Ziel der T-Invarianten-Technik: Zustandsreduktion • Jedoch müssen so viele Zustände gespeichert werden, damit der depth-first-Algorithmus terminiert. • Zyklen gefährden das Terminieren des depth-first-Algorithmus • Mindestens ein Zustand jedes Zyklus muss abgespeichert werden.

  27. T-Invarianten-Technik Gesucht ist eine Menge Z  [MN von Zuständen,so dass jeder Zyklus im Erreichbarkeitsgraphen mindestens eine Markierung in Z hat. • Jeder Zyklus kann durch eine T-Invariante ausgedrückt werden • Ermittle Menge U von Transitionen, wobei U mindestens eine Transition jeder nicht trivialen T-Invariante hat und somit mindestens eine Transition jedes Zyklus enthält.

  28. T-Invarianten-Technik U T-Invariante x a T-Invariante y b T-Invariante z c Erreichbarkeitsgraph • jeder Zyklus im Erreichbarkeitsgraph hat einen Zustand, der mit einer Kante versehen ist, die mit einer Transition aus U gekennzeichnet ist.

  29. T-Invarianten-Technik Die Menge von Zuständen, bei denen mindestens ein Element aus U aktiviert wird, erfüllt die Anforderungen von Z.

  30. T-Invarianten-Technik • Wie findet man die Menge U ? • Für jede T-Invariante x gilt: C(N) . x = 0 • C(N) wird in Obere-Dreiecks-Form gebracht • Wird allen tail-Variablen die 0 zugeordnet, so wird der 0-Vektor als Lösung berechnet. • keine T-Invariante hat bei allen tail-Variablen eine 0. Menge U = Menge der tail-Variablen

  31. T-Invarianten-Technik • Wie findet man die Menge U ? 1. Inzidenzmatrix C(N) aufstellen 2. C(N) in Obere-Dreiecks-Form umwandeln 3. Einteilung in head- und tail-Variablen vornehmen 4. Die Menge der tail-Variablen bilden U.

  32. T-Invarianten-Technik var V: set of markings initial; var current: marking initial MN; var depth: integer initial 0; procedure TStateGraph () var t: transition; var Enabled: set of transitions: begin Enabled := {t| t T  current  t- } if Enabled ∩ U ≠ or depth mod k = 0 then V:=V U {current}; fi for t in Enabled do current = current+t+- t -; depth := depth + 1; if current  V then TStateGraph(); fi current = current+t - - t+ ; depth := depth - 1; doneend.

  33. T-Invarianten-Technik Ursprünglicher Erreichbarkeitsgraph Abgespeicherte Zustände

  34. T-Invarianten Technik • Zusammenfassung: • Erheblich weniger Speicheraufwand nötig • Laufzeit-Speicher-Verhältnis durch Variable k konfigurierbar • T-Invarianten müssen nicht berechnet werden • Informationen können aus der Inzidenzmatrix gewonnen werden

  35. Überblick • Grundidee • Depth-first-Algorithmus • S-Invarianten-Technik • T-Invarianten-Technik • Praktische Versuche • Fazit

  36. Praktische Versuche • S-Invarianten-Technik: • n-Philosophen-System: 5n Stellen, 2n linear unabhängige S-Invarianten gespeicherter Vektor um 40% reduziert • Laufzeit: 10 phil 11 phil 12 phil Zustände 59048 117146 531440 Zeit (sec) ohne Reduktion 2.7 9.8 37.7 Zeit (sec) mit Reduktion 2.1 7.7 30.3

  37. Praktische Versuche • T-Invarianten-Technik: 5 phil 6 phil 7 phil 8 phil 9 phil Zustände ohne Red. 242 728 2186 6560 19682 Zeit (sec) ohne Red. 0.03 0.04 0.08 0.23 0.76 Zustände mit Red. (k=5000) 160 530 1708 5417 16952 Zeit (sec) mit Red. (k=5000) 0.09 0.7 9.7 136.0 2177.6 Zustände mit Red. (k=20) 186 591 1828 5664 17545 Zeit (sec) mit Red. (k=20) 0.05 0.1 0.36 3.19 10.8 Zustände mit Red. (k=10) 201 629 1947 5984 18289 Zeit (sec) mit Red. (k=10) 0.04 0.07 0.19 0.59 1.8

  38. Praktische Versuche • T-Invarianten-Technik in Kombination mit partial order reduction: 100 phil 200 phil Zustände mit partial order reduction 29702 119402 Zeit (sec) mit partial order reduction 2.2 16.4 Zustände mit beiden Red. (k=5000) 10311 41093 Zeit (sec) mit beiden Red. (k=5000) 45.3 395.3 Zustände mit beiden Red. (k=20) 14502 59002 Zeit (sec) mit beiden Red. (k=20) 3.5 26.5 Zustände mit beiden Red. (k=10) 17702 71402 Zeit (sec) mit beiden Red. (k=10) 2.8 21.4

  39. Überblick • Grundidee • Depth-first-Algorithmus • S-Invarianten-Technik • T-Invarianten-Technik • Praktische Versuche • Fazit

  40. Fazit • S-Invarianten-Technik: • Verbesserung in Speicherbedarf und Laufzeit • Kompatibel zu anderen Techniken • Keine besondere Vorsicht bei Einsatz notwendig • In den Programmen LoLA, INA verwendet

  41. Fazit • T-Invarianten-Technik: • Als „standalone“-Technik nicht geeignet • Wertvoll in Kombination mit anderen Techniken • Parameter k muss sinnvoll gewählt werden • In dem Programm UPPAAL verwendet

  42. Vielen Dank für die Aufmerksamkeit !!!

More Related