Professional Documents
Culture Documents
Alessandro Garcia Claudio SantAnna Christina Chavez Viviane Silva Carlos Lucena Arndt von Staa
Motivation
!
Complexity of modern software systems Emergent features and application domains
= Agent Properties
Classes, objects, methods, attributes, inheritance... UML, Java Programming Language, Design Patterns... 3 Viewpoints: Construction, Maintenance, and Reuse
The Problem
the features of objects and classes are not directly aligned with agency features
To what extent do OO abstractions produce MAS design and code that is reusable and maintainable?
Conceptual Level
Role
Organization
? ?
Object Pattern
?
Attribute Aspect Method Advice
Design Level
Dominates
Implementation Level
Several researchers say: Forget objects Lets construct a new software engineering, new design methods and techniques, new programming languages from the scratch Objects and agents are entities essentially different!
Arguments are not based on empirical evidence Limited understanding about the interplay between object and agent properties in practice
Autonomy Autonomy
Autonomy
Autonomy
An Empirical Study Goal: Improve our knowledge about the interplay between agency concerns and OO abstractions Comparison:
3 Viewpoints: Construction, Maintenance and Reuse MAS concerns were identified from different sources
Literature examples and MASs developed at our lab Agent-oriented design and programming languages
State: attributes Behavior: methods State: beliefs, actions, and goals Behavior: actions, properties (autonomy, adaptation, interaction, )
Reactive agents Large-scale MASs Different agent types and roles Multiple properties
An Example: Portalware MS
Agent Types Interface Agent User Agent Information Agent Naming Agent Roles User Agent: editor, content supplier, reviewer Information Agent: caller and answerer
An Example: Portalware
Software Agents
Collaboration
Learning
Mobility
Adaptation Interaction Autonomy
1. Use inheritance to define the different agent types of the application 2. Create methods on the subclasses to define specific capabilities 3. Create new beliefs, plans, and goals by extending the corresponding classes
1. Use the Mediator pattern to define the basic properties (adaptation, interaction, autonomy) and their composition 2. Associate the Mediator pattern with the Agent class
1. Use the Role pattern to define the different agent roles and their composition 2. Associate the Mediator pattern with the the Role pattern to modularize the collaboration concern
Aspect-Oriented Solution
Aspect
Join Points
Classes
Improve separation of concerns Improve maintainability and reuse of classes and crosscutting concerns AspectJ and Hyper/J
Aspect-Oriented Solution A
1. Use inheritance to define the different agent types of the application 2. Create methods on the subclasses to define specific capabilities 3. Create new beliefs, plans, and goals by extending the corresponding classes
1. Use an aspect to define each basic property (adaptation, interaction, autonomy) and their composition 2. Associate the aspects with the Agent class
1. Use an aspect to define each agent role 2. Attach the roles aspects to the respective agent types 3. Create an aspect to modularize the collaboration concern and attach it with the respective collaborative agent type
Subjects (Experienced Programmers): 2 PhD Students x 2 PhD Students Almost 2 years: January 2001 December 2002 Training on Aspect-Oriented Software Development Code Standardization each design and code implemented the same scenarios different programming styles
Plan
Agent
Property
Mediator Pattern
ailability Plan
Searching Plan
Interface Agent
Autonomy
Interaction Adaptation
Composite Pattern
Knowledge
Role Pattern
Collaboration
Counter Proposal
Proposal
Collaborative Agent
Collaboration Core
Collaboration Role
Middle Agent
User Agent
Information Agent
Content Supplier
Answerer Editor
Caller
Some OO abstractions are useful to represent concerns of reactive MASs Classes: agent types and knowledge Inheritance:
reuse of basic agent actions specialization: hierarchy of agent types, role hierarchies, plan hierarchy and action hierarchy
Limitations of patterns Choosing the suitable patterns is time-consuming Combination of patterns is challenging
Explosion of classes to address MAS concerns Some concerns are not encapsulated as a single pattern Difficult to understand the association between agency properties and specific agent types Limitations of aspects The identification of the join points is not trivial
Plan
Agent
Property
Mediator Pattern
ailability Plan
Searching Plan
Interface Agent
Autonomy
Interaction Adaptation
Composite Pattern
Knowledge
Role Pattern
Collaboration
Counter Proposal
Proposal
Collaborative Agent
Collaboration Core
Collaboration Role
Interface Agent
User Agent
Information Agent
Content Supplier
Answerer Editor
Caller
Evaluation Framework
Evaluation Framework Focus: Reusability and Maintainability Based on the Basilis GQM Methodology Definition of a Quality Model Definition of a Metrics Suite The Reuse and Evolution Scenarios
Results (I)
The Aspect-Oriented Approach provided: Better support for maintainability and reusability More concise MAS in terms of:
lines of code (LOC metric): 1231 x 1445 system vocabulary (VS metric): 56 x 62 component vocabulary (NOA metric) - use of patterns
CBC Metric - E.g.: Editor role: 18 x 23, Caller role: 19 x 25 DIT Metric - Patterns abuse the inheritance mechanism high inheritance couplings
Results (II)
The Aspect-Oriented Approach provided: Better support for separation of MAS concerns
LCOM metric
WMC metric (complexity of the advices/pointcuts)
Results (III)
The aspect-oriented approach required less modification and extension of the selected MAS
MODIFIABILITY Changed Entities S1 S2 S3 S4 S5 S6 S7 1 0 0 0 1 0 5 1 0 0 0 1 0 1 Changed Added Operations Entities 3 2 2 2 2 0 0 3 2 2 3 1 0 0 5 4 4 8 0 0 0 5 4 4 8 0 0 0 Added Operations 2 0 0 0 1 0 0 3 0 0 0 1 0 0 EXTENSIBILITY Changed Added Added Relations. Relations. LOCs 0 0 0 0 0 0 5 0 0 0 0 0 0 2 15 10 10 29 4 0 1 15 10 10 25 2 0 1 101 98 84 86 84 86 188 167 16 14 15 15 0 0 Changed LOCs 1 0 0 0 0 0 5 1 0 0 8 0 0 1 Copied Entities 0 0 0 0 0 0 0 0 Copied LOCs 0 0 6 40 0 0 6 0
PO AO PO AO PO AO PO AO PO AO PO AO PO AO PO AO PO AO PO AO
Ongoing Work
Empirical and theoretical validation of the proposed metrics Investigation of MASs containing cognitive agents electronic marketplace (PUC-Rio) urban traffic management (USP - Sao Paulo) Investigation of MASs designed and implemented outside of our group (SELMAS colleagues) Facet: An Aspect Language for Multi-Agent Systems
Component language: subset of TAO Facets: support crosscutting concerns in MAS design
Qualitative Study
A. Garcia, V. Silva, C. Chavez, C. Lucena. Engineering Multi-Agent Systems with Aspects and Patterns. Journal of the Brazilian Computer Society, Special Issue on Software Engineering and Databases, August 2002.
Quantitative Studies
A. Garcia et al. Agents and Objects: An Empirical Study on the Design and Implementation of MAS. In: SELMAS03 Proceedings. May 2003. (Accepted to Appear) A. Garcia et al. Agents and Objects: An Empirical Study on Software Engineering. TR 06-03, PUC-Rio, Brazil, February 2003.
Colocar mais referencias Usar sugestes dos revisores Dizer q outras pessoas conceberam o mtodo orientado a aspectos Ler sobre varivel dependente e independente. Trabalho em andamento Aspects in AOSE [S:P&E] The Facet Abstraction
Crosscutting Concerns in AO Languages New Abstraction to TAO MAS of SELMAS02 colleagues: Coordination, Trustworthy, Fault Tolerance, Display FacetTAO: An Aspect-Oriented Language for AOSE
SoC+Agents Group
MAS Applications VMarket CommercePipe VGroups Portalware SELMAS 2002, 2003
Modeling Language
Empirical Studies
Methods
Aspect-Oriented Approach
Cooperations
SoC + Agents
Metodologia Framework Conceitual
R D
T-Rex
Teste em SMAs
USP
I
Aplicao Mtodo
Our Approach
The 1st principle: the objects are not aware of the agency aspects added (obliviouness) The 2nd principle: with the separation of agent services from their agency properties, reuse and evolution is improved (quantification)
<<crosscuts>>
<<crosscuts>>
InformationAgent
search(Keyword) search( KWList )
AspectJ
Object
<<crosscuts>>
Our example
object autonomy interactive reactive agent proactive agent autistic
Outline
Motivation Research Questions The Problem Results Goals Publications Background Aspect-Oriented Software Development Design Patterns The Aspect-Oriented Method for MAS Development Empirical Studies My Doctoral Research: A Roadmap
! ?
Problems
behavior
Introduo
Propriedades Externas
Organizaes Ambientes
Agenthood
Agenthood
Autonomy, Interaction, Adaptation Collaboration, Intelligence, Mobility Inter-Agent Concerns Roles and Organizations
O Problema
Modelos do SMA
Propriedades Internas Propriedades Externas
SoC?
Data Collection
O Problema
Modelos do SMA
Propriedades Internas
Vrias Metodologias
Introduo
Modelos do SMA
Propriedades Internas Propriedades Externas
Games Simulation O que algumas pessoas acreditam e que ja estamos implementando MASs, mas com the OO notions at Artificial, Simulated Environment hand
LARGE-SCALE SYSTEMS
E-commerce, E-learning, Information filtering Virtual development environments...
Soluo e Objetivos
Soluo: Mtodo para Desenvolvimento de SMAs Objetivos: Entender se o paradigma de objetos adequado para o desenvolvimento de SMAs
How this research advances the state of the art of AOSE? Limitations of related work? Contribute to a better understanding of the interplay between agents and objects how? Experimenting and analyzing the problems arguments are not based on empirical sources our philosophy/methodology is different lets to look to working abstractions (such as OO, patterns,) and find the real problems underpinning the development of agents with existing abstractions. we think a good way to show the added value of agents is showing how it goes from OO to agents,
Background
Software Engineering of MASs Abstractions in OO Software Engineering Using OO Abstractions for Developing MASs
AOSE Researchers
MAS #1
Concern2
Empirical Studies
MAS Applications VMarket CommercePipe VGroups Portalware Avestruz
Problems encountered: lack of reuse of agency concerns across MAS projects prohibitive maintenance Possible causes: poor separation of concerns lack of unified terminology object schizophrenia
Fatores: Reusabilidade e Facilidade de Manuteno Mtodo Orientado a Padres OO (mediator, role, observer...) Estudo Qualitativo (1a. Fase) Elaborao de cenrios
Estudo Quantitativo (2a. Fase) Uso do mtodo GQM Definio de um conjunto de mtricas
Redefinio de mtricas clssicas (coeso, acoplamento, tamanho...) Criao de mtricas para SoC
Abuso de herana Exploso de classes Object Schizophrenia Adaptaes intrusivas (reutilizao e manuteno) Objetos, herana, agregao, ..., padres no fornecem suporte a SMAs reutilizveis e fceis de manter
Dificuldades
Papis x planos Descoberta dos aspectos (especficos de aplicao) nem sempre so fceis
Ainda precisvamos melhorar nosso entendimento sobre os mtodos e SMAs e SOOs Estudo Quantitativo (em desenvolvimento) Outros projetos (Marketplace) Projetos SMA fora do TecCoom (SELMAS02 workshop)
Conclusions
Based on the research results, what is the new thing to say independently from the use of patterns or not, OO abstractions do not fit very well with agency properties the aspect-oriented approach is generally better...
Motivation (III)
Object
O que algumas pessoas acreditam e que ja estamos implementando MASs, mas com the OO notions at hand
An Example: Portalware
An agent is capable of acting without direct external intervention It has its own control thread and can accept or refuse a request message An agent communicates with the environment and other agents by means of sensors and effectors an agent adapts/modifies its mental state according to messages received from the environment
Interaction
Adaptation
An Example: Portalware
cooperation and/or negotiation with other agents an agent can learn based on previous experience while reacting and interacting with its external environment an agent is able to transport itself from one environment to another
Learning
Mobility
Motivation (II)
Abstractions are used to isolate concerns UML Abstractions Class, object, method, attribute, specialization Additional Design Abstractions Design patterns [Gamma, 95] Java Abstractions Class, object, method, attribute, inheritance Method call, interface, ...
How agency concerns are structured based on OO abstractions? TecComm Lab Portalware, MAS Framework, Avestruz, VMarket, CommercePipe What are software engineering concerns to MAS developers? 3 viewpoints: Construction, Reuse, Maintenance
Agenthood
Agenthood
Definition of Agent Types services, goals and knowledge Definition of the Agenthood Properties Agenthood and other Properties structure the property strategies and algorithms associate agent types with properties associate properties with agent services and knowledge compose the properties Definition of Roles attach the roles with agent types Organizations, Environments
Change the number of agent types Change agent services Change algorithms related to agent properties degree of autonomy learning technique Addition of agent roles in different contexts Reuse Reuse Reuse Reuse agent types agent services algorithms related to agent properties agent roles in different contexts
Several OO implementation frameworks for MASs: T-Rex, JADE, Retsina, JAFIMA, ZEUS, Few software engineering approaches to support agents in OO design and implementation A set of design patterns [Kendall, 1999]
Several agent-oriented languages and methods GAIA, Common-KADS, Tropos, MAS-ML, ... Several OO implementation frameworks for MASs: T-Rex, JADE, Retsina, JAFIMA, ZEUS, Few software engineering approaches to support agents in OO design and implementation A set of design patterns [Kendall, 1999]
Based on solutions (patterns) documented in the literature Kendalls Patterns [Kendall, 99] Encapsulates the interaction concern Uses sensors and effectors (change the sensors) Mediator Pattern Modularizes each agency behavioral property
Mediate the use of these properties Role Pattern Decouples the agent services from the agent roles Encapsulates the collaboration concern
Separation of Concerns Aspects (and classes) encapsulate the agency concerns of interest Reusability Reuse of Aspects and Classes Maintainability Obliviousness Quantification
Aspects: concerns that crosscut system components Examples: logging, distribution, exception handling, and so on... Several approaches: AOP, MDSoC, Composition Filters, ... Abstractions in AOSD
AspectJ e Hyper/J
public PAgent(String aName, Vector pl) { init(); agentName = aName; theInteraction = new Interaction(this); theAutonomy = new Autonomy(this); theAdaptation = new Adaptation(this); planList = pl; System.out.println(" Name == " + agentName); } ... ... ... /* Interface for Interaction */ public void receiveMsg(Message msg) { theAutonomy.makeDecision(msg); theAdaptation.adaptBeliefs(msg); } public void outcomingMsg(Message msg) { theInteraction.outcomingMsg(msg); } }
Effector
INTERACTION
Inbox Outbox ReceiveMsg() SendMsg() Receive() Send()
<<crosscuts>>
Agent
<<crosscuts>>
<<crosscuts>>
Advices Part
CALLER
sendSearchAsk() receiveResult()
ANSWERER
after(search*):Transfer() receiveSearchAsk() sendResult()
<<crosscuts>>
after(search*):StartsCaller() after(search*):StartsAnswerer()
InformationAgent
search(Keyword) search(KWList)
Separation of Concerns Patterns encapsulate the MAS concerns of interest Improve the design vocabulary Reusability Reuse of the pattern and its solution elements Maintainability Planning for Change
The methods are concerned with concerns independently of implementation architecture: JADE, JAFIMA, RETSINA, ZEUS, IBM AGLETS communication language: KQML, ACL... ontology description: DAML+OIL, SHOE...
Ongoing Work
Investigation of MASs containing cognitive agents electronic marketplace (PUC-Rio) urban traffic management (USP - Sao Paulo) Investigation of MASs designed and implemented outside of our group (SELMAS colleagues)
The Metrics
Metrics
Vocabulary Size (VS) Lines of Code (LOC) Number of Attributes (NOA) Weighted Methods per Component (WMC) Coupling Between Components (CBC) Lack of Cohesion in Methods (LCOM) Depth of Inheritance Tree (DIT) Concern Diffusion over Components (CDC) Concern Diffusion over Operations (CDO) Concern Diffusions over LOC (CDLOC)
Answered Questions
How many components (classes/aspects) are in the design? How many lines of code are there in the implementation? How many attributes are there in the components? How many operations (methods/advices) are there? How high is the coupling between components? How high is the cohesion of the systems components? How high is the coupling between components? How high is the cohesion of the systems components? How well are the agency concerns localized in terms of components? How well are the agency concerns localized in terms of operations? How well are the agency concerns localized in termos of LOC?
Principles
Size Size Size Size Coupling Cohesion Coupling and Cohesion Separation of Concerns Separation of Concerns Separation of Concerns