Documente Academic
Documente Profesional
Documente Cultură
1 2
Indian Institute of Technology, Delhi, Indian Institute of Technology, Patna,
Department of Computer Science and Engineering, Department of Computer Science and Engineering,
New Delhi-110016, India Patna-800005, India
kirtu26@gmail.com sudiptaacharya.2012@gmail.com
3
National Institute of Technology,
Department of Information Technology,
Durgapur-713209, India
animeshrec@gmail.com
Abstract. Agent Based Computing is an emerging area of research for the last couple of decades. The
agents must be capable of maintaining the inherent dependencies between different tasks or handling
resource constraints while working together. There is a need of a formal tool that can represent this
autonomous behavior and task delegation property of agents. This paper proposes a new formal tool
called Task Petri Nets to represent the collaboration of agents in Multi agent system (MAS). A Task
Petri Nets is an extended Petri Nets tool which can represent the autonomous behavior of agents while
executing any task maintaining the happened before relationships and handling resource constraints.
It can also evaluate the performance of the system using three metrics- Total Execution Time, Agent
Utilization and Resource Utilization.
Keywords: Agent; Multi Agent System; Petri Nets; Task Assignment; Resource Constraint.
(Received February 23rd, 2013December 8th, 2010 / Accepted July 30th, 2013July 16th, 2011)
• able is a function which maps each agent ai ∈ A • If there exists a directed path from vertex V ti to
to a subset of t, So able : A → ϕ(t) V tj in GT , i.e. there exists a sequence of vertices
and edges starting from V ti and ending at V ti, we
5 Task Graph can say ti → tj .
A Task Graph is a formal representation of the • Two tasks ti and tj are concurrent if there is no
happened-before relationships between tasks. The hap- directed path either from V ti to V tj or from V tj to
pened before relationship is described in the following V ti.
sub-section.
• There are no circuits and self loops in a task graph.
5.1 Lamport Happened Before Relationship
If a and b are two events taking place in a system, the 6 Petri Nets model of the problem
expression a → b is read as ’a happened before b’, The existing Petri Net tool lacks for modeling this sce-
which means all processes agree that before occuring nario. So, a new tool called Task Petri Nets is proposed
event b, event a should occur [22]. The happened- which is described in following sections,
before relation can be observed directly in two situa-
tions: 6.1 Task Petri Nets
• If events a and b occur on the same process and the Task Petri Nets is an extended Petri Net tool which can
occurrence of event a preceded the occurrence of model a problem. It can be defined by set of tuples,
event b then a → b = TRUE T P N = (P, T R, I, O, T OK, F n)
INFOCOMP, v. 12, no. 1, p. 24-35, June 2013.
Upadhyay et al. Task Petri Nets for Agent based computing 28
• P = P is a finite set of places. It can be defined – tc: This transition fires if the task represented
by union of 8 number of places. So we can write by the token of corrosponding place P h is as-
P = (P t ∪ P h ∪ P c ∪ P e ∪ P f ∪ P r ∪ P a ∪ signed with an agent which is capable of per-
P d). Places P h, P c, P e, P f ∈ P exist for each forming it.
task already identified by the interface agent. The – te: This transition fires if all the resources re-
description of the different types of places are fol- quired by the task represented by the token
lows: of corrosponding place P c are allocated to it.
– P h: Here the presence of a token indicates – tf : This transition fires if the task represented
that the task represented by this place can by the token of corrosponding place P e is
run, i.e. all predecessor tasks that are re- completed.
quired to be completed before this task are – td: This transition is dynamically created
completed. when the agent assigned for the task repre-
– P c: Here the presence of a token indicates sented by the token of corrosponding place
that an agent has been assigned for the task P d decides to split the task further into sub-
represented by the token of corrosponding tasks. The subnet that is formed dynamically
place P h. consists of places and transitions all of which
are categorized as P d or td respectively.
– P e: Here the presence of a token indicates
agent and resources have been allocated for • I is the set of input arcs, which are of the following
the task represented by the token of cor- types,
rosponding place P h and the task is under
execution by the allocated agent. – I 1=P t X th : task checked for dependency.
– P f : Here the presence of a token indicates – I 2=P r X te : request for resources.
that the task represented by the token of cor- – I 3=P e X tf : task completed.
rosponding place P h has finished it’s execu- – I 4=P f X th : interrupt to successor task.
tion.
– I 5=P c X td ∪ I 1=P a X td ∪ I 1=P r X td
– P r: This place exists for each type of a re- ∪ I 1=P d X tf are input arcs of the subnet
source in the system. i.e. ∀ ri ∃ P ri where, formed dynamically.
ri ∈ R and 1≤ i ≤ q.
– P a: This place exists for each instance of an • O is the set of output arcs, which are of the follow-
agent in the system. i.e. ∀ ai ∃ P ai where ai ing types:
∈ R and 1≤ i ≤ p. – O1=thXP h: task not dependent on any other
– P t: Here the presence of a token represents task.
initially identified task by the interface agent – O2=tcXP c: agent assigned.
.
– O3=teXP e: resource allocated.
– P d: This place is created dynamically after
– O4=tf XP r: resource released.
the agent has been assigned for the task(in
place P c) and the agent decides to divide the – O5=tf XP f : Task completed by agent.
tasks into subtasks. For each subtask, a new – O6=tf XP a: agent released.
place is created.
– O7=tdXP d: output arcs of the subnet formed
• T R is the set of 5 transitions which can be repre- dynamically.
sented as, T R = (th ∪ tc ∪ te ∪ tf ∪ td). where • T OK is the set of color tokens present in the
th , te , tf exist for every task identified by the in- places of Petri net. So we can write, T OK =
terface agent. The description of different types of {T OK 1, T OK 2, . . . ,T OK X }, where each T OK i
transition is as below, where 1≤ i ≤ X, is associated with a function
– th: This transition fires if a task represented assi_tok defined as:
by the token of place P t is enabled i.e. all the assi_tok: T OK → (CategoryXT ypeXN ),
preceeding tasks which should be completed where, Category = set of all categories of to-
for the task to start are completed. kens in the system= {T, R, A }, T ype = set of all
INFOCOMP, v. 12, no. 1, p. 24-35, June 2013.
Upadhyay et al. Task Petri Nets for Agent based computing 29
types of each category i ∈ Category i.e. Type= • Construct places P ai for each type of agent aj , 1≤
{T ∪ R ∪ A }, j ≤ p, aj ∈ A. The number of tokens in P aj place
N is the set of natural numbers. is inst_A(aj ).
Let assi_tok(T OK i) = (category i, typei, ni).
• Construct places for each type of resource rk, 1≤
The function assi_tok satisfies the following con-
j ≤ p, rk ∈ R. The number of tokens in P rk place
straints:
is inst_R(rk). For each task i ∈ T ASK, add an
arc from,
– ∀T OK i (category i = R)→{(typei∈ R) ∧
(1 ≤ ni≤ inst_R(typei))} – place P t to transition thi and thi to place P hi.
– ∀T OK i (category i = A)→{(typei∈ R) ∧ – place P ci to transition tei and tei to place P ei.
(1 ≤ ni≤ inst_A(typei))}
– place P ei to transition tf i and tf i to place P f i.
– ∀ T OK i (category i = T ) → {(typei ∃ T ) ∧
(ni = 1) }. • For each task i, if there are ’n’ number of differ-
ent type agents (aj1, . . . , ajn) capable of perform-
assi_tok defines the category, type and number of ing it, construct ’n’ number of tci transitions (tci1,
instances of each token. tci2, . . . , tcin) and add arcs from P hi to all of them
• F n is a function associated with each place and and from the places (P aj1, . . . , P ajn) to transitions
token. It is defined as: (tci1, . . . , tcin) respectively. Add arcs from all tci
transitions (tci1, tci2, . . . , tcin) to place P ci.
F n: P XT OK → (T IM E X T IM E).
For a token T OK k ∈ T OK, 1≤ k ≤ x, • For all (rk, nk), where (rk, nk) ∈ req_res(task i),
add an arc(P r X te ) from P rk to tei. The weight
and place P i ∈ P , F n(P i, T OK k) = {(ai, aj )}, of the arc is equal to nk. Add an output arc(tf X
ai is the entry time of T OK k to place P i and aj P r) from each tf i to all P rk. The weight of the arc
is the exit time of T OK k from place P l. For a is equal to nk.
token entering and exiting a place multiple times, |
F n(P i, T OK k)| = number of times T OK k entered • From the task graph, if task i → task j , then add an
the place P i. arc (P f X th) from place P f i to transition thj .
6.2 Rules to construct Task Petri Nets • Create ’m’ number of tdi transitions (tdi1, tdi2, . . . ,
tdim) and add an arc (P c X td) from P ci to each
A Task Petri Nets can be created if the following infor- tdij , 1≤ j ≤ m, if the agent assigned to task i
mation is provided: wishes to divide task i into âmâ sub-tasks. Create
• An initial set of tasks, identified by the interface a place for each of âmâ subtasks. These places will
agent, called T ASK. be categorized as P d. Add arcs from each transi-
tion (tdi1, tdi2, . . . , tdim) to places (P di1, P di2, . . . ,
• The happened before relationships between the P dim) respectively.
tasks, described in the form of Task Graph.
• From each P dij place, the subnet is created in a
• The resource requirements of each task, task i ∈ similar way as the subnet is created from P ci place
T ASK. for task i. The subnet consists of P e, P f places
and te, tf transitions all categorized as P d and td
• The capabilities of the agents present in the sys- respectively. The resource requirements and the
tem. happened before relationships between the newly
Given this information, we can construct the Task Petri created tasks are determined by the agent dividing
Nets by following rules: the task. The petri nets is modified by adding such
places and transitions dynamically. The arcs are
• Construct place P t. It will represent the user’s added according to the rules described for a task i.
query mapped to a single task.
6.3 Metrics for Performance Analysis
• Construct places P hi, P ci, P ei, P f i and transitions
thi, tci, tei, tf i for each task i ∈ T ASK identified We define the following three metrics for performance
by the interface agent. analysis of the system. These are:
INFOCOMP, v. 12, no. 1, p. 24-35, June 2013.
Upadhyay et al. Task Petri Nets for Agent based computing 30
6.3.1 Total Execution Time 7 Comparison of Task Petri Nets with other
This metric gives the total execution time of the system. forms of Petri Nets
∀ T OK i, assi_tok(T OK i) = (T , typei, ni), There are other forms of Petri nets avaialble but they
F n(P h, (T , typei, ni)) = {(ap, aq) | ap is the time at have been found inefficient to model the task assign-
which token entered place P h and aq is the time at ment process. A comparison of some of these with Task
which token left the place.}. Petri Nets is given in Table 1. Task Petri Nets have been
compared with Color Petri Nets, Agent Petri Nets and
The start time of execution is the time at which the Predicate Transition Nets on the following areas
first task started, i.e. the minimum of the entry times to
P h place of all tokens. So, • Supports MAS
S t(Starting Time) = • Deals with Task Assignment
min{ap |(ap, aq) ∈ F n(P h,(T ,typei, ni))},
∀ T OK i, assi_tok(T OK i) = (T , typei, ni). • Evaluates Performance
The finish time of execution is the finishing time of • Capacity to model interactions between agents
the last task of the system. So,
F t(Finish time)=
max {ap | (ap, aq) ∈ F n(P h, (T , typei, ni))}, Table 1: Comparison of Task Petri Nets with other forms of Petri
Nets
where ∀ T OK i, assi_tok(T OK i) = (T , typei, ni).
Supports Deals with Task Evaluates Capacity to model
Type of Petri Nets
MAS Assignment performance interactions between agents
So, total execution time Color Petri Nets/
No No No No
Object Petri Nets
(T et) = max {ap | (ap, aq) ∈ F n(P h, (T , typei, ni))}- Agent Petri Nets Yes Yes No Yes
assi_tok(T OK i) = (T , typei, ni)}. Task Petri Nets Yes Yes Yes Yes
65
b c
60
d e 50
40
Pt Pa 2 2.5 3 3.5 4 4.5 5
TASK a1 a2 a3
no. of agents
th
Figure 3: Graph showing total execution time against no. of agents
Ph a b c d e
tc
execution time against the three parameters.
Pr
Pc a b c d e
r1 r2
Figure 3 shows the change of total execution time
against number of agents for a fixed number of tasks
2 2 2 2 2 and resources. 7 tasks are taken and random happened
te
before relationships are generated between them. There
are 10 types of resources each having 4 instances. The
Pe a b c d e
resource requirements of the tasks are also generated
randomly. There are 5 types of agents each having
2 2 2 2 2 instances initially. Their abilities are generated ran-
2
tf domly. Keeping the number of tasks and the number of
resources fixed, the number of instances of each agent
Pf a b c d e type is increased by 1 along the X-axis. The total ex-
ecution time for 2, 3, 4 and 5 number of instances of
agents is plotted in Figure 3. The number of agents
Figure 2: Task Petri Nets Model for the problem available in the system is a bottleneck as it determines
the number of tasks executing concurrently. If a task is
not dependent on any other task/tasks for execution, it
should be assigned to an agent. But, if all the agents
8.2.2 Task Petri Nets capable to perform that task are busy executing other
According to the rules described in section 6.2, we can tasks, the task cannot execute. So, the task has to wait
draw the Task Petri Nets based on the given set of tasks until a capable agent is free. From the graph, it is ob-
identified by the interface agent, their requirement of served that as the number of agents in the system in-
resources and the capabilities of agent. Figure 2 shows creases, the execution time decreases or remains same.
the Task Petri Nets for the problem described above. It is because as the number of agents in the system in-
creases, the tasks which could not be assigned to agents
due to their unavailability earlier are assigned due to
8.3 Simulation Results and Discussion
an increase in their number. So, number of tasks exe-
The above scenario is simulated in MATLAB. The cuting concurrently increases which decreases the total
value of one metric, total execution time has been cal- execution time. The total execution time remains same
culated and its variation studied over three parameters when the system achieves the maximum possible con-
1) number of tasks, 2) number of resources and 3) num- currency or the concurrency depends on the availability
ber of agents. The duration of each task is assumed to of resources.
be 10 sec. The following graphs show the change of Figure 4 shows the change of execution time against
INFOCOMP, v. 12, no. 1, p. 24-35, June 2013.
Upadhyay et al. Task Petri Nets for Agent based computing 32
60 90
59
85
58
80
57
total execution time
55 70
54
65
53
60
52
55
51
50 50
3 3.5 4 4.5 5 5.5 6 5 6 7 8 9 10
no. of resources no. of tasks
Figure 4: Graph showing total execution time against no. of re- Figure 5: Graph showing total execution time against no. of tasks
sources
50
total execution time
40
of agents. There are 10 types of resources each having
30
3 instances. The resource requirements of the tasks are
generated randomly. There are 5 types of agents each 20
100
9 Conclusion
80
In this paper, a Task Petri Nets tool to address the task
total execution time