30
Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic Michal Žarnay University of Žilina, Slovak Republic

Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

  • View
    218

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

Application of Coloured Petri Net for Agent Control and

Communication in the ABAsim Architecture

Antonín KavičkaUniversity of Pardubice, Czech Republic

Michal ŽarnayUniversity of Žilina, Slovak Republic

Page 2: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 2

Outline

• Background and motivation

• Definition of ABA-CPN (Agent-based architecture – Coloured Petri net)

• Application example

• Conventions in ABA-CPN

• Analysis of ABA-CPN

• Conclusion

Page 3: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 3

Background

Simulation of large and complex logistic nodes using ABAsim architecture (agent-based architecture of simulation models)

Page 4: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 4

ABAsim – Agent’s Decomposition

Query Monitor

MANAGER

Actuation

Perception

Solving support

Agent

Human operator

Communication

SchedulerAdvisor

Action

Process

Agent

Effectors

Solvers

Sensors

Page 5: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 5

ABAsim – Hierarchy of Agents

MANAGER

agent

Service controller

agent Surroundings

Incoming flow

StartFinished

Notice : Customer

arrives

MANAGER

Service A

MANAGER

Resource transfer

StartFinished

agentResource controller

Notice : Customer leaves

Notice : Customer has just arrived

Service B

Customer transfer

Start

Finished

Request : Deliver resource

Response : Resource delivered

Notice : Resource returnedFinishedStart Start

Finished

Page 6: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 6

ABA-graph

Service controller

Resourceselection

Enqueuingresource request

Resourceassignment

Transfer needed ?

Resource transfer

Resourcerelease

Queuing forresource ?

Resource transfer

t1

t2

t3

t4

t5

t6

t7

t8

p1

p2

p6

p3

p4

p5

p7

p8

p9

p10

p11

p12

p13

p14

p15

p16

p17

Yes

No

Yes

No

Code

Service controller

Service controller

Code

Result

Result

Result

Available

Otherwise

Dequeuingresource request

Assignresource

Finished

Resourcereturned

Start

Resourceassigned

Otherwise

Absorption

p18

X(t7)=1

• Definition of agent’s control and communication• Subclass of Place/Transition Petri net

Page 7: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 7

Motivation

• Upgrade to a subclass of coloured Petri nets in order to:– use a more flexible approach in describing

the agent’s components– use existing tools for an analysis

Page 8: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 8

Outline

• Background and motivation

• Definition of ABA-CPN

• Application example

• Conventions in ABA-CPN

• Analysis of ABA-CPN

• Conclusion

Page 9: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 9

What is ABA-CPN

• Describes reactive logic of an agent component (edited within the CPN Tools environment)

• Token colours correspond to messages• Denoted transitions correspond to agent’s instant

assistants• Management of token instances is based on prefix

conventions of identifiers used in arc expressions• Evolution is realized by means of a system interpreter

within the ABAsim run-time kernel

Page 10: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 10

Definition of ABA-CPN

• Based on definition of CPN

• Net structure:P = {pin} {pout} PS

T = TD TA TS TB

• Additional rules

Page 11: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

OM_D

OM_Finpinp

res

if res=Res_Ethen 1`reselse empty

res

if res=Res_CplusDthen 1`reselse empty

res

if inp=IM_Bthen 1`inpelse empty

inp res

inp

xx

inp

OM_C

OM_E

s3

d2

d1 a1

a2

t1

s2

s1

p7

InMSG

p6

Result

p5

Result

p4

Result

p8

Generic

p3

InMSG

p9

p2

InMSG

p1

IM_A

InMSG

if inp=IM_Athen 1`inpelse empty

OutMSG

Input place pin

Output place pout

Internal places PS

Page 12: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

OM_D

OM_Finpinp

res

if res=Res_Ethen 1`reselse empty

res

if res=Res_CplusDthen 1`reselse empty

res

if inp=IM_Bthen 1`inpelse empty

inp res

inp

xx

inp

OM_C

OM_E

s3

d2

d1 a1

a2

t1

s2

s1

p7

InMSG

p6

Result

p5

Result

p4

Result

p8

Generic

p3

InMSG

p9

p2

InMSG

p1

IM_A

InMSG

if inp=IM_Athen 1`inpelse empty

OutMSG

Decision transitions TD

Assistant transitions TD

representing actions in simulation

Standard transitions TD

Sending transitions TD

Page 13: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

OM_Finpinp

res

if res=Res_Ethen 1`reselse empty

res

if res=Res_CplusDthen 1`reselse empty

res

if inp=IM_Athen 1`inpelse empty

if inp=IM_Bthen 1`inpelse empty

inp res

inp

xx

inp

OM_C

OM_E

s3

d2

d1 a1

a2

t1

s2

s1

p7

InMSG

p6

Result

p5

Result

p4

Result

p8

Generic

p3

InMSG

p9

OutMSG

p2

InMSG

p1

IM_A

InMSG

OM_D

Decision arcs

Elementary variable arcs(all the remaining)

Constant arcs

Page 14: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 14

Tokens

Reflect message forms used for communication that may be filled differently throughout the net evolution

Page 15: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 15

Initial Markings

(|M0(p)| = 1, p = pin) (|M0(p)| = 0, p ≠ pin)

M0 = { jM0 | j =1,2, …, |C(pin)|},for i ≠ j, iM0(p) ≠ jM0(p)

Admissible initial marking: input message before processing and no other messages being processed

Set of admissible initial markings: all relevant input messages

Page 16: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

OM_D

OM_Finpinp

res

if res=Res_Ethen 1`reselse empty

res

if res=Res_CplusDthen 1`reselse empty

res

if inp=IM_Bthen 1`inpelse empty

inp res

inp

xx

inp

OM_C

OM_E

s3

d2

d1 a1

a2

t1

s2

s1

p7

InMSG

p6

Result

p5

Result

p4

Result

p8

Generic

p3

InMSG

p9

p2

InMSG

p1

IM_A

InMSG

if inp=IM_Athen 1`inpelse empty

OutMSG1 1`IM_A

Another option: 1`IM_B

Page 17: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 17

Outline

• Background and motivation

• Definition of ABA-CPN

• Application example

• Conventions in ABA-CPN

• Analysis of ABA-CPN

• Conclusion

Page 18: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

Example Introduction

MANAGER

agent

Service controller

agent Surroundings

Incoming flow

StartFinished

Notice : Customer

arrives

MANAGER

Service A

MANAGER

Resource transfer

StartFinished

agentResource controller

Notice : Customer leaves

Notice : Customer has just arrived

Service B

Customer transfer

Start

Finished

Request : Deliver resource

Response : Resource delivered

Notice : Resource returnedFinishedStart Start

Finished

Page 19: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

Example of ABA-CPN

Dequeueapplicant

Queuefor releasedresource?

Enqueueapplicant

Selectionfrom availableresources

Resourcerelease

y

x6bx6a

y

x_No_transferx_No_transfer

if x5=FIN_Transferthen 1`x_No_transferelse empty

x6a

x6b

x6b

x0

if x5=REQ_Deliver_resourcethen 1`x5else empty

x5x5

if x5=NTC_Resource_returnedthen 1`x5else empty

x5

x6bx6ax6a

if x6a=Resource_availthen 1`x6aelse empty

if x6a=No_resourcethen 1`x6aelse empty

x6a

x6c

if x6c=Non_empty_queuethen 1`x6celse empty

x6cx6cx5

x6ax5

a7

t1

s2

s1

a2

d4a5

a4

d2

a6

d3a3

a1

d1

p13

Generic

p11

Result_b

p14

Result_b

p15

Result_b

p16

p12

Result_b

p10

Result_a

p7

Result_a

p6

Result_a

p9Result_c

p8

Result_c

p5

InMSG

p4

Result_a

p1

InMSG

p3

InMSG

p2

InMSG

Resourceassignment

Transfer toapplicant?

if x6b=No_transferthen 1`x6belse empty

if x6b=Transferthen 1`x6belse empty

OutMSG

x_START_Transfer

x_RESP_Resource_delivered

a8

Updatetransferstatistics

Page 20: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 20

Outline

• Background and motivation

• Definition of ABA-CPN

• Application example

• Conventions in ABA-CPN

• Analysis of ABA-CPN

• Conclusion

Page 21: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 21

Conventions in ABA-CPN

• Management of token instances– First character (prefix)– Second character for decision transitions

• Denoting of places

• Third character

• Constant identifiers

Page 22: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 22

Prefix Convention

y

t1

p13

Generic

p11

Result_b

p15

Result_b

x_No_transferx_No_transfer

Page 23: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 23

“Decision Transitions” Convention

Resourceassignment

Enqueueapplicant

x6a

x6a

if x6a=Resource_availthen 1`x6aelse empty

if x6a=No_resourcethen 1`x6aelse empty

x6a

a5

a4

d2

p7

Result_a

p6

Result_a

p4

Result_a

Resourceassignment

Enqueueapplicant

x6a

x6a

if x6a=Resource_availthen 1`x6aelse empty

if x6a=No_resourcethen 1`x6aelse empty

x6a

a5

a4

d2

p7

Result_a

p6

Result_a

p4

Result_a

Page 24: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 24

Outline

• Background and motivation

• Definition of ABA-CPN

• Application example

• Conventions in ABA-CPN

• Analysis of ABA-CPN

• Conclusion

Page 25: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 25

Analysis of ABA-CPN

• To check correctness of the ABA-CPN, the liveness properties are used:– Dead markings– Transitions liveness

Page 26: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 26

Dead Markings – 2 Types

(|M(pout)| ≥ 1) (|M(p)| = 0, p ≠ pout)

|M(p)| = 0, p P

sending a message from the current agent to another agent

consumption of the message form and no need for further communication

Page 27: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 27

Conditions from Transitions Liveness

The only transition occurring in all sequences: input transition t TD

No transition is dead in all occurrence sequences for all admissible initial markings

Page 28: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 28

Conclusion

• Benefits of the ABA-CPN compared to the ABA-graph:– higher modelling capabilities of CPN:

• construction of conditional branching and • differentiation of various instances of messages

– existing tools for the CPN analysis

Page 29: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

CPN'08 Workshop 29

Use of the ABA-CPNCreate an ABA-CPN model

Analyze its liveness properties

Import the model

Check the model syntax

Interpret the model during simulation runs

CPN Tools

ABA-CPN Interpreter

Page 30: Application of Coloured Petri Net for Agent Control and Communication in the ABAsim Architecture Antonín Kavička University of Pardubice, Czech Republic

Thank you for your attention!

[email protected]@fri.uniza.sk