19
An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’ & VERIMAG MEMICS 2007 October 2007 Znojmo(CZ)

An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

Embed Size (px)

Citation preview

Page 1: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

An Efficient Algorithm

for the Computation of Optimum Paths

in Weighted Graphs

Radu Iosif, Marius Bozga, Vassiliki Sfyrla

Univ. de Grenoble ’’Joseph Fourier’’ & VERIMAG

MEMICS 2007 October 2007 Znojmo(CZ)

Page 2: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

Verimag

• Leading research center in embedded systems

• Contributes in synchronous languages, verification, testing and modelling

Page 3: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

Verimag

• Leading research center in embedded systems

• Contributes in synchronous languages, verification, testing and modelling

VerificationVerification

   ’’Are we building the product right? ’’  or

’’Does the product conform to the specifications? ’’

Page 4: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

Verification using counter automata

Counter automata represents an important class of infinite-state systems

used for verification of protocols, software, etc…

Flat counter automata are a subclass of counter automata

without nested loops

reachability and termination are decidable

In particular, reachability problem of flat counter automata is related to finding the optimal path of given length in weighted graphs [CJ’98, BIL’06]

x=x+1A B C D

x=x+1

y=y+2

x=0

Y=0

[x>y]

Page 5: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

Description of the problem (1)

Weighted Directed Graph G(V,E,w)

Vertices V := {A,B,C,D,E}

Edges E := {AB, BC, CD, DE, …}

integer weight w := {w(AB)=1, w(BC)=2,… }

Page 6: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

Description of the problem (2)

Which is the weight of the optimal path from the node A to the node E

in 1 step ?

in 2 steps ?

in 3 steps ?

in n steps ?

stepsnofpathoptimalexistsEvertextoAvertexfromwweightand

nwAEX

Page 7: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

Description of the problem (3)

Length Paths OptimalPath

Weight

1 -

Page 8: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

Description of the problem

Length Paths OptimalPath

Weight

1 -

2 -

Description of the problem (3)

Page 9: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

Description of the problem

,...35AEX

Length Paths OptimalPath

Weight

1 -

2 -

3 ACDE ACDE 5

Description of the problem (3)

Page 10: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

,...46,3

5AEX

Length Paths OptimalPath

Weight

1 -

2 -

3 ACDE ACDE 5

4 ABCDEACCDE

ABCDE 6

Description of the problem

Description of the problem (3)

Page 11: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

,...58,4

6,35AEX

Length Paths OptimalPath

Weight

1 -

2 -

3 ACDE ACDE 5

4 ABCDEACCDE

ABCDE 6

5ABACDEACDCDEACCCDE

ACDCDE 8

Description of the problem

Description of the problem (3)

Page 12: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

Length Paths OptimalPath

Weight

1 -

2 -

3 ACDE ACDE 5

4 ABCDEACCDE

ABCDE 6

5ABACDEACDCDEACCCDE

ACDCDE 8

n w

,...,...,58,4

6,35

nwAEX

Description of the problemDescription of the problem (3)

mmkkAEX 23

46

23

35

Page 13: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

Known Solution

The set can be expressed using Presburger arithmetic

This method is general but costly

• the size of the formula is linear to the size of the graph

• there are no efficient methods to simplify it

AEX

Page 14: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

Our approach (1)

finds simultaneously all sets as the least fixpoint solution of the following system of equations:

AEADACABAA XXXXX ,,,,

Definitions:

wwAandAA

BABA

mw

mw

mw

nw

nw

nnww

,min

, 2

2

1

1

21

21

12

11

12

12

12

12

11

00

13

min

min

min

min

min

ADAE

ACAD

ABADACAAAC

AAAB

AAABAA

XX

XX

XXXXX

XX

XandXX

Page 15: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

Our approach (2)

• Solving the system of equations iteratively

termination is not guaranteed

presence of loops in the weighted graph

=> accelerate, consider an augmented system, where loops are taken into account at every step:

ΝΝ

Ν

Ν

Ν

12

23

23

24

24

12

11

12

12

12

12

11

13

min

min

min

min

min

ADAE

ACAD

ABADACAAAC

AAAB

ABAA

XX

XX

XXXXX

XX

XX

Page 16: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

However, ’’optimal ratio loops’’ are enough to ensure termination

in principle, much fewer than « all » loops

12

11

12

12

12

12

11

13

min

min

min

min

min

ADAE

ACAD

ABADACAAAC

AAAB

ABAA

XX

XX

XXXXX

XX

XX

Ν

Ν

Ν

Ν

23

23

24

24

Our approach (2)

• Solving the system of equations iteratively

termination is not guaranteed

presence of loops in the weighted graph

=> accelerate, consider an augmented system, where loops are taken into account at every step:

Page 17: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

Implementation

Represent sets as semilinear sets on :

where

Finding optimal ratio loops

• using the Howard Algorithm[TCGG’98]

Implementing the min operator

using rewriting rules on semilinear sets

AEADACABAA XXXXX ,,,, 2

k

k

nw

nw

nw ...1

1

0

0

wwAAA mw

mw

mw ,&min

kk wwwandnnn ,...,,,...,, 1010

Page 18: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’

Conclusions

We introduce an innovative solution for the computation of the weight of the optimal paths of given length in weighted graphs

The results provide a technique for the analysis of flat counter automata

The method has been implemented in Java and the results are very satisfying (to be released soon)

Page 19: An Efficient Algorithm for the Computation of Optimum Paths in Weighted Graphs Radu Iosif, Marius Bozga, Vassiliki Sfyrla Univ. de Grenoble ’’Joseph Fourier’’