Towards an Aspect-oriented approach to Agent-oriented programming - - PowerPoint PPT Presentation

towards an aspect oriented approach to agent oriented
SMART_READER_LITE
LIVE PREVIEW

Towards an Aspect-oriented approach to Agent-oriented programming - - PowerPoint PPT Presentation

Towards an Aspect-oriented approach to Agent-oriented programming Matthieu Amiguet Univ. of Applied Sciences Locle, Switzerland Jose Baez LIRMM, University of Montpellier, France Adina Nagy Institut fr Informatik, HU Berlin,


slide-1
SLIDE 1

MOCA 2004 – Aarhus – 11-13 October 2004 1

Towards an Aspect-oriented approach to Agent-oriented programming

Matthieu Amiguet – Univ. of Applied Sciences Locle, Switzerland Jose Baez – LIRMM, University of Montpellier, France Adina Nagy – Institut für Informatik, HU Berlin, Germany

slide-2
SLIDE 2

MOCA 2004 – Aarhus 13.10.2004 2

Adina Nagy

Outline

 Introduction: origins, project, methodology,

example

 Aspect-oriented and Agent-Oriented Programming  Orthogonal concerns

 Organizational structure: Concepts, example revisited  Agent architecture

 Dynamic weaving and conflict management  Conclusion  Future work

slide-3
SLIDE 3

MOCA 2004 – Aarhus 13.10.2004 3

Adina Nagy

Introduction

 Origins of organizational approach to agent-oriented

programming

 social-inspired approach

 „simulation“ for social/behaviour science  structuration around patterns of behaviour or of preferences 

Ex 2. consumer behaviour with respect to brands

Ex 1. encapsulation of user-related features in telecom

 organization schemata and protocols as meta-modelling tools for

multi-agent system design [Sauvage, 2003

 MOCA project „modèle organisationnel centré agent“

 definitions: organizational notions (role, organization) as first-order

concepts

 operationalisation: role-taking defined, endorsement of several roles

by an agent treated, agent architecture established,

 implementation: platform over MadKit (O. Gutknecht, J. Ferber

www.madkit.org)

slide-4
SLIDE 4

MOCA 2004 – Aarhus 13.10.2004 4

Adina Nagy

MOCA organizational approach

 Social roles: patterns of interaction and

behaviour [AMBN´02]  behaviourist model

 versus normative (mentalist)

 Organisation: institutionalised pattern of

interaction, at collective level (social entity) Main properties of MOCA:

 dynamic social structure issued from agents´ role

endorsement [AMBN´02] [Amiguet03]

 componential agent architecture [Amiguet03]  communication through influence exchanges

authorized only within a group

 communication through competence calls within an

agent

slide-5
SLIDE 5

MOCA 2004 – Aarhus 13.10.2004 5

Adina Nagy

Organizational methodology

Organization: recurrent pattern of interaction, from a given point of view and often with a rationale

 Multiple view-point modelling

 a view-point: a partial view on the whole system

 modularity, reusability, simplifies the design

 Multi-organisation modelling

 each view-point represented by at least an

  • rganisation

 Ex1. Commercial system: good exchanges, financial exchanges,

customers’ behaviour

 Ex2. Multi-agent system: environment negotiation, communication or

cheating strategies, as plug-in organisations

 meta-organisational services reified as particular

  • rganisations

 Ex3. Management organization in MOCA: Group formation and

destruction, role endorsement and leave

slide-6
SLIDE 6

MOCA 2004 – Aarhus 13.10.2004 6

Adina Nagy

Example – a toy commercial system

[Amiguet2003] 3 agents Provider: creates a new group instantiating a Supply org. and takes the Seller role Intermediate: asks to endorse the role Buyer in any group instantianting Supply creates a new group instantiating Selling, where it takes the roles Seller Client: asks to endorse the role Buyer in every group instantianting Selling.

Provider Intermediate Client

slide-7
SLIDE 7

MOCA 2004 – Aarhus 13.10.2004 7

Adina Nagy

Outline

 Introduction: origins, project, methodology  Aspect-oriented and Agent-Oriented

Programming

 Orthogonal concerns in MOCA

 Organizational structure  Agent architecture

 Dynamic weaving and conflict management  Conclusion  Future work

slide-8
SLIDE 8

MOCA 2004 – Aarhus 13.10.2004 8

Adina Nagy

Aspect and Agent-oriented programming

 Agent-Oriented Programming - main decomposition:

agents

 Aspect-Oriented perspective (www.aosd.net)

 problem: communication  elements of communication spread amongts agents 

scattered/cross-cutting concern

 Object-Oriented approach: avoid rewritting agents´

code

 superclass to implement a part of the communication protocols 

role (organisational approaches)

 Problems: multiple inheritance + still scatterred protocol

 MOCA: interaction protocols unified into organizations  Agents and Organizations: orthogonal concerns  Weaving of concerns through components (roles or not)

slide-9
SLIDE 9

MOCA 2004 – Aarhus 13.10.2004 9

Adina Nagy

Outline…

 Introduction: origins, project, methodology  Aspect-oriented and Agent-Oriented

Programming

 Orthogonal concerns in MOCA

 Organizational structure – main concepts  Agent architecture

 Dynamic weaving and conflict management  Conclusion  Future work

slide-10
SLIDE 10

MOCA 2004 – Aarhus 13.10.2004 10

Adina Nagy

Organisational concepts

 Roles (agent-perspective) and role

descriptions (organizational perspective)

 Statechart/ObjectZ representation  Example of organizations

slide-11
SLIDE 11

MOCA 2004 – Aarhus 13.10.2004 11

Adina Nagy

Roles and role descriptions

 Role description

 recurrent behaviour pattern at individual level  represented as statechart associated to behavioural

scripts

 Role

 endorsed individual pattern of interaction (and

behaviour), interacting with other individual patterns, within a group of agents

 instantiation of a role description

slide-12
SLIDE 12

MOCA 2004 – Aarhus 13.10.2004 12

Adina Nagy

Statecharts

root, embedded states

and-states (A1, A2)

  • r-states (A, F)

default states

transitions labelled influence[condition]/action Extensions of finite-state automata including an and-or decomposition of states [Harel 1987], [for organization schemata modelling: Hilaire 2000] Configurations: Root, A, A1, A2, B, C, D, E Root, F Execution: current configuration determines fireable transitions which determines next configuration SC- automata whose states are the configurations+ events+ conditions; before firing a transition a simplified graph is computed

slide-13
SLIDE 13

MOCA 2004 – Aarhus 13.10.2004 13

Adina Nagy

RD example – interaction pattern

Contract-net Organization

slide-14
SLIDE 14

MOCA 2004 – Aarhus 13.10.2004 14

Adina Nagy

Initiator

Attributes

Required competencies Provided competencies

Competencies scripts for

Internal competencies ObjectZ, Java interfaces

behaviour proposals: P Proposal chosen:Proposal req_competence = {send, evaluate, timeout} prov_competence = {delegate_task} generate_event(start) delegate_task Delegate_task

  • which task ?
  • return a result to the calling component
  • Call of the

competence delegate_task start/send(cfp)

  • A start event

provokes the send

  • f a call_for

_proposals (multicast) influence InfluenceType name = cfp attributes = {...} CfpInfluence not- understood  refuse propose/add_prop [timeout]/choose

∆ Proposal prop ? proposals’ = proposal  prop?

add-prop

/send_answer propose/send(reject) ∆ chosen  p  proposals  evaluate (chosen’)  evaluate(p)

choose

inform_done Inform_refuse failure

initiator

Initiator RD & role execution

  • Component

waits timeout influence and records proposals

 p  proposals - {chosen} send(p,reject) send(chosen,accept)

send_answers

slide-15
SLIDE 15

MOCA 2004 – Aarhus 13.10.2004 15

Adina Nagy

Role descriptions (reminder)

RD - recurrent behaviour pattern at individual level

Combined formalism

 statechart representation (interactions)  competencies behaviour scripts in ObjectZ

(XML files, Java interfaces)

Transitions - labelled - enacting_event[condition]/action

 enacting_event is an influence type  condition and action are competence calls

Competencies

 internal to roles  external: required or provided

slide-16
SLIDE 16

MOCA 2004 – Aarhus 13.10.2004 16

Adina Nagy

Example - Org. Supply

Organisation: Behaviour: Buyer asks Seller the price of a good and buys until has no more money left

Require Purse- related competenc e

slide-17
SLIDE 17

MOCA 2004 – Aarhus 13.10.2004 17

Adina Nagy

Example - Org. Selling

Buyer orders at random intervals a given quantity of goods to Seller If Seller has enough stock, it delivers the required amount, else it refuses delivery

Require Purse-related competencies m

slide-18
SLIDE 18

MOCA 2004 – Aarhus 13.10.2004 18

Adina Nagy

Example

Provider Intermediate

P u r s e

slide-19
SLIDE 19

MOCA 2004 – Aarhus 13.10.2004 19

Adina Nagy

Outline

 Introduction: origins, project, methodology  Aspect-oriented and Agent-Oriented Programming  Orthogonal concerns in MOCA

 Organizational structure: main concepts

 Representation of interaction protocols (RD+relations)  Independent of agents‘ architecture  first orthogonal concern

 Agent architecture

 Dynamic weaving and conflict management  Conclusion  Future work

slide-20
SLIDE 20

MOCA 2004 – Aarhus 13.10.2004 20

Adina Nagy

Agent architecture - componential

Components

Influences received and dispatched to roles Influences are sent by a specific component management of communication between components

components add/removal

Manage components

Agent type problem dependent encapsulates goals, etc driver for role endorsement/leave which components added/removed not specified in MOCA Components Components Management Module provides agent with primitives to manage components

CMM Agent Type PN ? Componential CMM ?

slide-21
SLIDE 21

MOCA 2004 – Aarhus 13.10.2004 21

Adina Nagy

Agents and components

  Roles: instantiation of a role

description

 follow the corresponding behaviours  roles are components defined through

their entry and exit ports

 entry ports: provided competencies  exit ports: required competencies

 provide a method ReceiveInfluence used by

the agent to dispatch influences received from other role

 agents may possess other components

(behaviour by statecharts, or not)

 agent architecture orthogonal to

  • rganizational structure

Components

slide-22
SLIDE 22

MOCA 2004 – Aarhus 13.10.2004 22

Adina Nagy

Outline

 Introduction: origins, project, methodology  Aspect-oriented and Agent-Oriented

Programming

 Orthogonal concerns in MOCA

 Organizational structure  Agent architecture

 Dynamic weaving and conflict management  Conclusion  Future work

slide-23
SLIDE 23

MOCA 2004 – Aarhus 13.10.2004 23

Adina Nagy

Elements for the dynamic weaving

Weavers: compiler, interpreter: ex. Composition filter

  • 1. Organizational dynamics

issued from agent‘s autonomy to take and leave roles

insured by a Management organization

the Type of agent is problem–dependent and encapsulates agent‘s goals

Join points: the roles

  • 2. Acceptance politics for ressources implying competence

calls

Example: „Intermediary“ agent has to provide money-related competencies

Competencies

which share ressources, need a common acceptance policy

 can be grouped into a Purse component and the policy is defined whithin this component

definition of acceptance policy needed for any component providing competencies

Second type of join points

slide-24
SLIDE 24

MOCA 2004 – Aarhus 13.10.2004 24

Adina Nagy

Role endorsement

 MOCA: how role endorsement and leave takes place  not why (future work)  Def: undertaking, by an agent, of a behaviour pattern  at any execution moment, the agent is in one or more

states from the statechart (a configuration) and executes the associated competence scripts

 may suppose creation of a group  roles provide competencies to agents at role

endorsement and may retire them or not at role’s leave

 Role leave

 release of the behavioural pattern, including the loss of

competencies

 may suppose group destruction

slide-25
SLIDE 25

MOCA 2004 – Aarhus 13.10.2004 25

Adina Nagy

Role endorsement properties

  • agents may take several roles at once, in one or

several organisations

  • conflicts issued from multiple-role execution
  • by mutual ignorance on competence calls

[Amiguet2003]

  • case of independent roles (without conflicting implicit

‘goals’)

  • arbitration mechanism (X-MOCA)
  • conflictual access to resources (encapsulated in

components) based on mutual ignorance – if components are represented as statecharts.

slide-26
SLIDE 26

MOCA 2004 – Aarhus 13.10.2004 26

Adina Nagy

Management organisation

  • Management organisation - implements meta-

services regarding role management primitives (create a group, take a role, leave a role, etc.)

  • the meta-level service represented by the organisations’

instantiation (group creation, destruction) is reified through an organisation

  • MO of MOCA checks
  • roles (relations) cardinalities
  • agent’s competencies, whenever an agent requests to enter a

group (through a role instantiation)

  • n.b. other policies may be defined
slide-27
SLIDE 27

MOCA 2004 – Aarhus 13.10.2004 27

Adina Nagy

Management Organisation

YP:

keeps update and provides the list

  • f organisations and groups

controls the global structure of the system (cardinalities of group instantiation)

Manager

  • resp. of a group; control entrance

and leave

checks roles cardinalities and competences

Requester

asks information from YP

asks the Manager for entering or leaving a group YellowPages (1) Manager (n) Requester (n)

slide-28
SLIDE 28

MOCA 2004 – Aarhus 13.10.2004 28

Adina Nagy

Organisational dynamics in MOCA

YP Agent 1

Management group

R Agent 3 R Agent 2 initial situation

Agents instantiating the Yellow Pages and Requester roles Agent 2 asks the role Yellow pages of Agent 1 to create a group Supply instantiating the Supply

  • rganization

No Manage r

slide-29
SLIDE 29

MOCA 2004 – Aarhus 13.10.2004 29

Adina Nagy

Group creation

Agent 2 automatically takes the role of Manager of the new group a new group Supply, without any agent is created

Yellow Page

Agent 1

Management group

Re-

quest- er

Agent 3 Agent 2

Re-

ques ter

Ma-

na- ger

Group Supply

slide-30
SLIDE 30

MOCA 2004 – Aarhus 13.10.2004 30

Adina Nagy

Role endorsement (I)

The role Requester of Agent 2 negotiates with its Manager role the endorsement of a Seller role in Supply the entrance in group Supply is accepted for Agent 2

R M YP Agent 1

Management group

R Agent 3 Agent 2 R M

Group Supply

Seller

slide-31
SLIDE 31

MOCA 2004 – Aarhus 13.10.2004 31

Adina Nagy

Role endorsement (II)

R M YP Agent 1

Management group

R Agent 3 Agent 2 R M

Group Supply

Seller

Agent 3 asks Agent 1’s role YP about existing organisations checks if a group instantiating Supply exists YP gives Agent 2 an acquaintance with the Manager

  • f Supply
slide-32
SLIDE 32

MOCA 2004 – Aarhus 13.10.2004 32

Adina Nagy

Inter-group communication

R M YP Agent 1

Management group

R Agent 3 Agent 2 R M

Group Supply

Seller r2 Buyer

Agent 2 communicates with the roles YP and Manager using the competencies provided by its R role Agent3 communicates with Agent2 via Seller, in Supply

influences competence calls

Agent 3 negotiates with the role Manager of Agent 2 the entrance in Supply

slide-33
SLIDE 33

MOCA 2004 – Aarhus 13.10.2004 33

Adina Nagy

Inter-group communication

Group Supply

YP Agent 1

Management group

R Agent 3 Intermediary Agent 2 - Seller R M Seller r2 influences Bu yer Client

Selling Group

P U R S E

Buyer Agent 4

slide-34
SLIDE 34

MOCA 2004 – Aarhus 13.10.2004 34

Adina Nagy

Role weaving through acceptance policies for components providing resources

  • For components providing competencies a domain-

dependent policies of call’s acceptance/conflict management may be required

  •  various types of roles’ weaving may appear by

changing this policy (without having to know about the organizational or agent structure)

 determines the type of roles interwining, the

level of mutual ignorance, the calls acceptance rates, the bloc time

slide-35
SLIDE 35

MOCA 2004 – Aarhus 13.10.2004 35

Adina Nagy

Role weaving through acceptance policies for the competence Purse

Tests with 4 policies

  • Accept all (without any policy): no conflict management
  • Strict reservation (SR): Purse is reserved for a role until

the release of its debit competence

  • Reservation accepting: same as strict but money entries

accepted at any moment (ER)

  • Refuse at last moment (LM): refused only calls where

the amount in Purse would become negative (the Buyer may not have enough money) Effects on role endorsement

  • Without: roles are executed in parallell (incorrect)
  • SR: only one role at once
  • ER: Intermediary’s Buyer role is executed in parallel with
  • thers
  • LM: all roles are parallel (incorrect)
slide-36
SLIDE 36

MOCA 2004 – Aarhus 13.10.2004 36

Adina Nagy

Effects on the Purse value (money vs. time)

Without - all roles in parralel SR – one role at once ER – Buyer in parallel with others LM – all roles in parralel

slide-37
SLIDE 37

MOCA 2004 – Aarhus 13.10.2004 37

Adina Nagy

Effects of politics on the blocking time of the Purse competence (5 Supplier agents, blocking time in seconds

  • vs. number of blockings of that duration)
slide-38
SLIDE 38

MOCA 2004 – Aarhus 13.10.2004 38

Adina Nagy

Effects on the number of refused calls

yes, but .. 14% 4% LM yes 10% 6% ER yes 30% 30% SR no 0% 0% Without Correct? Level 5 suppliers Refuse 2 suppliers Politics

slide-39
SLIDE 39

MOCA 2004 – Aarhus 13.10.2004 39

Adina Nagy

Outline

 Introduction: origins, project, methodology  Aspect-oriented and Agent-Oriented

Programming

 Orthogonal concerns in MOCA

 Organizational structure  Agent architecture

 Dynamic weaving and conflict management  Conclusion  Future work

slide-40
SLIDE 40

MOCA 2004 – Aarhus 13.10.2004 40

Adina Nagy

Components interactions and conflict management principles

Interactions between components - through competence calls

Principles

 interaction/action separation: roles - structure of

interactions; actual treatment by specialised components

 inter-group co-ordination: distinct groups interact through

common agents (roles in both groups) – increase secutity and stability, reusability

 a mechanism for the co-ordination/co-operation of roles

within an agent (CMM: any competence call passes through the CMM)

 competenceCall(calling component, CMM, called component)

 algorithms of the called, calling component/,

block,/release/ give-up

 CMM knows how long a component shall be blocked

through the mutual exclusion zones computation

slide-41
SLIDE 41

MOCA 2004 – Aarhus 13.10.2004 41

Adina Nagy

Mutual ignorance

 A system is said to insure mutual ignorance on

roles if any role (component) can execute without having to know whether the agent has

  • ther roles running.

i.e. if any component can use available competencies without knowing if and how other components use the same.

 Cost: components will have to wait  different from mutual exclusion on competence

calls on or components execution

slide-42
SLIDE 42

MOCA 2004 – Aarhus 13.10.2004 42

Adina Nagy

Mutual ignorance mechanism

 Described on components execution  Mechanism

Whenever a component A calls a competence of component B, and the call is accepted, A is registered as a user of B. (Protocol of the calling component)

When A makes its last call to this competence, B will be notified automatically. (Releasing protocol)

Component B has the possibility to accept or reject competence calls. An acceptance policy must be provided to determine whether B accepts one or several users, or one ‘full’ user and several ‘read-only users’, etc.

If the call is rejected, A will block the corresponding transition in its statechart. B will notify A when it is ready again to get calls.  mutual exclusion on zones which are

automatically determined at runtime, depending on the participating components and the nature of the involved resource.

slide-43
SLIDE 43

MOCA 2004 – Aarhus 13.10.2004 43

Adina Nagy

Computing possible calls of a competence -1

 The graph of all possible transitions is

generated

slide-44
SLIDE 44

MOCA 2004 – Aarhus 13.10.2004 44

Adina Nagy

Computing possible competence calls -2

 A reduced graph is computed  To each state are associated labels of all possible

component calls from that state

 Labels are transfered on the initial statechart and on

every particular configuration

slide-45
SLIDE 45

MOCA 2004 – Aarhus 13.10.2004 45

Adina Nagy

Release protocol

 Mutual ignorance is insured by computing

the moment when a called competence shall be released by the calling component

 To every state (configuration) from the

statechart is associated a list of the competencies which could be called from that state

 When a competence dissapears from the list,

it can be released (available for other component)

slide-46
SLIDE 46

MOCA 2004 – Aarhus 13.10.2004 46

Adina Nagy

Theorem 1

The fonction calls: GC -> A defined by he computation above has the following properties

ii)

For any configuration C and any transition T having C as a source calls(T) included in calls(C) ii) If C, C‘ are configurations such that there is a transition T:C->C‘, then calls(C) includes calls(C‘)

slide-47
SLIDE 47

MOCA 2004 – Aarhus 13.10.2004 47

Adina Nagy

Theorem 2

 The function calls: GCA is the minimal function

insuring the properties from Therorem 1, in the sense that, any other function c:GCA possessing those properties verifies calls(C) included in c(C) for any configuration C from the configuration graph GC.

 mutual ignorance is insured with minimal exclusion

zones

 but only for the case of endorsing independent roles

within the same agent

 case of roles with conflictual implicit purposes need a

generalizaion of the notion within an arbitration mechanism: object of the common work INKA-MOCA

slide-48
SLIDE 48

MOCA 2004 – Aarhus 13.10.2004 48

Adina Nagy

Mutual ignorance vs. mutual exclusion

 Mutual ignorance: incorrect for real- time: as

components may wait to access a competence in real- time applications waiting may break mutual ignorance)

 Mutual ignorance

 not equivalent to mutual exclusion on component calls: allow a

unique component to call a one competence could be too strong (situations where it supposes access to a read-only variable; too weak in situations where the exclusion would have to cover several consecutive calls .

 not equivalent to mutual exclusion on components execution:

  • nly the execution segments which compete for a given

competence have to be considered

slide-49
SLIDE 49

MOCA 2004 – Aarhus 13.10.2004 49

Adina Nagy

Conclusion

 2-dimensional separation of concerns into

agents (vertical slices) and organizations (horizontal slices)

 reusability, orthogonality

 agents don‘t communicate outside group, groups

communicate only by shared agents

 dynamical weaving (composition)  join points – roles/components  conflict management potentially interesting for

the AsOP community

 real-world case-study missing

slide-50
SLIDE 50

MOCA 2004 – Aarhus 13.10.2004 50

Adina Nagy

Further work

 security, validation, social dynamics are cross-cutting

concerns: orthogonalization into aspects ?

 how about multiple viewpoints (organizations) as

aspects ?

 platform: a proof of the concept [Baez2002]  implementation: MadKit & reimplementation MIMOSA

(CORMAS II)

 eXtended-MOCA: specify social dynamic patterns,

reasoning on competencies, generalize the notion of role, adaptable organizations (within the INKA- Socionics project at Humboldt)

slide-51
SLIDE 51

MOCA 2004 – Aarhus 13.10.2004 51

Adina Nagy

References

[Amiguet2003] Amiguet M., Un modèlecomponential dynamique pour systèmes multi-agent organizationnels, PhD thesis, University of Neuchâtel, Switzerland, 2003

[AMBN02] Amiguet, M., Müller, J-P., Báez, J, Nagy, A. The MOCA Platform: Simulating the Dynamics of Social Networks, Workshop of Multi- Agent–based simulation, MABS’02, AAMAS, Bologna, 2002, in J. Sichman (ed), Multi-agent based-simulation, Lecture Notes in Artificial Intelligence, Springer-Verlag, 2002

[Hilaire2000] Hilaire, V.: Vers une approche de spécification, de prototypage et de vérification de systèmes multi-agents. PhD thesis, Université de Franche-Comté, 2000 Contacts matthieu.amiguet@he-arc.ch baez@lirmm.fr nagy@informatik.hu-berlin.de jean-pierre.muller@cirad.fr