Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

ĐẠI HỌC QUỐC GIA THÀNH PHÓ HỒ CHÍ MINH

TRƯỜNG ĐẠI HỌC BÁCH KHOA


KHOA KHOA HỌC - KĨ THUẬT MÁY TÍNH

MÔ HÌNH HÓA TOÁN HỌC (CO2011)

Bài tập lớn

MÔ HÌNH

GVHD: Nguyễn Tiến Thịnh


Nguyễn An Khương
SV thực hiện:: Lê Bảo Quốc - 2014295 (L02)
Nguyễn Đoàn Phương Nghi - 2013859 (L03,Nhóm trưởng)
Nguyễn Thị Minh Uyên - 2012538 (L03)
Nguyễn Thị Minh Châu - 2010951 (L03 )
Thái Tăng Huy - 2013329 (L03)

Tp. Hồ Chí Minh,Tháng 11/2021


Trường Đại Học Bách Khoa - ĐHQG-HCM

Mục lục
1 Members and assignment 1

2 Summary 1

3 Review 2
3.1 PETRI NETWORKS - Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3.1.1 Transition system or State transition system . . . . . . . . . . . . . . . . . . . . . . . 2
3.1.2 Petri Net is a bipartite directed graph of places and transitions . . . . . . . . . . . . 2
3.1.3 Input is place, output is transition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3.1.4 Petri net formalize the above concepts. . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3.2 PETRI NETWORKS- Behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3.2.1 Firing rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3.2.2 Firing sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3.2.3 Labeled Petri net . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3.2.4 Reachability graph. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3.3 PETRI NETWORKS - Structures and Basic Problems . . . . . . . . . . . . . . . . . . . . . . 3
3.4 SUMMARY and REVIEWED PROBLEMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.4.1 PROBLEM 1. Explain the following terms for Petri nets, and provide a specific
example for each term: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.4.2 PROBLEM 2. Consider the Petri net system in figure below. . . . . . . . . . . . . . 4
3.4.3 PROBLEM 3. From small marked Petri net to bigger transition system . . . . . . . 5
3.5 PETRI NETS- ASSIGNMENT on MODELING . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.5.1 The superimposition (or merging) operator . . . . . . . . . . . . . . . . . . . . . . . . 6

4 ASSIGNMENT 6
4.1 Problem 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.2 Problem 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

5 7

Trang 1
1 Members and assignment
No. Fullname Student ID Problems Percentage of work

1 Nguyễn Đoàn Phương Nghi 2013859 1,2 100%

2 Nguyễn Thị Minh Uyên 2012538 3,4 100%

3 Nguyễn Thị Minh Châu 2010951 5,6 100%

4 Lê Bảo Quốc 2014295 7, Latex 100%

5 Thái Tăng Huy 2013329 7 100%

2 Summary
Trường Đại Học Bách Khoa - ĐHQG-HCM

3 Review
3.1 PETRI NETWORKS - Background
3.1.1 Transition system or State transition system
A transition system is a triplet T S = (S, A, T ) where S is the set of states,is the set of activities (often
referred to as actions), and T ⊆ S × A × S is the set of transitions

The following subsets are defined implicitly

• S start ⊆ S the set of initial states


• S end ⊆ S is the set of final states

BEHAVIOR of a transition system: The transition starts in one of the initial states. Any path in the
graph starting in such a state corresponds to a possible execution sequence.

* A path terminates successf ully if it ends in one of the fifinal states.


* A path deadlocks if it reaches a non-fifinal state without any outgoing transitions.
(Note that the absence of deadlocks does not guarantee successful termination)

3.1.2 Petri Net is a bipartite directed graph of places and transitions


A Petri net is a triplet N = (P, T, F ) where P is a finite set of places, T is a finite set of transitions such
that P ∩ T = ∅, and F ⊆ (P × T ) ∪ (T × P ) is a set of directed arcs, called the f low relation.
1. A token is a special transition node ,being graphically rendered as a black dot, •. The symbolic tokens
generally denote elements of the real world. Places can contain tokens, and transitions cannot.

2. A transition is enabled if each of its input places contains a token.


3. A marking is a distribution of tokens across places.
4. A marked Petri net is a pair (N, M ) where N = (P, T, F ) is a Petri net and where (M ) is a multi − set
over (P ) denoting the marking of the net.

3.1.3 Input is place, output is transition.


Let N = (P, T, F ) be a Petri net. Elements of P ∪ T are called nodes.

• A node x is an input node of another node y if and only if there is a directed arc from x to y. Node x
is an output node of y if and only if (y, x) ∈ F .
• For any (x ∈ P ∪ T ) write • x = {y|(y, x) ∈ F } - the preset of x, and x • = {y|(x, y) ∈ F } - the postset
of x

3.1.4 Petri net formalize the above concepts.


1. A business process consists of a set of activities that is performed in an organi-zational and technical
environment. These activities are coordinated to jointly realize a business goal. Each business process
is enacted by a single organization, but it may interact with business processes performed by other
organizations.
2. An information system is a software system to capture, transmit, store, retrieve, manipulate, or
display information, thereby supporting people, organizations, or other software systems.

Trang 2
Trường Đại Học Bách Khoa - ĐHQG-HCM

3.2 PETRI NETWORKS- Behaviors


3.2.1 Firing rule
Let (N, M ) ∈ N be a marked Petri net with N = (P, T, F ) and M ∈ M

• A transition is enabled if there is at least one token in each of its input places.
• Transition t ∈ T is enable at making M , denoted (N, M )[t⟩, if and only if •t ⩽ M .
• The firing rule α [t⟩ β ⊆ N × T × N is the smallest relation satisfying

for any N, M ∈ N and any t ∈ T .

3.2.2 Firing sequence


Let N, M0 ∈ N be a marked Petri net with N = (P, T, F ).
1. A sequence σ ∈ T ∗ is called a firing sequence of N, M0 if and only if,for some natural number N ∈ N,
there exist markings M1 , M2 , ...., Mn and transitions T1 , T2 , ...., Tn such that
• σ = (t1 , t2 , ..., tn ) ∈ T ∗
• and for all i with 0 ≤ i < n, then (N, Mi )[ti+1 ⟩ and (N, Mi )[ti+1 ⟩(N, Mi+1 ).
2. A marking M is reachable from the initial marking M0 if and only if there exists a sequence of
enabled transitions whose firing leads from M0 to M .
3. (Petri net system) A Petri net system (P, T, F, M0 ) consists of a Petri net N = (P, T, F ) and a distin-
guished marking M0 , the initial marking.

3.2.3 Labeled Petri net


• A ⊆ Ais a set of activity labels, and the map is a labeling function. [One can think of the transition
label as the observable action. Sometimes one wants to express that particular transitions are not
observable, or invisible.]
• Use the label τ for a special activity label, called ‘invisible’. A transition t ∈ T with l(t) = τ is said to
be unobservable, silent or invisible.

3.2.4 Reachability graph.


Let (N, M0 ) with N = (P, T, F, A, l) be a marked labeled Petri net.

(N, M0 ) defines a transition system T S = (S, A1 , T R) with

S = [N, M0 ⟩, S start = {M0 }, A1 = A, and

T R = {(M, M1 ) ∈ S × S|⟩, l(t)

3.3 PETRI NETWORKS - Structures and Basic Problems


Places and transitions in a Petri net are connected by arcs. Connecting of nodes determines the behavior
of the network. Formally, the way in which transitions are connected determines the order in which they can
fire. First we recall key terms, rules and relevant ideas, in a Petri net N = (P, T, F ) .

1. When a transition t fires, the resulting number of tokens in any place p is equal to the initial number
of tokens minus the number of consumed tokens plus the number of produced tokens.

Trang 3
Trường Đại Học Bách Khoa - ĐHQG-HCM

2. The total number of tokens in the net changes if the number of input places of transi-tion t is not
the same as the number of output places of transition t. Accordingly, the firing of a transition may
increase or decrease the overall number of tokens.
3. When several transitions are enabled at the same moment, it is not determined which of them will
fire. This situation is a nondeterministic choice.

3.4 SUMMARY and REVIEWED PROBLEMS


3.4.1 PROBLEM 1. Explain the following terms for Petri nets, and provide a specific exam-
ple for each term:
1. "enabled transition”: A transition is enabled if each of its input places contains at least 1 token.
2. "firing of a transition”: To fire a transition, it must be enabled. If an enabled transition fires, then it
consumes one token from each of its input places and produces one token in each of its output places.

3. "reachable marking": A marking M is reachable from the initial marking M0 if and only if there
exists a sequence of enabled transitions whose firing leads from M0 to M . Each of the reachable
markings is represented as a multiset.
4. "terminal marking": The transitions keep firing until the net reaches a marking that does not enable
any transition. This marking is a terminal marking.

5. "nondeterministic choice": When several transitions are enabled at the same moment, it is not
determined which of them will fire. This situation is a nondeterministic choice.

3.4.2 PROBLEM 2. Consider the Petri net system in figure below.

1. Formalize this net as a quadruplet (P, T, F, M0 ).


• P = (p1 , p2 , p3 , p4 )
• T = (t1 , t2 , t3 )
• F = {(p1 , t1 ), (t1 , p2 ), (p2 , t2 ), (t2 , p3 ), (p3 , t3 ), (t2 , p4 ), (t3 , p4 ), (p4 , t3 ), (p4 , t1 )}
• M0 = [1.p1 , 0.p2 , 1.p3 , 2.p4 ]
2. Give the preset and the postset of each transition.

Presets:
• t1 = p1 , p4
• t2 = p2
• t3 = p3 , p4
Postsets:
t1 •= p2
t2 •= p3 , p4
t3 •= p4

Trang 4
Trường Đại Học Bách Khoa - ĐHQG-HCM

3. Enabled transition at marking M0 : t1 , t3


4. Reachable terminal markings:
M0 = [1.p1 , 0.p2 , 1.p3 , 2.p4 ]
TH1
• (N, M0 )[t1 ⟩(N, M1 ) with M1 = [0.p1 , 1.p2 , 1.p3 , 1.p4 ]
• (N, M1 )[t2 ⟩(N, M2 ) with M2 = [0.p1 , 0.p2 , 2.p3 , 1.p4 ]
• (N, M2 )[t3 ⟩(N, M3 ) with M3 = [0.p1 , 0.p2 , 1.p3 , 2.p4 ]
• (N, M3 )[t3 ⟩(N, M4 ) with M4 = [0.p1 , 0.p2 , 0.p3 , 2.p4 ]
TH2
• (N, M0 )[t3 ⟩(N, M1′ ) with M1′ = [1.p1 , 0.p2 , 0.p3 , 2.p4 ]
• (N, M1′ )[t1 ⟩(N, M2′ ) with M2′ = [0.p1 , 1.p2 , 0.p3 , 1.p4 ]
• (N, M2′ )[t2 ⟩(N, M3′ ) with M3′ = [0.p1 , 0.p2 , 1.p3 , 2.p4 ] = M3
• (N, M3′ )[t3 ⟩(N, M4′ ) with M4
TH3
• (N, M2 )[t3 ⟩(N, M5 ) with M5 = [0.p1 , 1.p2 , 0.p3 , 1.p4 ] = M2′
⇒ 6 reachable Markings ( không tính M0 )
5. Nondeministic choice: M0 = [1.p1 , 0.p2 , 1.p3 , 2.p4 ]
6. Decrease or increase
a) Remove place p1 and adjacent arcs:
M0 = [0.p2 , 1.p3 , 2.p4 ]

• (N, M0 )[t3 ⟩(N, M1 ) with M1 = [1.p2 , 1.p3 , 1.p4 ]


• (N, M1 )[t1 ⟩(N, M2 ) with M2 = [0.p2 , 2.p3 , 1.p4 ]
• (N, M2 )[t2 ⟩(N, M3 ) with M3 = [0.p2 , 1.p3 , 1.p4 ] = M3
• (N, M3 )[t3 ⟩(N, M4 ) with M4 = [0.p2 , 0.p3 , 1.p4 ]
• (N, M4 )[t1 ⟩(N, M5 ) with M5 = [1.p2 , 0.p3 , 0.p4 ]
• (N, M5 )[t2 ⟩(N, M6 ) with M6 = [0.p2 , 1.p3 , 0.p4 ] = M3
• (N, M0 )[t3 ⟩(N, M1′ ) with M1′ = [0.p2 , 0.p3 , 1.p4 ] = M3 = M4
⇒ 6 reachable markings
b) Remove place p3 and adjacent arcs:
M0 = [1.p1 , 0.p2 , 2.p4 ]
⇒ 2 reachable markings

3.4.3 PROBLEM 3. From small marked Petri net to bigger transition system

Trang 5
Trường Đại Học Bách Khoa - ĐHQG-HCM

1. Write down M0 , P, T of N
• M0
• P
• T
• N

3.5 PETRI NETS- ASSIGNMENT on MODELING


3.5.1 The superimposition (or merging) operator
Formally, consider a system of only two agent types, denote N1 , N2 to be their own Petri nets. Assume
that N1 = (P1 , T1 , F1 , M0 and N2 = (P2 , T2 , F2 , M0 , where the places Pi could be disjoint, but with the same
initial marking M0 .

4 ASSIGNMENT
SCENARIO: Under a SARS pandemic where a huge lack of ICU beds occurs in city H, patients should
consult specialists in the outpatient clinic of a hospital, we describe the course of business around a specialist
in this outpatient clinic of hospital X as a process model, formally, we use Petri Net.
ASSUMPTION and DATA
• Specialist: Each patient has an appointment with a certain specialist. The specialist receives patients.
At each moment, the specialist is in one of the following three states:
1. the specialist is free and waits for the next patient (state free),
2. the specialist is busy treating a patient (state busy), or
3. the specialist is documenting the result of the treatment (state docu).
• Every patient who visits a specialist is in one of the following three states:
1. the patient is waiting (state wait, gets value n if there are n patients waiting),
2. the patient is treated by the specialist (state inside), or
3. the patient has been treated by the specialist (state done).
• Event data: three events are important for this business process. First, the specialist starts with
the treatment of a patient (event "start"). Second, the specialist finishes the treatment of a patient
and starts documenting the results of the treatment (event "change"). Third, the specialist stops
documenting (event "end").

Trang 6
Trường Đại Học Bách Khoa - ĐHQG-HCM

4.1 Problem 1
a) Write down states and transitions of the Petri net NS
States
• S = {f ree, busy, docu}
• Sstart = M0 = {1, 0, 0}
• A = {start, change, end}
Transitions T = {(f ree, start, busy), (busy, change, docu), (docu, end, f ree)}
b) Could you represent it as a transition system assuming that

(i) Each place cannot contain more than one token in any marking
(ii) Each place may contain any natural number of tokens in any marking.

4.2 Problem 2
Define NP a as the Petri net modeling the state of patients. By the similar ideas
a) explain the possible meaning of a token in state inside of the net NP a
a) Construct the Petri net NP a , assuming that there are five patients in state wait, no patient in state
inside, and one patient is in state done.

Trang 7
Trường Đại Học Bách Khoa - ĐHQG-HCM

Images/Phan2b/buocnhay12.png

Trang 1

You might also like