Presentation is loading. Please wait.

Presentation is loading. Please wait.

Thomas Mailund and Michael Westergaard Department of Computer Science

Similar presentations


Presentation on theme: "Thomas Mailund and Michael Westergaard Department of Computer Science"— Presentation transcript:

1 Obtaining Memory-Efficient Reachability Graph Representations Using the Sweep-Line Method
Thomas Mailund and Michael Westergaard Department of Computer Science University of Aarhus Denmark March 30, 2004

2 Setting (1) We want to explicitely store the entire reachability graph, but conserve space by storing each state/node using as few bits as possible The most naїve representation of a state would store a pair (n, m) as two independent numbers, potentially wasting space (if n,m  {0, ... ,4}, we would use 2 · ceil(log(5)) = = 6 bits per state, or even = 64 bits or more, if we store them as integers) A better approach is to enumerate the syntactically possible states, and use only enough bits to distinguish between them (ceil(log(5 · 5)) = 5 bits per state) March 30, 2004

3 Setting (2) The optimal solution is to enumerate the reachable states only, and store each state using the number of bits required to distinguish them (in the example, if only 13 of the states were actually reachable, we could store each state using ceil(log(13)) = 4 bits only) Unfortunately we do not know the number of reachable states until after we have constructed the entire reachability graph. We try to address this problem here March 30, 2004

4 Outline Condensed Representation The Sweep-Line Method
On-the-fly Construction of the Condensed Representation Experimental Results March 30, 2004

5 Example (1) 2 runners in a race with 2 laps Either
t1) runner 1 finishes a lap before runner 2, t2) runner 2 finishes a lap before runner 1, or t3) both runners finish a lap at the same time A runner can be at most 1 lap ahead of the other runner In the beginning neither of the runners have finished any laps The state of the system is a pair (n, m), where n is the number of laps completed by runner 1 and m is the number of laps completed by runner 2 March 30, 2004

6 Example (2) Only some (7) of the syntactically possible states (9) are reachable At least ceil(log(9))=4 bits are used to store each state, although ceil(log(7))=3 bits would suffice In realistic examples, the number of syntactically possible states is much larger than the number of reachable states, so distinguishing only between reachable states yields a good reduction Alas, we first know the number of reachable states, when we have constructed the reachability graph At least 4 bits needed (to distinguish syntactical possible states); most would use log 3 + log 3 = 6 or more. We do not know that log 7 bits suffices till the construction is done. March 30, 2004

7 Condensed Representation
We assume that we can enumerate the transitions Assign to each reachable state a number, 0…R-1 Transition 1 2 3 5 4 6 Destination state Number of transitions State number komponont: Kender fx max antal transitioner, eller lav “bottom”-transition, som afslutter listen (log T bits) komponent: Kender antallet, og derfor hvor meget hver trans fylder (ikke paakraevet hvis transitionerne kan beregnes) komponent: Kender max antal tilstande (subst. Nummer paa sidste tilstand herfra) (log R bits) I alt R(w + log T) + A(log T + log R) bits March 30, 2004

8 Traversal of Condensed Representation
1 2 3 5 4 6 We assume the existence of a (partial) mapping next that for a state and a transition gives the next state (e.g. next((1,0), t3)=(2,1)) We have not lost any information with this reduction, so analysis is still possible; for example a depth-first traversal would look like: DFS(0, sI) proc DFS(i, m) if (visited(i)) return analyse(m) for each (t, i’) in E[i] DFS(i’, next(m, t)) end for end proc Hvis naeste tilstand eksisterer – next eksisterer for deterministiske systemer Ex Deterministic Labelled Transition Systems, Petri Nets, … March 30, 2004

9 The Sweep-Line Method Not yet discovered state sweep-line We assume a progress measure, ψ, that assigns to each state a progress value, such that s->s’ => ψ(s)≤ψ(s’) Here, we take ψ(n,m)=n All states to be processed are in front of the sweep-line All new states are added in front of the sweep-line We do not need the states behind the sweep-line; they can safely be removed from memory Discovered but unprocessed state Processed state PM: # laps completed by runner 1 To use in practise, we need a syntactical way to capture this notion of progress… progress 1 2 March 30, 2004

10 On-the-fly Construction of the Condensod Representation
New header: Number of bits used to represent the successor states On-the-fly Construction of the Condensod Representation sweep-line 2 1 3 4 5 6 State number Number of transitions Destination state Transition Now 3 bits are required Add number of bits used to store a destination node, as R is unknown Here we store transitions – they are not needed if they can be calculated progress March 30, 2004

11 Experimental Results A prototypical implementation of the described method has been made in Design/CPN, a tool for editing, simulating and analysing Coloured Petri Nets The implementation does not take into account the different sizes of the numbers, and encodes everything in a machine word March 30, 2004

12 Experimental Results (Runner Example)
PM: # laps completed by runner 1 Uses approx. 20% memory One would probably use another reduction mechanism, as the system is symmetrical in runners and # laps. March 30, 2004

13 Experimental Results (Stop and Wait Protocol)
Fairly realistic protocol PM: # succesfully received packets 40-50% slower, but only 4-5% size March 30, 2004

14 Experimental Results (Dining Philosophers)
PM: # eating philosophers Worst case scenario – lots of regress edges Small penalty in size; rather large penalty in time (actually explores twice as many states as the basic algorithm); compares fine with a penalty of approx. 50% pr explored state March 30, 2004

15 Conclusion We have seen an efficient representation of reachability graphs, and how this representation can be traversed for analysis We have seen how the efficient representation can be calculated efficiently using the sweep-line method We have seen how the method performs on some examples – basically, the method performs well when the sweep-line method performs well, i.e. for systems with a clear notion of progress March 30, 2004

16 Future Work Implementation of LTL/CTL checker
Use on more realistic examples Use the described method with methods reducing the reachability graph itself, e.g. symmetry reduction Caching idx mapping March 30, 2004

17 Non-monotone Progress Measures
If s->s’ => ψ(s)≤ψ(s’), we say that ψ is monotone If the progress measure we use is not monotone, the algorithm still works, but the generated reachability graph may be an unfolding of the real reachability graph The unfolded reachability graph and the real reachability graph are bisimilar (so CTL* is preserved) This actually happens in the Dining Philosophers example March 30, 2004

18 Non-monotone Progress Measures (2)
To the runner example, add a transition: t4) When both runners have completed the race, start over March 30, 2004


Download ppt "Thomas Mailund and Michael Westergaard Department of Computer Science"

Similar presentations


Ads by Google