Title: A Generalpurpose Programming Model and Technology for Developing Artifactbased Environments in MAS
1A General-purpose Programming Model and
Technology for Developing Artifact-based
Environments in MAS
Alessandro Ricci, Mirko Viroli, Andrea
Omicini aliCE team at DEIS Alma Mater Studiorum,
Università di Bologna CESENA (Italy)
mailto a.ricci_at_unibo.it
2OUTLINE
- Background the notion of artifact
- artifact-based working environments
- AA reference model
- a ref. model for artifacts
- theory of use observation
- CARTAGO Infrastructure
- providing API for creating and interacting with
artifact-based working environments - JASON CARTAGO
- First experiments integrating a cognitive agent
platform and CARTAGO
3BACKGROUND ARTIFACT-BASED ENVIRONMENTS FOR MAS
- Notion of artifact as basic abstraction in MAS
theory and engineering - previous work
- Coordination Artifacts notion in AAMAS04
Coordination Artifacts Environment-based
Coordination of Intelligent Agents - First generalization in ProMAS05 Programming
MAS with Artifacts - First work on artifact infrastructure in
E4MAS06 Costruenda est CARTAGO - objective agents MAS as paradigm for
mainstream programming and engineering - concurrent and distributed systems
- Identifying and engineering the function-oriented
part of a MAS - Activity-Theory as reference conceptual framework
- Human cooperative working environment as basic
metaphor
4AGENT WORKING ENVIRONMENTS
5THE AA (Agents Artifact) MODEL
- Agents
- goal / task / activity -oriented
- create and co-use artifacts for supporting their
activities - Artifacts
- function-oriented
- tools, resources used by agents and designed by
MAS programmers - Workspaces
- grouping agents artifacts
- defining the topology of the working environment
- scoping the interactions
MAS
6ARTIFACT ABSTRACTIONBENEFITS
- High-level uniform approach to engineer
suitable working environments to support (and
simplify) agent complex activities - encapsulation
- reusability with artifact libraries
- blackboards, shared KBs, maps, schedulers, etc
- Solving a conceptual / semantic mismatch
- avoiding the use of agents for modelling also
what is not autonomous / goal-oriented - fundamental to scale with system complexity
- Encapsulating existing infrastructure /
lower-level service at the agent level of
abstraction - avoiding to cross the level of abstractions when
developing systems
7ARTIFACTS AGENT COGNITION
- AT activity hierarchy connecting agent cognitive
model and artifacts - A theory of use and observation for defining
agent-artifact interaction - dually to the theories about inter-agent
communication
8A REFERENCE MODEL FOR ARTIFACTS(COFFEE MACHINE
METAPHOR)
9THE ARTIFACT MANUAL
- Formal description of artifact functionality and
usage - Function Descriptions
- intended purpose of the artifacts
- Operating Instruction
- how to use the artifact
- Explicitly specified by artifact designer
- basic AA ontology artifact-specific ontology
- Enabling intelligent selection use of artifacts
- agents dynamically reading, reasoning about and
using the manual
10DYNAMICS USE OBSERVATION
11OTHER CHARACTERISTICS
- Artifact labeled observable state
- complex observable behaviors can be organized in
labeled states - changing the UI and OBS properties according to
the state - Concurrency
- multiple agents can use concurrently the same
artifact - consistency
- only one operation at a time can be in execution
at a time - complex and long-running operation composed by
multiple steps, enabled by guards - Simple formal model and operational semantics
- based on labeled transition systems
12CARTAGO
- Infrastructure for creating artifact-based
working environments in MAS applications - Java-based, open-source technology
- http//www.alice.unibo.it/cartago
- implementing the AA reference model
- Orthogonal to the specific MAS platform adopted
- first experiments with Jason
- possibly gluing multiple MAS platforms
- heterogeneous agents working in the same working
environments
13CURRENT SUPPORT
- Programming Model API for programming artifacts
- used by MAS programmers to define artifact
templates - currently mapped on top of the Java language
- defining artifact structure behaviour in terms
of Java abstractions - Programming Model API for instantiating and
interacting with artifacts in a working
environment - used by agents to work with artifacts
- or equivalently used by MAS programmers to
define agents able to work with artifacts - Runtime environment and tools
- managing artifact life-cycle and agent-artifact
interaction - Basic artifact library
- ready-to-use artifacts with different kind of
functionalities - coordination, GUI, wrappers (objects, Web
Services, ...)
14ABSTRACT ARCHITECTURE
15MAIN API AVAILABLE TO AGENTS
- Artifact use
- use(AID,Op(Name,Params),SID) OpId
- sense(SID,Filter,Timeout)Perception
- Artifact construction
- using pre-defined factory artifact
- use(factory,make(myArt,MyArtClass,ArtConfig),S
ID) - Artifact lookup discovery
- using pre-defined registry artifact
- use(registry,locate(myArt),SID)
- Sensor management
- linkSensor(SensorType)SID
- unlinkSensor(SID)
16A TOY EXAMPLE A COFFEE MACHINE for AGENTS
17COFFE MACHINE IMPLEMENTATION
_at_ARTIFACT_MANUAL( states "idle","making",
start_state "idle" ) public class CoffeeMachine
extends Artifact _at_PROPERTY(states"idle,maki
ng") String selection double sugarLevel
int nCupDone boolean forceDrinkRelease
public CoffeeMachine() selection""
sugarLevel 0 nCupDone0
forceDrinkRelease false
_at_OPERATION(states"idle") void selectCoffee()
selection "coffee"
_at_OPERATION(states"idle") void selectTea()
selection "tea" _at_OPERATION(states"idle
") void make() if (selection.equals(""))
genEvent("no_drink_selected") else
log("making "selection)
forceDrinkRelease false
switchToState("making") genEvent("making_"
selection) nextStep("timeToReleaseDrink")
nextStep("forcedToReleaseDrink")
...
... _at_OPSTEP(tguard3000) void
timeToReleaseDrink() releaseDrink()
_at_OPSTEP(guard"makingStopped") void
forcedToReleaseDrink() releaseDrink()
private void releaseDrink() String drink
selection"("(nCupDone)","sugarLevel")"
genEvent(selection"_ready",drink)
sugarLevel 0 selection ""
switchToState("idle") _at_GUARD boolean
makingStopped() return forceDrinkRelease
_at_OPERATION(states"making") void
addSugar() sugarLevel0.1 if
(sugarLevelgt1) sugarLevel1
genEvent("new_sugar_level",sugarLevel)
_at_OPERATION(states"making") void stop()
forceDrinkRelease true
18COFFEE MACHINE USER(IN FLAT JAVA)
... SensorId sid linkDefaultSensor()
use(FACTORY,new Op("make","myCoffeeMachine",Coffee
Machine.class),sid) ArtifactId coffeMachineId
(ArtifactId)sense(sid,"make_succeeded").getConte
nt() use(coffeMachineId, new
Op("selectCoffee")) use(coffeMachineId, new
Op("make"),sid) sense(sid,"making_coffee"
) Perception p null do
use(coffeMachineId, new Op("addSugar"),sid)
p sense(sid,"new_sugar_level") while
((Double)(p.getContent())lt0.5) Perception
coffep sense(sid,"coffee_ready",2000)
log("coffee "coffep.getContent()) ...
19INTEGRATION WITH EXISTING MAS PROGRAMMING
PLATFORMS
- CARTAGO is orthogonal to the specific agent
platform(s) adopted - can support both reactive or cognitive
- promoting the idea of heterogeneous MAS working
in the same environment - Requirements on the agent platform side
- conceptually a notion of action and perception
- extended with actions for acting inside working
environments and perceptions caused by sensing - pragmatically Java as a common underlying
executing VM - not strictly necessary, but it helps
20JASON AGENT PROGRAMMING PLATFORMBORDINI, HüBNER
- Includes an interpreter written in Java for an
extended version of AgentSpeak - logic-based agent-oriented programming language
- BDI architecture
- suitable for the implementation of reactive
planning systems - Natively supports a general notion of
customizable environments - simulated environments as environments
programmable by users - specifying which actions are available to agents,
their effect, and the perceptions generated - a user can provide its own implementation of a
simulated environment - a Java class that extends the Jason Environment
class
21JASON CARTAGO FIRST EXPERIMENTS
- Defining, creating and exploiting CARTAGO
artifact-based working environments in Jason MAS - new basic set of actions available to Jason
agents - use(Aid,Op,Sid)
- ex use(myCoffeeMachine,makeCoffee(strong),mySenso
r) - sense(Sid,Filter,Timeout)
- ex sense(mySensor,coffee_readymachine_broken,2
000) - mapping sense results to beliefs
- artifact_event(EvDesc,Aid,Sid,EvTime)
- sensing_timeout(Sid)
- Straightforward implementation
- glue provided by a CartagoEnvironment class
extending Jason jason.environment.Environment
class
22Hello-world-like DEMOHELLO PHILOSOPHERS!
- Dijkstra well-known problem about cooperative
processes coordination - 5 philosophers thinking and eating rice at the
same table, sharing 5 chopsticks - coordination to share chopsticks avoid deadlock
- Rethinking the problem in AA
- set of philosophers as a MAS
- philosophers as cognitive agents
- the table as a coordination artifact
23MAS APPLICATION MAIN
MAS helloPhilosophers infrastructure
Centralised environment CartagoEnvironment agen
ts rosa philo.asl beppo philo.asl
pippo philo.asl maria philo.asl giulia
philo.asl alfredo waiter.asl
- Philosopher agents waiter agent in JASON
- encapsulating thinking and eating activities
- Table artifact in CARTAGO
- encapsulating the social rules to share
chopsticks and avoid deadlocks - instantiated by the waiter
24 THE TABLE ARTIFACT
Usage interface - getChops - releaseChops
Observable events generated - chops_acquired -
chops_released
import alice.cartago. public class Table
extends Artifact boolean chops public
Table(int nchops) chops new
booleannchops for (int i 0 iltchops.length
i) chopsitrue
_at_OPERATION(guard "chopsAvailable") void
getChops(int firstChop, int secondChop)
chopsfirstChop chopssecondChop false
genEvent("chops_acquired") _at_GUARD boolean
chopsAvailable(int firstChop,int secondChop)
return chopsfirstChop chopssecondChop
_at_OPERATION void releaseChops(int firstChop,
int secondChop) chopsfirstChop
chopssecondChop true genEvent("chops_rele
ased")
25WAITER AGENT
!live. !live true lt- .print("Hello world!")
.print("Preparing the table...")
use(factory,make(myTable,"Table",5),mySensor)
sense(mySensor,make_succeeded,2000). artif
act_event(make_succeeded,factory,mySensor,EventTim
e) true lt- .print("The table is ready.")
.print("Assigning the chopsticks...")
.send("rosa",tell,chopsticks_assigned(myTable,
0,1)) .send("beppo",tell,chopsticks_assigned(my
Table,1,2)) .send("pippo",tell,chopsticks_assig
ned(myTable,2,3)) .send("maria",tell,chopsticks
_assigned(myTable,3,4)) .send("giulia",tell,cho
psticks_assigned(myTable,4,0)) .print("Good
luck.").
- agent goal
- preparing the table
- assigning chopsticks to other philosopher agents
- direct interaction (communication) with agents
26PHILO AGENTin JASON
!live. !live true lt- .print("Hello world!
Waiting to know my chopsticks..."). chopsticks_a
ssigned(Table,C0,C1) true lt- .print("I
know my chopsticks, I can start my activity.")
my_chopsticks(Table,C0,C1) wants_to_live_for_a
nother_round. wants_to_live_for_another_roun
d true lt- !think. !think not(hungry) lt-
.print("Thinking.") -wants_to_live_for_another_r
ound hungry. hungry my_chopsticks(Table,C
1,C2) not(got_chopsticks(C1,C2))
not(chopsticks_requested(C1,C2)) lt-
.print("Got hungry, try to eat")
use(Table,getChops(C1,C2),mySensor) chopsticks
_requested(C1,C2) sense(mySensor,chops_acquired,8
000). artifact_event(chops_acquired,Table,mySe
nsor,EventTime) chopsticks_requested(C1,C2) lt-
.print("Got chopsticks, can eat.") -chopsticks_re
quested(C1,C2) got_chopsticks(C1,C2)
-hungry use(Table,releaseChops(C1,C2),mySensor)
sense(mySensor,chops_released). sensing_timeout(
mySensor) chopsticks_requested(C1,C2) lt-
.print("Starved, good bye world.") .myName(Me)
.killAgent(Me). artifact_event(chops_released,
Table,mySensor,_) got_chopsticks(C1,C2) lt-
.print("Chopsticks released.") -got_chopsticks(C1
,C2) wants_to_live_for_another_round.
- agent goal
- repeatedly eating and thinking
- agent interaction with the table
- using the table to get and release the
chopsticks - observing table events
27CONCLUDING REMARKONGOING WORKS
- Finalizing the implementation of next version
- Linkability, observable states, workspaces
- OWL-ART
- OWL-based semantics for describing artifact
manual - in collaboration with Daghan L.Acay (PhD,
University of Melbourne) - Enhancing the integration with JASON
- In collaboration with Rafael Bordini and Jomi
Hübner - AA Organizational Infrastructure
- artifact-based working environments for
engineering open MAS Organization - Integrating MOISE and CARTAGO
- In collaboration with Olivier Boissier (EMSE
St.Etienne), Jomi Hübner (FURB)