Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 ·...

52
Agent-Oriented Programming for Developing Modern Software Systems Andrea Santi 1 [email protected] Alma Mater Studiorum—Universit` a di Bologna Ph.D in Electronics, Computer Science and Telecommunications 1 - XXV Ciclo Second Year Ending Seminar 21/10/2011 A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 1 / 52

Transcript of Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 ·...

Page 1: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Agent-Oriented Programming for Developing ModernSoftware Systems

Andrea Santi1

[email protected]

Alma Mater Studiorum—Universita di BolognaPh.D in Electronics, Computer Science and Telecommunications1- XXV Ciclo

Second Year Ending Seminar21/10/2011

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 1 / 52

Page 2: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Introduction

Outline

1 IntroductionContextObjectivesMethod

2 Multi-Agent Oriented ProgrammingContextThe JaCa platformThe JaCaMo FrameworkWeaknesses and Limitations

3 The simpAL ProjectBackground MetaphorProgramming Model

4 Conclusions

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 2 / 52

Page 3: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Introduction Context

Outline

1 IntroductionContextObjectivesMethod

2 Multi-Agent Oriented ProgrammingContextThe JaCa platformThe JaCaMo FrameworkWeaknesses and Limitations

3 The simpAL ProjectBackground MetaphorProgramming Model

4 Conclusions

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 3 / 52

Page 4: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Introduction Context

Developing Modern Software Systems: Challenges

Developing modern software systems is an hard task

Almost every modern application has to deal with issues such as

ConcurrencyDistributionDecentralisation of control...

The free lunch is over [Sutter and Larus, 2005]

Towards a paradigm change in computer science [Zambonelli, 2004]

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 4 / 52

Page 5: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Introduction Context

How to Program Such Systems?

It is now important to introduce higher-level programmingabstractions [Sutter and Larus, 2005]

Easing the development of modern software systemsLike OO abstractions help(ed) build large component-based programs

Proliferation of new programming languages/frameworks aiming atease this task

Rooted on not so mainstream (yet) programming models

The Actor [Hewitt et al., 1973] model one is a main example

Scala [Wampler and Payne, 2009], Groovy [Konig and Glover, 2007],Clojure [Hickey, 2011], etc.

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 5 / 52

Page 6: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Introduction Context

Agent-Oriented Programming (AOP):the Current Situation

The idea of Agent-Oriented Programming is not new

The first paper about AOP is dated 1993 [Shoham, 1993].... and since then many APLs and platforms have beenproposed [Bordini et al., 2005, Bordini et al., 2009, Bordini et al., 2006]

Main acceptations are the (D)AI contexts

Agents as a special purpose technique to build intelligent systems

No significant impacts on mainstream research in programminglanguages and software development

Emphasis put on theoretical issues

No focus on principles of general-purpose computer programming

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 6 / 52

Page 7: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Introduction Context

Our Perspective

AOP can be exploited for programming modern software systems ingeneral [Ricci and Santi, 2011a]

Extending object/function-oriented programming

Thanks to an higher-level of abstraction

Tackling main challenges of modern software development

ConcurrencyDecentralization of controlAutonomyAdaptivity...

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 7 / 52

Page 8: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Introduction Objectives

Outline

1 IntroductionContextObjectivesMethod

2 Multi-Agent Oriented ProgrammingContextThe JaCa platformThe JaCaMo FrameworkWeaknesses and Limitations

3 The simpAL ProjectBackground MetaphorProgramming Model

4 Conclusions

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 8 / 52

Page 9: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Introduction Objectives

Objectives

Background Objective

Explore AOP as a high-level general purpose programming paradigmproviding a set of abstractions meant to simplify the design of concurrent,distributed, reactive/interactive programs

In particular we are interested in

Identify the essential concepts and features of the paradigm

Focussing on principles of general-purpose computer programming

Inject/re-frame modern programming languages features in AOP

Typing, reuse, inheritance, etc.

AOP’s impact on the set of programming support tools

IDE, debuggers, profilers, etc.

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 9 / 52

Page 10: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Introduction Method

Outline

1 IntroductionContextObjectivesMethod

2 Multi-Agent Oriented ProgrammingContextThe JaCa platformThe JaCaMo FrameworkWeaknesses and Limitations

3 The simpAL ProjectBackground MetaphorProgramming Model

4 Conclusions

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 10 / 52

Page 11: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Introduction Method

How Achieve the Stated Objectives?

A container project named simpAL [Ricci and Santi, 2011b]

Concerning the design and development of

A new generation agent-oriented programming language (i.e. simpAL)Related platforms / infrastructures / tools

Starting from the construction of a solid backgroundStudying state of the art of

Agent architecturesAgent programming languages, programming models

Making contributions in the context of Multi-Agent OrientedProgramming

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 11 / 52

Page 12: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Multi-Agent Oriented Programming

Outline

1 IntroductionContextObjectivesMethod

2 Multi-Agent Oriented ProgrammingContextThe JaCa platformThe JaCaMo FrameworkWeaknesses and Limitations

3 The simpAL ProjectBackground MetaphorProgramming Model

4 Conclusions

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 12 / 52

Page 13: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Multi-Agent Oriented Programming Context

Outline

1 IntroductionContextObjectivesMethod

2 Multi-Agent Oriented ProgrammingContextThe JaCa platformThe JaCaMo FrameworkWeaknesses and Limitations

3 The simpAL ProjectBackground MetaphorProgramming Model

4 Conclusions

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 13 / 52

Page 14: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Multi-Agent Oriented Programming Context

Objectives

Investigating the adoption of state of the art agent-orientedtechnologies for programming Multi-Agent System (MAS)

Focus on

Agent-Oriented Programming Languages (APLs)Agent-based frameworks

Aiming at

Construct a background knowledge on state of the art

Agent architecturesAPLs, programming models

Immediately applying agent-based technologies in relevant domainsImproving current agent-based technologies

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 14 / 52

Page 15: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Multi-Agent Oriented Programming Context

The Belief Desire Intention (BDI) Agent Model

Introduced by Rao and Georgeff [Rao and Georgeff, 1995]

Reference model for the development of rational/inteligent agents

The BDI model promote agent designed rooted upon:

Belief knowledge the agent has about the world and other agents

Desire all the possible objectives the agent might like to accomplish

Intention the set of objectives the agent has decided to work towards

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 15 / 52

Page 16: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Multi-Agent Oriented Programming Context

Agents’ Control Architecture

sense stage

plan stage

act stage

events

actions

Agent State

Agent Program (plans)

Agent Ongoing Tasks

clock

Eventqueue (sensor)

Action buffer (actuator)

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 16 / 52

Page 17: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Multi-Agent Oriented Programming The JaCa platform

Outline

1 IntroductionContextObjectivesMethod

2 Multi-Agent Oriented ProgrammingContextThe JaCa platformThe JaCaMo FrameworkWeaknesses and Limitations

3 The simpAL ProjectBackground MetaphorProgramming Model

4 Conclusions

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 17 / 52

Page 18: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Multi-Agent Oriented Programming The JaCa platform

The JaCa platform

Our base reference platform/infrastructure

For this macro-research line

Born from the synergistic integration of

Jason [Bordini et al., 2007]

A BDI-based agent-oriented programming languagehttp://jason.sourceforge.net/

CArtAgO [Ricci et al., 2009]

A framework for building agents’ working environmentshttp://cartago.sourceforge.net

Applied in several application contexts

Mobile [Santi et al., 2011]SOA/WS [Piunti et al., 2009]Ambient-Intelligence [Sorici et al., 2011]

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 18 / 52

Page 19: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Multi-Agent Oriented Programming The JaCa platform

JaCa-Android in Action: SMS Notification Manager 1/2

Figure: Two different kinds of SMS notifications: (a) notification performed usingthe standard Android status bar, and (b) notification performed using theViewerArtifact.

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 19 / 52

Page 20: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Multi-Agent Oriented Programming The JaCa platform

JaCa-Android in Action: SMS Notification Manager 2/2

00 !init.

01

02 +!init

03 <- focus("SMSArtifact");

04 focus("NotificationManager");

05 focus("ViewerArtifact").

06

07 +sms_received(Source, Message)

08 : not (state("running") & session(Source))

09 <- showNotification("jaca.android:drawable/notification",

10 Source, Message, "jaca.android.sms.SmsViewer", Id);

11 append(Source, Message).

12

13 +sms_received(Source, Message) : state("running") & session(Source)

14 <- append(Source, Message).

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 20 / 52

Page 21: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Multi-Agent Oriented Programming The JaCaMo Framework

Outline

1 IntroductionContextObjectivesMethod

2 Multi-Agent Oriented ProgrammingContextThe JaCa platformThe JaCaMo FrameworkWeaknesses and Limitations

3 The simpAL ProjectBackground MetaphorProgramming Model

4 Conclusions

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 21 / 52

Page 22: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Multi-Agent Oriented Programming The JaCaMo Framework

The JaCaMo Framework

A comprehensive multi-agent oriented programmingapproach [Boissier et al., 2012]

Taking into account three different programming dimensions

Agent, environment, and organization dimensions

Built upon the synergistic integration of

Jason [Bordini et al., 2007]CArtAgO [Ricci et al., 2009]Moise [Hubner et al., 2007]

Defining semantic links among concepts of the different programmingdimensions at the meta-model and programming levels

Providing a uniform programming model for MAS programming

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 22 / 52

Page 23: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Multi-Agent Oriented Programming Weaknesses and Limitations

Outline

1 IntroductionContextObjectivesMethod

2 Multi-Agent Oriented ProgrammingContextThe JaCa platformThe JaCaMo FrameworkWeaknesses and Limitations

3 The simpAL ProjectBackground MetaphorProgramming Model

4 Conclusions

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 23 / 52

Page 24: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Multi-Agent Oriented Programming Weaknesses and Limitations

Weaknesses and Limitations

Weak support for modularise active behaviour

A main issue: absence of hierarchical structure for plans

Still no explicit notion of type

Neither for agents nor for artifacts

Lack of a seamless integration with object/functional-oriented layer

We are currently using a custom library

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 24 / 52

Page 25: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

The simpAL Project

Outline

1 IntroductionContextObjectivesMethod

2 Multi-Agent Oriented ProgrammingContextThe JaCa platformThe JaCaMo FrameworkWeaknesses and Limitations

3 The simpAL ProjectBackground MetaphorProgramming Model

4 Conclusions

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 25 / 52

Page 26: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

The simpAL Project Background Metaphor

Outline

1 IntroductionContextObjectivesMethod

2 Multi-Agent Oriented ProgrammingContextThe JaCa platformThe JaCaMo FrameworkWeaknesses and Limitations

3 The simpAL ProjectBackground MetaphorProgramming Model

4 Conclusions

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 26 / 52

Page 27: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

The simpAL Project Background Metaphor

Abstractions and Metaphors for Computer Programming

OOP metaphor: real-world objects

Objects have properties and statesObjects can communicate and respond to communications

Actors metaphor: anthropomorphic inspiration

A set of light-weight processes (actors)....interacting only via asynchronous message-passing

Our Agent-Oriented Programming metaphor

Anthropomorphic inspiration tooA&A meta-model: mimicking human cooperative work environmentsfrom Activity Theory [Nardi, 1996] and Distributed CognitionBDI Agent Model [Rao and Georgeff, 1995]

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 27 / 52

Page 28: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

The simpAL Project Background Metaphor

Background Metaphor: an Abstract Representation

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 28 / 52

Page 29: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

The simpAL Project Programming Model

Outline

1 IntroductionContextObjectivesMethod

2 Multi-Agent Oriented ProgrammingContextThe JaCa platformThe JaCaMo FrameworkWeaknesses and Limitations

3 The simpAL ProjectBackground MetaphorProgramming Model

4 Conclusions

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 29 / 52

Page 30: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

The simpAL Project Programming Model

Agents

Autonomous, state-full task- and event-driven entityBased on a BDI architectureCreating and co-using artifacts for supporting their activities

besides direct communication

Autonomous behaviour structured in terms of

Role

The set of tasks an agent must be able to do inside an organisation

Tasks

Unit of work that has to be executedDefining what have to be executed

Plans

Actions to be performed for achieving a taskDefining how to execute a task

Agent Script

Collection of concrete plans for playing a role

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 30 / 52

Page 31: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

The simpAL Project Programming Model

Working Environments

Structured in terms of multiple (distributed) workspace

Provide agents the tools and resource they need by means of artifacts

Artifacts are non-autonomous function-oriented entitiesControllable and observable by agentsFunctionalities provided by artifact operationsState exposed by means of observable properties

WORKSPACE B

observeuse

communicate with

ARTIFACTS

ARTIFACTS

WORKSPACE A

AGENTSORGANISATION

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 31 / 52

Page 32: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

The simpAL Project Programming Model

An Agent Role Example

r o l e MyRole e x t e n d s B a s i c R o l e {t a s k MyTask {

aParam : i n t ; // p r i m i t i v e t y p emyLi s t : L i s t <S t r i n g >; // an o b j e c tmyCounterTool : C o u n t e r I n t e r f a c e ; // an a r t i f a c t

}t a s k AnotherTask { . . . }

}

Figure: An example of role definition in simpAL

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 32 / 52

Page 33: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

The simpAL Project Programming Model

Agent Script

Defines how play one or more roles by means of concrete plans

s c r i p t MyScr ipt implements MyRole {s t : S t r i n g ;myTool : MyTool ;

p l a n MyPlanAt a s k : MyTaskc o n t e x t : ( aParam > 0 && s t . e q u a l s (” t e s t ” ) ) { . . . }

p l a n MyPlanBt a s k : MyTaskc o n t e x t : aParam <= 0u s i n g : myCounterTool , myTool { . . . }

p l a n MyPlanCt a s k : AnotherTask { . . . }

. . .}

Figure: An example of agent script definition in simpAL

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 33 / 52

Page 34: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

The simpAL Project Programming Model

Mixed Reactive and Proactive Behavior

A plan body is composed by a set of action rulesEvent : Context ⇒ Action [label]

Easily mixing of reactive/proactive behavihorCombining Event and Context attributes

p l a n MixedPlan t a s k : MyTask {myBel : S t r i n g ;myTool−>doAct ion1 ( ) ;myTool−>doAct ion2 ( ) ;myTool−>doAct ion3 ( ) ;. . .

+c r i t i c a l c o n d i t i o n : myBel == ” s t a t e 1 ” => d o R e p a i r A c t i o n 1 ( )+c r i t i c a l c o n d i t i o n : myBel == ” s t a t e 2 ” => d o R e p a i r A c t i o n 2 ( )+n e w i n f o : t r u e => p r i n t l n (”New i n f o r e t r i e v e d ” + n e w i n f o )

}

Figure: An example of mixed reactive and proactive behavior in simpAL

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 34 / 52

Page 35: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

The simpAL Project Programming Model

simpAL Type System

Agent Side

Agent type ↔ role(s) it implements

Set of tasks the agent is able to perform

Agent role: the contract identifying a certain set of tasks

Analogous to the interface for OOPBasic unit for agent sub-typing/hierarchies relationsAn agent can play/implement multiple roles

Artifact Side

Artifact type ↔ its artifact model (usage interface), including

OperationsThe set of its observable properties

Sub-typing and inheritance rooted on the notion of Artifact type

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 35 / 52

Page 36: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

The simpAL Project Programming Model

Inheritance, Polymorphism and Error Checking

Inheritance

We can define inheritance relations for what concerns

Agent roles/scriptsArtifact models and concrete implementations

Polymorphism

We are able to support polymorphism at different levels

Role level

Agents implementing the same role in different ways

Agent script level

Tasks performed in different ways on the base of contextual conditions

Artifact and artifact model level

Error Checking

We are able to support error checking at compile time

Agents implementation compliant to the roles it implementsArtifact definition must adhere to its model specification...

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 36 / 52

Page 37: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

The simpAL Project Programming Model

The simpAL Ecosystem

OS

simpAL OS(JVM based)

MyApp1 MyApp2

OS

simpAL OS(JVM based)

MyApp1

OS

simpAL OS(JVM based)

MyApp1

ws1MyApp1 org

ws2 ws3

Application-specific structures

Runtime Infrastructure

Applicationlogical view

agent processor

artifact processoragentartifact

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 37 / 52

Page 38: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Conclusions

Outline

1 IntroductionContextObjectivesMethod

2 Multi-Agent Oriented ProgrammingContextThe JaCa platformThe JaCaMo FrameworkWeaknesses and Limitations

3 The simpAL ProjectBackground MetaphorProgramming Model

4 Conclusions

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 38 / 52

Page 39: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Conclusions

Future Work

Main efforts to be put on finalizing/improving the simpAL projectFrom the language perspective

Shape the basic set of features of the languageFinalize and formalize the type system

From the simpAL platform perspective

IDEs, debuggers, profilers, etc.Finalize the work on the distributed Runtime Infrastructure

Test simpAL effectiveness for developing modern software systems

In relevant application domainsPointing out experienced outcomes, benefits and limitations

Continue the exploration with the JaCaMo framework

As a reference multi-agent oriented programming approach fordeveloping MAS

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 39 / 52

Page 40: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Conclusions

AGERE!@SPLASH

AGERE! Programming Systems, Languages, and Applications based onActors, Agents, and Decentralized Control

International workshop we organised to discuss our ideas in practice

Held at the ACM conference SPLASH 2011

Aiming at investigating Actors and Agents as post-OO programmingparadigm

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 40 / 52

Page 41: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Conclusions

Bibliography I

Boissier, O., Bordini, R., Hubner, J. F., Ricci, A., and Santi, A.(2012).Multi-agent oriented programming with jacamo.Science of Computer Programming.Special Issue on Agent-oriented Design methods and ProgrammingTechniques for Distributed Computing in Dynamic and ComplexEnvironments.

Bordini, R., Braubach, L., Dastani, M., Seghrouchni, A., Gomez-Sanz,J., Leite, J., O’Hare, G., Pokahr, A., and Ricci, A. (2006).A survey of programming languages and platforms for multi-agentsystems.In Informatica 30, pages 33–44.

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 41 / 52

Page 42: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Conclusions

Bibliography II

Bordini, R., Dastani, M., Dix, J., and El Fallah Seghrouchni, A.,editors (2005).Multi-Agent Programming Languages, Platforms and Applications -Volume 1, volume 15 of Multiagent Systems, Artificial Societies, andSimulated Organizations. Springer.

Bordini, R., Dastani, M., Dix, J., and El Fallah Seghrouchni, A.,editors (2009).Multi-Agent Programming Languages, Platforms and Applications -Volume 2, Multiagent Systems, Artificial Societies, and SimulatedOrganizations. Springer.

Bordini, R., Hubner, J., and Wooldridge, M. (2007).Programming Multi-Agent Systems in AgentSpeak Using Jason.John Wiley & Sons, Ltd.

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 42 / 52

Page 43: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Conclusions

Bibliography III

Hewitt, C., Bishop, P., and Steiger, R. (1973).A universal modular actor formalism for artificial intelligence.In Proceedings of the 3rd international joint conference on Artificialintelligence, pages 235–245. Morgan Kaufmann Publishers Inc.

Hickey, R. (2011).Agents and asynchronous actions (in clojure).Online document, available at: http://clojure.org/agents – LastRetrieved: Sept. 1, 2011.

Hubner, J. F., Sichman, J. S., and Boissier, O. (2007).Developing Organised Multi-Agent Systems Using the MOISE+Model: Programming Issues at the System and Agent Levels.Agent-Oriented Software Engineering, 1(3/4):370–395.

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 43 / 52

Page 44: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Conclusions

Bibliography IV

Konig, D. and Glover, A. (2007).Groovy in action.Manning Pubs Co Series. Manning.

Nardi, B. (1996).Activity theory and human-computer interaction.Context and consciousness: Activity theory and human-computerinteraction, pages 7–16.

Piunti, M., Santi, A., and Ricci, A. (2009).Programming SOA/WS systems with BDI agents and artifact-basedenvironments.In Proceedings of MALLOW-AWESOME Joint Workshop on Agents,Web Services and Ontologies, Integrated Methodologies.

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 44 / 52

Page 45: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Conclusions

Bibliography V

Rao, A. S. and Georgeff, M. P. (1995).BDI Agents: From Theory to Practice.In First International Conference on Multi Agent Systems (ICMAS95).

Resnick, M. (1994).Turtles, Termites and Traffic Jams. Explorations in Massively ParallelMicroworlds.MIT Press.

Ricci, A., Piunti, M., Viroli, M., and Omicini, A. (2009).Environment programming in CArtAgO.In Bordini, R. H., Dastani, M., Dix, J., and El Fallah-Seghrouchni, A.,editors, Multi-Agent Programming: Languages, Platforms andApplications, Vol. 2, pages 259–288. Springer.

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 45 / 52

Page 46: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Conclusions

Bibliography VI

Ricci, A. and Santi, A. (2011a).Agent-oriented computing: Agents as a paradigm for computerprogramming and software development.In Proc. of the 3rd Int. Conf. on Future Computational Technologiesand Applications (Future Computing ’11), Rome, Italy. IARIA.

Ricci, A. and Santi, A. (2011b).Designing a general-purpose programming language based onagent-oriented abstractions: The simpal project.In Proceedings of First International Workshop on ProgrammingSystems, Languages, and Applications based on Actors, Agents, andDecentralized Control, AGERE!

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 46 / 52

Page 47: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Conclusions

Bibliography VII

Santi, A., Guidi, M., and Ricci, A. (2011).JaCa-Android: An agent-based platform for building smart mobileapplications.In Dastani, M., El Fallah Seghrouchni, A., Hubner, J., and Leite, J.,editors, Languages, Methodologies, and Development Tools forMulti-Agent Systems, volume 6822 of LNAI, pages 95–119. Springer.

Shoham, Y. (1993).Agent-oriented programming.Artificial Intelligence, 60(1):51–92.

Sorici, A., Santi, A., Picard, G., and Boissier, O. (2011).An adaptive jacamo-based ambient intelligence application.In PAAMS.

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 47 / 52

Page 48: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Conclusions

Bibliography VIII

Sutter, H. and Larus, J. (2005).Software and the concurrency revolution.ACM Queue: Tomorrow’s Computing Today, 3(7):54–62.

Wampler, D. and Payne, A. (2009).Programming Scala.O’Reilly Series. O’Reilly Media.

Zambonelli, F. (2004).Towards a paradigm change in computer science and softwareengineering: a synthesis.The Knowledge Engineering Review, 18(04):329–342.

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 48 / 52

Page 49: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Conclusions

Considerations

Decentralized mindset in programming [Resnick, 1994] thanks to

Encapsulation of control (into agents)An interaction dimension rooted on two interaction typologies

Asynchronous message passingEnvironment-mediated interactions

An high-level rationale to structure autonomous behaviour

Through the notion of roles, tasks and plans

Integration of pro-active and reactive behaviour

Thanks to the agent control architecture

Avoidance of ”everything is an X” perspective

Agents to model active parts, artifacts for passive ones

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 49 / 52

Page 50: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Conclusions

Inheritance: Notable Cases

R1 can be defined as an extension of role R

Inheriting all tasks defined in RAdding/specializing tasks defined in R

Ag1 can be defined as an extension of an agent script Ag

Inheriting all plans defined in AgAdding further plans either to achieve

Task defined in the role implemented by AgNew tasks defined in a role implemented by Ag1 (and not by Ag)

Similar inheritance relations can be defined also for the environmentdimension

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 50 / 52

Page 51: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Conclusions

Error Checking and Polymorphism: Notable Cases

Error Checking

An agent script must define at least one plan for each task defined inthe role it implements

Artifact definition must adhere to its model specification

Duplicated constructs checks

...

Polymorphism

The same task can be performed by different agents implementing thesame role in different ways

Depending on the scripts that they are using

Task assigned to an agent can be performed in a different way

Depending on current contextual conditions

Artifacts can provide different implementations for the same model

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 51 / 52

Page 52: Agent-Oriented Programming for Developing Modern Software … fine... · 2012-09-03 · Ambient-Intelligence [Sorici et al., 2011] A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar

Conclusions

Integration with Object-Oriented/Functional programming

Agent and environment are coarse grain abstractions

Defining the high-level organization of the systemNot useful for defining

Data structuresComputational parts manipulating them

OOP/Functional languages to define data structures and functions

simpAL integration with OO programming languages is quitestraightforward

Thanks to a clear separation between the agents/environment layer andthe objects/functions one

A. Santi (DEIS) XXV Ciclo Second Year Ending Seminar 21/10/2011 52 / 52