Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Petri Nets (PNs)

Similar presentations


Presentation on theme: "Introduction to Petri Nets (PNs)"— Presentation transcript:

1 Introduction to Petri Nets (PNs)
PNs Applications in Decision Making & Project Management

2 Outline Petri nets Introduction Examples
Applications of Petri nets in Decision Making & Project Management Properties Analysis techniques Outline

3 Petri Nets (PNs) Model introduced by C.A. Petri in 1962
Ph.D. Thesis: “Communication with Automata” Applications: distributed computing, manufacturing, control, communication networks, transportation… PNs describe explicitly and graphically: sequencing/causality conflict/non-deterministic choice concurrency Asynchronous model (partial ordering) Main drawback: no hierarchy Thesis of Petri Many applications Used because it allows to represent many different constructs It is an asynchronous model and imposes only a partial order among cocncurrent operations. Now also used in System design Problem is that there is no hierarchy

4 Petri Net Graph 2 3 Bipartite weighted directed graph:
Places: circles Transitions: bars or boxes Arcs: arrows labeled with weights Tokens: black dots p2 t2 2 t1 Describe graph Place contain tokens, they an contain an infinite number p1 p4 3 t3 p3

5 Petri Net Places/Transition: conditions/events 2 3
A PN (N,M0) is a Petri Net Graph N places: represent distributed state by holding tokens marking (state) M is an n-vector (m1,m2,m3…), where mi is the non-negative number of tokens in place pi. initial marking (M0) is initial state transitions: represent actions/events enabled transition: enough tokens in predecessors firing transition: modifies marking …and an initial marking M0. What places and transitions represent. Places represent state Transitions actions See also as condition/event p2 t2 2 t1 p1 p4 3 Places/Transition: conditions/events t3 p3

6 Transition firing rule
A marking is changed according to the following rules: A transition is enabled if there are enough tokens in each input place An enabled transition may or may not fire The firing of a transition modifies marking by consuming tokens from the input places and producing tokens in the output places Firing rule: only PN rule. May or may not fire: asynchronicity 2 2 2 2 3 3

7 An Example of Transition Firing

8 Concurrency, causality, choice
Sequencing Conflict t3 t4 t6

9 Concurrency, causality, choice

10 Concurrency, causality, choice
Causality, sequencing t3 t4 t6

11 Concurrency, causality, choice
conflict t3 t4 t6

12 Concurrency, causality, choice
conflict t3 t4 t6

13 Communication Protocol
Send msg Receive msg P1 P2 Simple communication protocol Send Ack Receive Ack

14 Communication Protocol
Send msg Receive msg P1 P2 Send Ack Receive Ack

15 Communication Protocol
Send msg Receive msg P1 P2 Send Ack Receive Ack

16 Communication Protocol
Send msg Receive msg P1 P2 Send Ack Receive Ack

17 Communication Protocol
Send msg Receive msg P1 P2 Send Ack Receive Ack

18 Communication Protocol
Send msg Receive msg P1 P2 Send Ack Receive Ack

19 Producer-Consumer Problem
Buffer Unbounded channel PNs are an infinite state model but most properties are decidable with finite time and memory Consume

20 Producer-Consumer Problem
Buffer Consume

21 Producer-Consumer Problem
Buffer Consume

22 Producer-Consumer Problem
Buffer Consume

23 Producer-Consumer Problem
Buffer Consume

24 Producer-Consumer Problem
Buffer Consume

25 Producer-Consumer Problem
Buffer Consume

26 Producer-Consumer Problem
Buffer Consume

27 Producer-Consumer Problem
Buffer Bounded channel with complementary arcs Consume

28 Producer-Consumer Problem
Buffer Consume

29 Producer-Consumer Problem
Buffer Consume

30 Producer-Consumer Problem
Buffer Consume

31 Producer-Consumer Problem
Buffer Consume

32 Producer-Consumer Problem
Buffer Consume

33 Producer-Consumer with priority
A Consumer B can consume only if buffer A is empty Inhibitor arcs B Unbounded channel PNs are an infinite state model but most properties are decidable with finite time and memory

34 Decision Making Activities represented by Petri Nets

35 Decision Trees as Petri Nets

36 Project Networks as Petri Nets (Activities on Arrows Representation)

37 Example of Transformation of a Project Network Model Into a Petri Net

38 A Scenario of Commencement of Project Work (1)

39 A Specific Instance of the First Scenario

40 A Scenario of Commencement of Project Work (2)

41 A Specific Instance of the Second Scenario

42 PN properties Behavioral: depend on the initial marking (most interesting) Reachability Boundedness Schedulability Liveness Conservation Structural: do not depend on the initial marking (often too restrictive) Consistency Structural boundedness Most interesting properties are behavioral because we know the initial marking of the system and we are interested in analysis that start from there. Structural properties are properties that hold for any initial marking, therefore they are too restrictive. Usually we know the initial marking of the system we design.

43 Reachability Marking M is reachable from marking M0 if there exists a sequence of firings s = M0 t1 M1 t2 M2… M that transforms M0 to M. The reachability problem is decidable. p2 t2 M0 = (1,0,1,0) t3 M1 = (1,0,0,1) t2 M = (1,1,0,0) p1 t1 p4 The reachability problem is decidable. t3 p3 M0 = (1,0,1,0) M = (1,1,0,0)

44 Liveness Liveness: from any marking any transition can become fireable Liveness implies deadlock freedom, not viceversa Not live The transition is not live because it can be fired only once and after that is dead. The net is not live but it is deadlock free because I can keep firing the two transitions on the right

45 Liveness Liveness: from any marking any transition can become fireable Liveness implies deadlock freedom, not viceversa Not live

46 Liveness Deadlock-free
Liveness: from any marking any transition can become fireable Liveness implies deadlock freedom, not viceversa Deadlock-free

47 Liveness Deadlock-free
Liveness: from any marking any transition can become fireable Liveness implies deadlock freedom, not viceversa Deadlock-free

48 Boundedness Unbounded
Boundedness: the number of tokens in any place cannot grow indefinitely (1-bounded also called safe) Application: places represent buffers and registers (check there is no overflow) Finite number of token can accumulate Unbounded

49 Boundedness Unbounded
Boundedness: the number of tokens in any place cannot grow indefinitely (1-bounded also called safe) Application: places represent buffers and registers (check there is no overflow) Unbounded

50 Boundedness Unbounded
Boundedness: the number of tokens in any place cannot grow indefinitely (1-bounded also called safe) Application: places represent buffers and registers (check there is no overflow) Unbounded

51 Boundedness Unbounded
Boundedness: the number of tokens in any place cannot grow indefinitely (1-bounded also called safe) Application: places represent buffers and registers (check there is no overflow) Unbounded

52 Boundedness Unbounded
Boundedness: the number of tokens in any place cannot grow indefinitely (1-bounded also called safe) Application: places represent buffers and registers (check there is no overflow) Unbounded

53 Conservation Not conservative
Conservation: the total number of tokens in the net is constant Not conservative

54 Conservation Not conservative
Conservation: the total number of tokens in the net is constant Not conservative This net is not coservative

55 Conservation Conservative 2 2
Conservation: the total number of tokens in the net is constant Conservative This is conservative 2 2

56 Analysis techniques Structural analysis techniques
Incidence matrix T- and S- Invariants State Space Analysis techniques Coverability Tree Reachability Graph Let us consider now analysis techniques. They are of two types. Structural: incidence matrix and algebraic techniques. PNs firing rules have links to linear algebra. State-based: Reachability tree State-based are exhaustive but expensive.

57 Incidence Matrix t2 p1 t1 p2 p3 t1 t2 t3 p1 t3 p2 p3 -1 0 0 1 1 -1
-1 0 0 1 1 -1 0 -1 1 p2 p3 Build an incidence matrix that gives info about the PN structure: I/O relationship between nodes. Necessary condition is that exists a solution. Not sufficient! Necessary condition for marking M to be reachable from initial marking M0: there exists firing vector v s.t.: M = M0 + A v

58 State equations t2 p1 p2 p3 t1 t3
E.g. reachability of M =|0 0 1|T from M0 = |1 0 0|T t2 p1 p2 p3 t1 t3 A= -1 0 0 1 1 -1 0 -1 1 v1 = 1 1 + -1 0 0 1 1 -1 0 -1 1 = The solution is one of the vectors but also v2 = | |T or any vk = | 1 (k) (k+1) |T

59 Necessary Condition only
Explain why it is only CN. Because we do not know if there are enough initial tokens 2 2 Firing vector: (1,2,2) Deadlock!!

60 State equations and invariants
Solutions of Ax = 0 (in M = M0 + Ax, M = M0) T-invariants sequences of transitions that (if fireable) bring back to original marking periodic schedule in SDF e.g. x =| |T Cyclic execution. Return to the initial state. Solutions are called T-invariants. t2 p1 t1 p2 p3 A= -1 0 0 1 1 -1 0 -1 1 t3

61 Application of T-invariants
Scheduling Cyclic schedules: need to return to the initial state i *k2 + o *k1 Schedule is example of application of T-invariants. Need to return to the initial state for infinite execution. T-invariant: (1,1,1,1,1) Schedule: i *k2 *k1 + o

62 State equations and invariants
Solutions of yA = 0 S-invariants sets of places whose weighted total token count does not change after the firing of any transition (y M = y M’) e.g. y =| |T t2 p1 S-invariants. Gives the set of places whose total token count does not change after firing any transition. It is a weighted count. t1 p2 p3 -1 1 0 0 1 -1 0 -1 1 AT= t3

63 Application of S-invariants
Structural Boundedness: bounded for any finite initial marking M0 Existence of a positive S-invariant is CS for structural boundedness initial marking is finite weighted token count does not change Application is structural boundedness. We can guarantee that for any initial marking there is no infinite accumulation of tokens. It is a CS. They can be used to prove unreachability of some markings, if they cannot be expressed as the linear combination of the basis of S-invariants

64 Summary of algebraic methods
Extremely efficient (polynomial in the size of the net) Generally provide only necessary or sufficient information Excellent for ruling out some deadlocks or otherwise dangerous conditions Can be used to infer structural boundedness Efficient. Only partial information. Give first pass to verify simple properties

65 Coverability Tree Build a (finite) tree representation of the markings
Karp-Miller algorithm Label initial marking M0 as the root of the tree and tag it as new While new markings exist do: select a new marking M if M is identical to a marking on the path from the root to M, then tag M as old and go to another new marking if no transitions are enabled at M, tag M dead-end while there exist enabled transitions at M do: obtain the marking M’ that results from firing t at M on the path from the root to M if there exists a marking M’’ such that M’(p)>=M’’(p) for each place p and M’ is different from M’’, then replace M’(p) by w for each p such that M’(p) >M’’(p) introduce M’ as a node, draw an arc with label t from M to M’ and tag M’ as new. Build coverability tree starting from initial marking

66 Coverability Tree 1000 p1 p2 p3 p4 t1 t2 t3 Boundedness is decidable
with coverability tree 1000 p1 p2 p3 p4 t1 t2 t3 Build coverability tree starting from initial marking

67 Coverability Tree 1000 t1 0100 t2 p1 t1 p2 p3 p4 t3
Boundedness is decidable with coverability tree 1000 t1 0100 t2 p1 t1 p2 p3 p4 t3

68 Coverability Tree 1000 t1 0100 t2 p1 t1 p2 p3 t3 0011 p4 t3
Boundedness is decidable with coverability tree 1000 t1 0100 t2 p1 t1 p2 p3 t3 0011 p4 t3

69 Coverability Tree 1000 t1 0100 t2 p1 t1 p2 p3 t3 0011 t2 p4 0101 t3
Boundedness is decidable with coverability tree 1000 t1 0100 t2 p1 t1 p2 p3 t3 0011 t2 p4 0101 t3

70 Coverability Tree 1000 t1 0100 t2 p1 t1 p2 p3 t3 0011 t2 010 p4 t3
Boundedness is decidable with coverability tree 1000 t1 0100 t2 p1 t1 p2 p3 t3 0011 t2 010 p4 t3 Introduce the omega symbol that means infinite accumulation of tokens. It cannot solve reachability problems

71  Coverability Tree t1 t1 p1 t2 t1 p1 t2 2 2
Is (1) reachable from (0)? t1 t1 p1 t2 t1 p1 t2 2 2 Introduce the omega symbol that means infinite accumulation of tokens. It cannot solve reachability problems

72  Coverability Tree t1 t1 p1 t2 (0) (1) (2)… t1 p1 t2 2 2
Is (1) reachable from (0)? t1 t1 p1 t2 (0) (1) (2)… t1 p1 t2 2 2 Introduce the omega symbol that means infinite accumulation of tokens. It cannot solve reachability problems

73  Coverability Tree t1 t1 p1 t2 (0) (1) (2)… (0) (2) (0)… t1 p1 t2 2 2
Is (1) reachable from (0)? Cannot solve the reachability problem t1 t1 p1 t2 (0) (1) (2)… (0) (2) (0)… t1 p1 t2 2 2 Introduce the omega symbol that means infinite accumulation of tokens. It cannot solve reachability problems

74 Reachability graph p1 p2 p3 t1 t2 t3 100
For bounded nets the Coverability Tree is called Reachability Tree since it contains all possible reachable markings

75 Reachability graph t2 p1 t1 p2 p3 100 t1 010 t3
For bounded nets the Coverability Tree is called Reachability Tree since it contains all possible reachable markings

76 Reachability graph t2 p1 t1 p2 p3 100 t1 010 t3 t3 001
For bounded nets the Coverability Tree is called Reachability Tree since it contains all possible reachable markings

77 Reachability graph t2 p1 t1 p2 p3 100 t1 010 t3 t2 t3 001
For bounded nets the Coverability Tree is called Reachability Tree since it contains all possible reachable markings

78 Subclasses of Petri nets
Reachability analysis is too expensive State equations give only partial information Some properties are preserved by reduction rules e.g. for liveness and safeness Even reduction rules only work in some cases Must restrict class in order to prove stronger results In general reachability is too expensive, requires to build a reachability tree too big. State equations give only partial information. How do we do? Use reduction rules that preserve properties. Or restrict class.

79 Subclasses of Petri nets: SMs
State machine: every transition has at most 1 predecessor and 1 successor Models only causality and conflict (no concurrency, no synchronization of parallel activities)

80 Subclasses of Petri nets: MGs
Marked Graph: every place has at most 1 predecessor and 1 successor Models only causality and concurrency (no conflict) Same as underlying graph of SDF

81 Subclasses of Petri nets: FC nets
Free-Choice net: every transition after choice has exactly 1 predecessor

82 Free-Choice Petri Nets (FCPN)
Free-Choice (FC) t1 t2 Confusion (not-Free-Choice) Extended Free-Choice Free-Choice: the outcome of a choice depends on the value of a token (abstracted non-deterministically) rather than on its arrival time. Easy to analyze

83 Free-Choice nets Introduced by Hack (‘72)
Extensively studied by Best (‘86) and Desel and Esparza (‘95) Can express concurrency, causality and choice without confusion Very strong structural theory necessary and sufficient conditions for liveness and safeness, based on decomposition exploits duality between MG and SM

84 Petri Net extensions Add interpretation to tokens and transitions
Colored nets (tokens have value) Add time Time/timed Petri Nets (deterministic delay) type (duration, delay) where (place, transition) Stochastic PNs (probabilistic delay) Generalized Stochastic PNs (timed and immediate transitions) Add hierarchy Place Charts Nets Stochastic PNs have exponentially distributed random variable expressing the delay between the enabling and the firing of a transition. GSPNs have immediate transitions that take negligible amount of time. Place Charts Nets: exponential reduction in size. Good for preemption.

85 Summary of Petri Nets Graphical formalism
Distributed state (including buffering) Concurrency, sequencing and choice made explicit Structural and behavioral properties Analysis techniques based on linear algebra structural analysis (necessary and sufficient only for FC) linear algebra (only sufficient) structural analysis (necessary and sufficient only for FC)

86 References V. C. Gerogiannis, A. Kameas & P. Pintelas, “Classification and Comparative Study of High-Level Petri Nets”, Journal of Systems and Software, Vol. 43, November 1998, pp For Petri Nets application in Decision Making & Project Management refer to “A Petri Net model view of decision making: an operational management analysis” (A. Mehrez, M. Muzumdar, W. Acar and G. Weinroth), Omega, Vol. 23, Issue 1, 1995, pp (figures in slides 7, have been reproduced from this article)


Download ppt "Introduction to Petri Nets (PNs)"

Similar presentations


Ads by Google