Optimised Calculation of Symmetries for State Space Reduction

Preview:

DESCRIPTION

AWPN 2010

Citation preview

Optimised Calculation ofSymmetries for State SpaceReduction

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

Overview

What are Symmetries?DefinitionCalculating Symmetries in LoLA

Optimised Calculation of SymmetriesInheritance of Dead BranchesProducts instead of PowersPartial Orthogonalisation

Experimental Results

8. Oktober 2010 c© 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 2 / 17

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

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

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

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

What are Symmetries?An Example

1

a

2 b

3c

4 d 5

e6f

1 - 12 -

8. Oktober 2010 c© 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17

What are Symmetries?An Example

1

a

2 b

3c

4 d 5

e6f

1 - 12 - 4

8. Oktober 2010 c© 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17

What are Symmetries?An Example

1

a

2 b

3c

4 d 5

e6f

1 - 12 - 4, b - d

8. Oktober 2010 c© 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17

What are Symmetries?An Example

1

a

2 b

3c

4 d 5

e6f

1 - 12 - 4, b - d3 - 5

8. Oktober 2010 c© 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17

What are Symmetries?An Example

1

a

2 b

3c

4 d 5

e6f

1 - 12 - 4, b - d3 - 5, c - e

8. Oktober 2010 c© 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17

What are Symmetries?An Example

1

a

2 b

3c

4 d 5

e6f

1 - 12 - 4, b - d3 - 5, c - e2 - 6

8. Oktober 2010 c© 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17

What are Symmetries?An Example

1

a

2 b

3c

4 d 5

e6f

1 - 12 -

8. Oktober 2010 c© 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17

What are Symmetries?An Example

1

a

2 b

3c

4 d 5

e6f

1 - 1, a - a2 - 3, b - c

8. Oktober 2010 c© 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17

What are Symmetries?An Example

1

a

2 b

3c

4 d 5

e6f

1 - 1, a - a2 - 3, b - c3 - 2, c - b

8. Oktober 2010 c© 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17

What are Symmetries?An Example

1

a

2 b

3c

4 d 5

e6f

1 - 1, a - a2 - 3, b - c3 - 2, c - b4 - 5, d - e5 - 6, e - f6 - 4, f - d

Written as a permutation:(1)(a)(2 3)(b c)(4 5 6)(d e f )

The mapping of transitions is usuallyforced, that is, (2 3)(4 5 6) suffices asa full representation.

8. Oktober 2010 c© 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 4 / 17

Caclulating Symmetries in LoLAThe 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

Caclulating Symmetries in LoLAThe 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

Calculating Symmetries in LoLABuilding 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

Calculating Symmetries in LoLAPartial Symmetries and Dead Branches

The brute-force approach recursively completes partial symmetries (starting withthe empty set) to full symmetries by assigning images to objects.

The examples assignment 1- 1, 2- 4 cannot be completed whatever wechoose 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, and6 to exclude the existence of a symmetry, i.e. it has to search this dead branchcompletely.

8. Oktober 2010 c© 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 7 / 17

Calculating Symmetries in LoLAGenerators

Symmetries can be built from a set of generators. For n objects (places) we needfrom each class S i

j (1 ≤ i ≤ j ≤ n) of symmetries with

• k - k for all k < i and

• i - j

exactly one symmetry %ij ∈ S i

j , then we can write any symmetry σ as

σ = %nmn◦ . . . ◦ %2

m2◦ %1

m1

with m1 = σ(1), m2 = (%1m1

)−1(σ(2)), m3 = (%2m2

)−1((%1m1

)−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

Optimisation: Inheritance of dead branches

PrerequisitesThe brute-force approach has shown a dead branch for some S i

j , i.e. S ij = ∅.

There is a symmetry in some S jm.

TheoremThen, S i

m = ∅ and needs not be computed by the brute-force approach.

ProofFrom %i

m ∈ S im and %j

m ∈ S jm we conclude %i

m ◦ (%jm)−1 ∈ S i

j . A contradiction.

8. Oktober 2010 c© 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 9 / 17

Optimisation: Products instead of Powers

Instead of computing only the powers σ1, σ2, σ3, . . . and checking whether thesebelong to a so far empty class S i

j , we can use all symmetries found up until now:

Building ProductsFor each newly found symmetry σ ∈ S i

j and each formerly known symmetry% ∈ Sk

m with k ≥ i we can check in O(1) if we already know of a symmetry inS i

%(j). If not, σ ◦ % ∈ S i%(j) is one.

8. Oktober 2010 c© 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 10 / 17

Optimisation: Products instead of PowersRough Complexity

If n is the number of objects (places) and m is the size of a set of generators for thesymmetries, we need for all symmetries

• for the calcuation of powers:

• n powers (up to the „identity“ S ii ) 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

Optimisation: Partial OrthogonalisationAn Example

1

a

2 b

3c

4 d 5

e6f

Generators (e.g.):• %1

1 = (2 3)(4 6 5),• %2

2 = id, %23 = (2 3)(4 5 6)

• %44 = id, %4

5 = (4 5 6), %46 = (4 6 5)

Reduction:• (%1

1)6 = id ∈ S1

1 ,• %2

2 = id, (%23)

3 = (2 3) ∈ S23• %4

4 = id, %45 = (4 5 6), %4

6 = (4 6 5)

8. Oktober 2010 c© 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 12 / 17

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 sameclass S i

j

• Can be infeasible, for an optimal power eliminate all prime factors of |GC |from |OC |

ResultPartial orthogonalisation reduces the size of the representation and partially allowsto 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

Experimental ResultsDead Branches

Let Ni be the Petri Net with i cycles of lengths from 1 to i (N3 being the examplenet). Many dead branches occur. A comparison of LoLA without and with theproposed optimisation yields:

Ni #gen LoLA-old LoLA-newN10 45 <0.1s <0.1sN15 105 0.4s 0.2sN20 190 2.4s 1.3sN25 300 8.2s 4.4sN30 435 25s 13sN35 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

Experimental ResultsProducts instead of Powers

The optimisation of using products instead of powers can be shown with a grid ofcommunication agents in d dimensions with n agents in any direction (ECHO d/n).

ECHO #symm #gen LoLA-old LoLA-new3/3 48 10 0.2s <0.1s3/5 48 10 4.6s 2.9s3/7 48 10 29s 16s4/3 384 21 3.5s 1.6s4/5 384 21 244s 96s5/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

K. Schmidt: Explicit State Space Verification, Habilitation Thesis, HumboldtUniversitä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

Thanks For Your Attention!

8. Oktober 2010 c© 2010 UNIVERSITÄT ROSTOCK | FAKULTÄT FÜR INFORMATIK & ELEKTROTECHNIK, INSTITUT FÜR INFORMATIK 17 / 17

Recommended