Optimised Calculation of Symmetries for State Space Reduction
1. Optimised Calculation of
Symmetries for State Space
Reduction
HARRO WIMMEL
Universität Rostock, Institut für Informatik
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 1 / 17
2. Overview
What are Symmetries?
Definition
Calculating Symmetries in LoLA
Optimised Calculation of Symmetries
Inheritance of Dead Branches
Products instead of Powers
Partial Orthogonalisation
Experimental Results
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 2 / 17
3. What are Symmetries?
Symmetries are Automorphisms
A symmetry maps a Petri Net onto itself:
• Places to places
• Transitions to transitions
• Edges to edges
• Tokens to tokens, if applicable
• bijectively, i.e. each object appears exactly once as image.
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 3 / 17
4. What are Symmetries?
An Example
1
a
2 b
3c
4 d 5
e6f
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17
5. What are Symmetries?
An Example
1
a
2 b
3c
4 d 5
e6f
1 -
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17
6. What are Symmetries?
An Example
1
a
2 b
3c
4 d 5
e6f
1 - 1
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17
7. What are Symmetries?
An Example
1
a
2 b
3c
4 d 5
e6f
1 - 1
2 -
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17
8. What are Symmetries?
An Example
1
a
2 b
3c
4 d 5
e6f
1 - 1
2 - 4
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17
9. What are Symmetries?
An Example
1
a
2 b
3c
4 d 5
e6f
1 - 1
2 - 4, b - d
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17
10. What are Symmetries?
An Example
1
a
2 b
3c
4 d 5
e6f
1 - 1
2 - 4, b - d
3 - 5
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17
11. What are Symmetries?
An Example
1
a
2 b
3c
4 d 5
e6f
1 - 1
2 - 4, b - d
3 - 5, c - e
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17
12. What are Symmetries?
An Example
1
a
2 b
3c
4 d 5
e6f
1 - 1
2 - 4, b - d
3 - 5, c - e
2 - 6
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17
13. What are Symmetries?
An Example
1
a
2 b
3c
4 d 5
e6f
1 - 1
2 -
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17
14. What are Symmetries?
An Example
1
a
2 b
3c
4 d 5
e6f
1 - 1, a - a
2 - 3, b - c
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17
15. What are Symmetries?
An Example
1
a
2 b
3c
4 d 5
e6f
1 - 1, a - a
2 - 3, b - c
3 - 2, c - b
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17
16. What are Symmetries?
An Example
1
a
2 b
3c
4 d 5
e6f
1 - 1, a - a
2 - 3, b - c
3 - 2, c - b
4 - 5, d - e
5 - 6, e - f
6 - 4, f - d
Written as a permutation:
(1)(a)(2 3)(b c)(4 5 6)(d e f )
The mapping of transitions is usually
forced, that is, (2 3)(4 5 6) suffices as
a full representation.
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17
17. Caclulating Symmetries in LoLA
The Implementation so far
1. Brute-force-method to calculate symmetries (see the example)
• high complexity (solves the graph isomorphism problem, unknown if polynomial)
• needs to be done at least for the first symmetry
2. Calculation of powers of symmetries
• in linear time (per power)
• needs a symmetry as input
3. Combination of these methods
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 5 / 17
18. Caclulating Symmetries in LoLA
The Implementation so far
1. Brute-force-method to calculate symmetries (see the example)
• high complexity (solves the graph isomorphism problem, unknown if polynomial)
• needs to be done at least for the first symmetry
2. Calculation of powers of symmetries
• in linear time (per power)
• needs a symmetry as input
3. Combination of these methods
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 5 / 17
19. Calculating Symmetries in LoLA
Building Powers of Symmetries
For our example σ = (2 3)(4 5 6) we calculate
• σ1
= (2 3)(4 5 6),
• σ2
= (4 6 5),
• σ3
= (2 3),
• σ4
= (4 5 6),
• σ5
= (2 3)(4 6 5),
• σ6
= id (identity).
By chance, these are all the symmetries there are.
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 6 / 17
20. Calculating Symmetries in LoLA
Partial Symmetries and Dead Branches
The brute-force approach recursively completes partial symmetries (starting with
the empty set) to full symmetries by assigning images to objects.
The examples assignment 1- 1, 2- 4 cannot be completed whatever we
choose to be the images of the places 3, 4, 5, and 6.
But: the brute-force algorithm has to check all possible assignments to 3, 4, 5, and
6 to exclude the existence of a symmetry, i.e. it has to search this dead branch
completely.
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 7 / 17
21. Calculating Symmetries in LoLA
Generators
Symmetries can be built from a set of generators. For n objects (places) we need
from each class Si
j (1 ≤ i ≤ j ≤ n) of symmetries with
• k - k for all k < i and
• i - j
exactly one symmetry i
j ∈ Si
j , then we can write any symmetry σ as
σ = n
mn
◦ . . . ◦ 2
m2
◦ 1
m1
with m1 = σ(1), m2 = ( 1
m1
)−1
(σ(2)), m3 = ( 2
m2
)−1
(( 1
m1
)−1
(σ(3))) etc.
We obtain a „small“ set of generators (compared to the number of all symmetries).
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 8 / 17
22. Optimisation: Inheritance of dead branches
Prerequisites
The brute-force approach has shown a dead branch for some Si
j , i.e. Si
j = ∅.
There is a symmetry in some Sj
m.
Theorem
Then, Si
m = ∅ and needs not be computed by the brute-force approach.
Proof
From i
m ∈ Si
m and j
m ∈ Sj
m we conclude i
m ◦ ( j
m)−1
∈ Si
j . A contradiction.
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 9 / 17
23. Optimisation: Products instead of Powers
Instead of computing only the powers σ1
, σ2
, σ3
, . . . and checking whether these
belong to a so far empty class Si
j , we can use all symmetries found up until now:
Building Products
For each newly found symmetry σ ∈ Si
j and each formerly known symmetry
∈ Sk
m with k ≥ i we can check in O(1) if we already know of a symmetry in
Si
(j). If not, σ ◦ ∈ Si
(j) is one.
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 10 / 17
24. Optimisation: Products instead of Powers
Rough Complexity
If n is the number of objects (places) and m is the size of a set of generators for the
symmetries, we need for all symmetries
• for the calcuation of powers:
• n powers (up to the „identity“ Si
i ) for m symmetries
• O(n) per power, altogether O(m ∗ n2
).
• for the calculation of products:
• m products, m < n or m > n possible, for m symmetries
• O(1) per test, if no new symmetry is obtained
• O(n) per new symmetry, altogether O(m2
+ m ∗ n)
Typically, products lead faster to more symmetries than powers.
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 11 / 17
26. Optimisation: Partial Orthogonalisation
• Generating cycle GC contains index (for 2
3 = (2 3)(4 5 6) it is
(2 3) = GC)
• All powers σ|GC|k+1
(k ∈ N) of σ contain GC
• All powers σ|OC|
( ∈ N) do not contain some other cycle OC
• Solution of |GC|k + 1 = |OC| eliminates OC and remains in the same
class Si
j
• Can be infeasible, for an optimal power eliminate all prime factors of |GC|
from |OC|
Result
Partial orthogonalisation reduces the size of the representation and partially allows
to commute symmetries, i.e. such symmetries do not influence each other.
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 13 / 17
27. Experimental Results
Dead Branches
Let Ni be the Petri Net with i cycles of lengths from 1 to i (N3 being the example
net). Many dead branches occur. A comparison of LoLA without and with the
proposed optimisation yields:
Ni #gen LoLA-old LoLA-new
N10 45 <0.1s <0.1s
N15 105 0.4s 0.2s
N20 190 2.4s 1.3s
N25 300 8.2s 4.4s
N30 435 25s 13s
N35 595 66s 34s
#gen is the size of the generator set.
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 14 / 17
28. Experimental Results
Products instead of Powers
The optimisation of using products instead of powers can be shown with a grid of
communication agents in d dimensions with n agents in any direction (ECHO d/n).
ECHO #symm #gen LoLA-old LoLA-new
3/3 48 10 0.2s <0.1s
3/5 48 10 4.6s 2.9s
3/7 48 10 29s 16s
4/3 384 21 3.5s 1.6s
4/5 384 21 244s 96s
5/3 3840 41 82s 23s
#symm is the number of all symmetries, #gen the size of the generator set.
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 15 / 17
29. K. Schmidt: Explicit State Space Verification, Habilitation Thesis, Humboldt
Universität zu Berlin, 2002.
K. Wolf: LoLA – A low level analyzer,
http://www.informatik.uni-rostock.de/∼nl/wiki/tools/lola, 2010.
W. Reisig: Elements of Distributed Algorithms, Springer Verlag, 1998.
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 16 / 17
30. Thanks For Your Attention!
8. Oktober 2010 c 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 17 / 17