Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
T2. Organization and Environment oriented programming
1. Organisation and Environment
Oriented Programming
Outline of the course
Introduction
Olivier Boissier1 , Rafael H. Bordini2 , EOP
Jomi F. H¨bner3 , Alessandro Ricci4
u About Environment Oriented Programming
1 EMSE, 2 PUC-RS,
A&A and CArtAgO
France Brazil
Olivier.Boissier@emse.fr R.Bordini@pucrs.br OOP
3 DAS-UFSC, Brazil 4 University
of Bologna, Italy About Organisation Oriented Programming
jomi@das.ufsc.br a.ricci@unibo.it
Moise
Conclusions
European Agent Systems Summer School Practical Exercise: a hands-on lab session!
May, 2012 — Valencia, Spain
Introduction EOP OOP Conclusion
Abstractions in Multi-Agent Systems
schema
mission
role ORGAMISATION
org
LEVEL
Introduction agent
AGENT
LEVEL
artifact ENDOGENOUS
ENVIRONMENT
wsp
LEVEL
EXOGENOUS
ENVIRONMENT
4 / 165
network node
Introduction EOP OOP Conclusion Introduction EOP OOP Conclusion
Abstractions in Multi-Agent Systems Agent Oriented Programming
Individual Agent Level: autonomy, situatedness
Cognitive Concepts: beliefs, desires, goals, intentions, plans
Proposed by Shoham [Shoham, 1993]
Reasoning Cycle: sense/reason/act, reactive/pro-active Use of mentalistic notions and a societal view of
behaviour computation (anthropomorphism)
Environment Level: resources and services that agents can Levels of abstraction: Agents – Organisations – Environment
access and control; sensing and acting in an environment Programming languages for agents have developed a lot
Social and Organisation Level: cooperation, coordination, since then, but still not a mature paradigm
regulation patterns Programming languages/platforms for organisation and
Roles: rights, responsibilities, ... environment are also being developed
Organisational Rules: constraints on roles and their
interactions, norms, deadlines, ... Some agent development platforms have a formal basis
Organisational Structures: topology of interaction patterns Many influenced by the BDI agent architecture
and relations over activity control
5 / 165 6 / 165
2. Introduction EOP OOP Conclusion Introduction EOP OOP Conclusion
BDI Architecture Programming Languages for Cognitive Agents
Programming Languages for Multi-Agent Systems
E.g., Jason, Jadex, JACK, 2APL, GOAL, Brahms, JIAC, Agent
Intentional Stance (Dennett)
Factory, MetateM, Golog variants, ...
Practical Reasoning (Bratman)
IRMA (Bratman, Isreal, Pollack) Architecture to represent an agent mental state:
PRS (George↵, Lansky) Beliefs: information available to agent (e.g., about the
dMARS (Kinny) environment or other agents)
Goals: states of a↵airs that the agent wants to achieve
BDI Logics and Agent Architecture (Rao, George↵)
Events: changes in agents beliefs or goals
Wooldridge, Singh, ... Capabilities: reusable modules of activities that the agent
can perform
Plans: reasoning about courses of action to achieve goals
Rules: reasoning about beliefs
7 / 165 8 / 165
Introduction EOP OOP Conclusion Introduction EOP OOP Conclusion
Programming Languages for Cognitive Agents Programming Languages/Platforms for Organisations
Concepts used to specify the state of an organisation:
Some steps of a Reasoning Cycle: Agents, Roles, Groups
Determining Relevant Plans for Handling Events Norms, Obligations, Prohibitions, Permissions, Violations
Select a Plan for Execution Dependency, Power, Delegation, Information flow relations
Execute Part of an Intended Plans Deadlines, Sanctions, Rewards
Handle Plan Failures Management Infrastructure to control and coordinate
agent behaviour at run-time:
Agent Interpreter is an infinite loop of such reasoning cycles. Endogenous: The control is a part of the agent program
The architecture and reasoning cycle together with the agent Exogenous: The control is performed by an external system
program (specially plans) determine the behaviour of the agent. Monitoring Agent Behaviour
Enforcing Organisational Rules
Regimenting Organisational Rules
9 / 165 10 / 165
Introduction EOP OOP Conclusion Introduction EOP OOP Conclusion
Programming Languages/Platforms for Environments Hands-on Part of this Course
We will use JaCaMo
Artifacts to represent the state of the environment First fully operational, unified platform covering the 3 main
Access to Databases/Services/etc., Coordination, Interaction levels of abstractions for multi-agent oriented programming
Environment “objects”, i.e., non-proactive entities JaCaMo = Jason + CArtAgO + Moise
Processing Operations on Artifacts http://jacamo.sourceforge.net
Realising the e↵ects of environments actions http://jason.sourceforge.net
Providing events related to sensing the environment http://cartago.sourceforge.net
Synchronising agent actions http://moise.sourceforge.net
At the right level of abstraction for a multi-agent system More than the sum of 3 successful platforms
Revealing the full potential of Multi-Agent Oriented
Programming
11 / 165 12 / 165
3. Outline
Environment Oriented 2 Environment Programming
Why Environment Programming in MAS
Programming Basic Level
Advanced Level
— EOP — A&A and CArtAgO
Conclusions and Wrap-up
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Back to the Notion of Environment in MAS Single Agent Perspective
sensors
The notion of environment is intrinsically related to the db
ack
pe
fee PERCEPTION
rce
notion of agent and multi-agent system
pts
ENVIRONMENT
“An agent is a computer system that is situated in some DECISION
acti
do
environment and that is capable of autonomous action in ons
tion
to
ac ACTION
this environment in order to meet its design
objective” [Wooldridge, 2002] effectors / actuators
“An agent is anything that can be viewed as perceiving
its environment through sensors and acting upon the
environment through e↵ectors. Perception
” [Russell and Norvig, 2003] process inside agent inside of attaining awareness or
Including both physical and software environments understanding sensory information, creating percepts
perceived form of external stimuli or their absence
Actions
the means to a↵ect, change or inspect the environment
15 / 165 16 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Multi-Agent Perspective Why Environment Programming
Basic level
to create testbeds for real/external environments
to ease the interface/interaction with existing software
environments
Advanced level
to uniformly encapsulate and modularise functionalities of
the MAS out of the agents
typically related to interaction, coordination, organisation,
security
externalisation
this implies changing the perspective on the environment
environment as a first-class abstraction of the MAS
In evidence endogenous environments (vs. exogenous ones)
programmable environments
overlapping spheres of visibility and influence
..which means: interaction
17 / 165 18 / 165
4. Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Environment Programming: General Issues Basic Level Overview
MAS MAS ENVIRONMENT
actions
Defining the interface SIMULATED REAL WORLD
mimicking
actions, perceptions WORLD (PHYSICAL OR
COMPUTATIONAL)
data-model
OR
Defining the environment computational model &
architecture
how the environment works INTERFACE EXTERNAL
WORLD
structure, behaviour, topology (PHYSICAL OR
core aspects to face: concurrency, distribution COMPUTATIONAL)
OR
Defining the environment programming model
how to program the environment WRAPPER TO
EXISTING Example:
percepts JAVA
TECHNOLOGY
AGENTS PLATFORM
19 / 165 20 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Basic Level: Features An Example: Jason [Bordini et al., 2007]
Flexible Java-based Environment API
Environment conceptually conceived as a single monolitic Environment base class to be specialised
block executeAction method to specify action semantics
addPercept to generate percepts
providing actions, generating percepts
Environment API Environment User Agent
-globalPercepts: List<Literal> Environment Architecture
to define the set of actions and program actions -agPercepts: Map<String,List<Literal>>
+init(String[] args)
computational behaviour +stop()
getPercepts
which include the generation of percepts +getPercepts(String agName): List<Literal>
+executeAction(String agName, Structure action): boolean
typically implemented using as single object/class in OO such +addPercept(String agName, Literal p)
as Java +removePercept(String agName, Literal p)
...
method to execute actions executeAction
fields to store the environment state UserEnvironment
available in many agent programming languages/frameworks +init(String[] args)
change
+executeAction(String agName, Structure action): boolean
e.g., Jason, 2APL, GOAL, JADEX percepts
21 / 165 22 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
MARS Environment in Jason Jason Agents Playing on Mars
// mars robot 1
public class MarsEnv extends Environment { ...
private MarsModel model; ...
private MarsView view; /* creates the agents perception /* Initial beliefs */
* based on the MarsModel */ +!take(S,L) : true
public void init(String[] args) { void updatePercepts() { at(P) :- pos(P,X,Y) & pos(r1,X,Y). <- !ensure_pick(S);
model = new MarsModel(); !at(L);
view = new MarsView(model); clearPercepts(); /* Initial goal */ drop(S).
model.setView(view);
updatePercepts(); Location r1Loc = model.getAgPos(0); !check(slots). +!ensure_pick(S) : garbage(r1)
} Location r2Loc = model.getAgPos(1); <- pick(garb);
/* Plans */ !ensure_pick(S).
public boolean executeAction(String ag, Structure action) { Literal pos1 = Literal.parseLiteral +!ensure_pick(_).
String func = action.getFunctor(); ("pos(r1," + r1Loc.x + "," + r1Loc.y + ")"); +!check(slots) : not garbage(r1)
if (func.equals("next")) { Literal pos2 = Literal.parseLiteral
<- next(slot); +!at(L) : at(L).
model.nextSlot(); ("pos(r2," + r2Loc.x + "," + r2Loc.y + ")");
!!check(slots). +!at(L) <- ?pos(L,X,Y);
} else if (func.equals("move_towards")) {
int x = (int)((NumberTerm)action.getTerm(0)).solve(); addPercept(pos1);
+!check(slots). move_towards(X,Y);
int y = (int)((NumberTerm)action.getTerm(1)).solve(); addPercept(pos2); !at(L).
model.moveTowards(x,y); +garbage(r1) : not .desire(carry_to(r2))
} else if (func.equals("pick")) { if (model.hasGarbage(r1Loc)) { <- !carry_to(r2).
model.pickGarb(); addPercept(Literal.parseLiteral("garbage(r1)"));
} else if (func.equals("drop")) { } +!carry_to(R)
model.dropGarb(); <- // remember where to go back
} else if (func.equals("burn")) { if (model.hasGarbage(r2Loc)) { ?pos(r1,X,Y);
model.burnGarb(); addPercept(Literal.parseLiteral("garbage(r2)")); -+pos(last,X,Y);
} else { }
return false; } // carry garbage to r2
} !take(garb,R);
class MarsModel extends GridWorldModel { ... }
updatePercepts();
// goes back and continue to check
return true; class MarsView extends GridWorldView { ... }
!at(last);
} }
... !!check(slots).
...
23 / 165 24 / 165
5. Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Another Example: 2APL [Dastani, 2008] Example: Block-world Environment in 2APL
package blockworld;
2APL public class Env extends apapl.Environment {
BDI-based agent-oriented programming language integrating
declarative programming constructs (beliefs, goals) and
public void enter(String agent, Term x, Term y, Term c){...}
imperative style programming constructs (events, plans)
Java-based Environment API public Term sensePosition(String agent){...}
Environment base class public Term pickup(String agent){...}
implementing actions as methods
public void north(String agent){...}
inside action methods external events can be generated to be
perceived by agents as percepts ...
}
25 / 165 26 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
2APL Agents in the block-world Environment Interface Stardard – EIS Initiative
Recent initiative supported by main APL research
BeliefUpdates: ...
{ bomb(X,Y) } RemoveBomb(X,Y){ not bomb(X,Y) } groups [Behrens et al., 2010]
{ true } AddBomb(X,Y) { bomb(X,Y) } PC-rules:
{ carry(bomb) }
{ not carry(bomb) }
Drop( )
PickUp( )
{
{
not carry(bomb)}
carry(bomb) }
goto( X, Y ) <- true |
{
GOAL, 2APL, GOAL, JADEX, JASON
@blockworld( sensePosition(), POS );
Beliefs: B(POS = [A,B]); Goal of the initiative
start(0,1). if B(A > X) then
bomb(3,3).
clean( blockWorld ) :-
{ @blockworld( west(), L );
goto( X, Y )
design and develop a generic environment interface standard
not bomb(X,Y) , not carry(bomb). }
else if B(A < X) then
a standard to connect agents to environments
Plans:
B(start(X,Y)) ;
{ @blockworld( east(), L );
goto( X, Y )
... environments such as agent testbeds, commercial
@blockworld( enter( X, Y, blue ), L ) } applications, video games..
else if B(B > Y) then
Goals: { @blockworld( north(), L );
clean( blockWorld ) goto( X, Y ) Principles
}
PG-rules:
clean( blockWorld ) <- bomb( X, Y ) |
else if B(B < Y) then
{ @blockworld( south(), L );
wrapping already existing environments
{
goto( X, Y ); }
goto( X, Y ) creating new environments by connecting already existing
@blockworld( pickup( ), L1 );
PickUp( );
} apps
RemoveBomb( X, Y );
goto( 0, 0 );
...
creating new environments from scratch
@blockworld( drop( ), L2 );
}
Drop( ) Requirements
...
generic
reuse
27 / 165 28 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
EIS Meta-Model Environment Interface Features
Interface functions
attaching, detaching, and notifying observers (software design
pattern);
registering and unregistering agents;
adding and removing entities;
managing the agents-entities-relation;
performing actions and retrieving percepts;
managing the environment
By means of the Env. Interface agents perform actions and Interface Intermediate language
collect percepts to facilitate data-exchange
actually actions/percepts are issued to controllable entities in encoding percepts, actions, events
environment model
represent the agent bodies, with e↵ectors and sensors
29 / 165 30 / 165
6. Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Advanced Level Overview Three Support Levels [Weyns et al., 2007]
Vision: environment as a first-class abstraction in
MAS [Weyns et al., 2007, Ricci et al., 2010b]
application or endogenous environments, i.e. that
environment which is an explicit part of the MAS Basic interface support
providing an exploitable design & programming abstraction Abstraction support level
to build MAS applications
Interaction-mediation support level
Outcome
distinguishing clearly between the responsibilities of agent and
environment
separation of concerns
improving the engineering practice
31 / 165 32 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Basic Interface Support Abstraction Support
Bridges the conceptual gap between the agent abstraction
The environment enables agents to access the deployment and low-level details of the deployment context
context shields low-level details of the deployment context
i.e. the hardware and software and external resources with
which the MAS interacts
33 / 165 34 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Interaction-Mediation Support Environment Definition Revised
Regulate the access to shared resources
Mediate interaction between agents
Environment definition revised [Weyns et al., 2007]
The environment is a first-class abstraction that provides the
surrounding conditions for agents to exist and that mediates both
the interaction among agents and the access to resources
35 / 165 36 / 165
7. Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Research on Environments for MAS Environment Programming
Environment as first-class programming
Environments for Multi-Agent Systems research field / abstraction [Ricci et al., 2010b]
E4MAS workshop series [Weyns et al., 2005]
software designers and engineers perspective
di↵erent themes and issues (see JAAMAS Special
endogenous environments (vs. exogenous one)
Issue [Weyns and Parunak, 2007] for a good survey)
programming MAS =
mechanisms, architectures, infrastructures,
programming Agents + programming Environment
applications [Platon et al., 2007, Weyns and Holvoet, 2007,
Weyns and Holvoet, 2004, Viroli et al., 2007] ..but this will be extended to include OOP in next part
the main perspective is (agent-oriented) software engineering Environment as first-class runtime abstraction for agents
Focus of this tutorial: the role of the environment agent perspective
abstraction in MAS programming to be observed, used, adapted, constructed, ...
environment programming Defining computational and programming
frameworks/models also for the environment part
37 / 165 38 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Computational Frameworks for Environment Programming Models for the Environment: Desiderata
Programming: Issues
Abstraction
keeping the agent abstraction level e.g. no agents sharing and
Defining the environment interface
calling OO objects
actions, percepts, data model e↵ective programming models for controllable and observable
contract concept, as defined in software engineering contexts computational entities
(Design by Contract)
Modularity
Defining the environment computational model
away from the monolithic and centralised view
environment structure, behaviour
Orthogonality
Defining the environment distribution model
wrt agent models, architectures, platforms
topology support for heterogeneous systems
39 / 165 40 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Programming Models for the Environment: Desiderata Existing Computational Frameworks
AGRE / AGREEN / MASQ [Stratulat et al., 2009]
AGRE – integrating the AGR (Agent-Group-Role)
organisation model with a notion of environment
Environment used to represent both the physical and social
part of interaction
Dynamic extensibility
AGREEN / MASQ – extending AGRE towards a unified
dynamic construction, replacement, extension of environment representation for physical, social and institutional
parts environments
support for open systems Based on MadKit platform [Gutknecht and Ferber, 2000a]
Reusability GOLEM [Bromuri and Stathis, 2008]
reuse of environment parts for di↵erent kinds of applications Logic-based framework to represent environments for situated
cognitive agents
composite structure containing the interaction between
cognitive agents and objects
A&A and CArtAgO [Ricci et al., 2010b]
introducing a computational notion of artifact to design and
implement agent environments
41 / 165 42 / 165
8. Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Agents and Artifacts (A&A) Conceptual Model:
Background Human Metaphor
CLOCK
WHITEBOARD
BAKERY
artifact
artifact workspace
agents can join
dynamically the workspace
A&A and CArtAgO
ARCHIVE
artifact
COM. CHANNEL
artifact
RESOURCE
artifact
TASK SCHEDULER
artifact
44 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
A&A Basic Concepts [Omicini et al., 2008] A&A Programming Model Features [Ricci et al., 2007b]
Agents
Abstraction
autonomous, goal-oriented pro-active entities
create and co-use artifacts for supporting their activities artifacts as first-class resources and tools for agents
besides direct communication Modularisation
Artifacts artifacts as modules encapsulating functionalities, organized
non-autonomous, function-oriented, stateful entities in workspaces
controllable and observable Extensibility and openness
modelling the tools and resources used by agents artifacts can be created and destroyed at runtime by agents
designed by MAS programmers Reusability
Workspaces artifacts (types) as reusable entities, for setting up di↵erent
grouping agents & artifacts kinds of environments
defining the topology of the computational environment
45 / 165 46 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
A&A Meta-Model in More Detail [Ricci et al., 2010b] Artifact Abstract Representation
Manual consult
SIGNALS
has
ObsPropName(Args)
create OBSERVABLE
Workspace Artifact dispose ... PROPERTIES
link
USAGE
link
INTERFACE OperationX(Params)
Operation use Agent
Environment ...
generate OPERATIONS
update Observable perceive
Event OperationY(Params)
Observable
perceive ...
Property
observe LINK
join INTERFACE
quit
47 / 165 48 / 165
9. Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
A World of Artifacts A Simple Taxonomy
Individual or personal artifacts
designed to provide functionalities for a single agent use
state available
n_records 1001 e.g. an agenda for managing deadlines, a library...
count 5 table_names ...
wsdl ...
inc
state true ... ...
Social artifacts
reset switch GetLastTradePrice createTable
... addRecord
query
designed to provide functionalities for structuring and
a flag
a counter
a Stock Quote Web Service
... managing the interaction in a MAS
a data-base coordination artifacts [Omicini et al., 2004], organisation
artifacts, ...
n_items 0 next_todo check_plant
max_items 100 last_todo ... clearEvents out e.g. a blackboard, a game-board,...
postEvent in
put setTodo
get cancelTodo
registerForEvs rd
Boundary artifacts
a bounded buffer an agenda an event service a tuple space to represent external resources/services
e.g. a printer, a Web Service
to represent devices enabling I/O with users
e.g GUI, console, etc.
49 / 165 50 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Actions and Percepts in Artifact-Based Environments Interaction Model: Use
Explicit semantics defined by the (endogenous)
environment [Ricci et al., 2010c]
success/failure semantics, execution semantics
defining the contract (in the SE acceptation) provided by the PropName Value
PropName Value
environment ...
op(parms) ...
action
actions ! artifacts’ operation op(Params)
AGENT
the action repertoire is given by the dynamic set of operations
provided by the overall set of artifacts available in the workspace
can be changed by creating/disposing artifacts
action success/failure semantics is defined by operation
semantics Performing an action corresponds to triggering the execution
of an operation
percepts ! artifacts’ observable properties + signals acting on artifact’s usage interface
properties represent percepts about the state of the environment
signals represent percepts concerning events signalled by the
environment
51 / 165 52 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Interaction Model: Operation execution Interaction Model: Observation
SIGNALS
PropName Value OBS PROPERTIES
CHANGE
Value
...
op(parms) ...
PropName(Value).
action PropName(Value).
op(Params) ...
PropName Value
AGENT OPERATION EXECUTION
PropName Value
Belief base ...
action completion
(or alike) focus
- with success or failure -
AGENT
OBSERVER
a process structured in one or multiple transactional steps
asynchronous with respect to agent
...which can proceed possibly reacting to percepts and Agents can dynamically select which artifacts to observe
executing actions of other plans/activities
predefined focus/stopFocus actions
operation completion causes action completion
action completion events with success or failure, possibly with
action feedbacks
53 / 165 54 / 165
10. Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Interaction Model: Observation Artifact Linkability
PropName(Value).
PropName(Value).
...
PropName Value
PropName Value
Belief base ...
(or alike)
use linkedOp
AGENT
OBSERVER
WSP-X WSP-Y
By focussing an artifact Basic mechanism to enable inter-artifact interaction
observable properties are mapped into agent dynamic linking artifacts through interfaces (link interfaces)
knowledge about the state of the world, as percepts operations triggered by an artifact over an other artifact
e.g. belief base Useful to design & program distributed environments
signals are mapped as percepts related to observable events realised by set of artifacts linked together
possibly hosted in di↵erent workspaces
55 / 165 56 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Artifact Manual CArtAgO
Common ARtifact infrastructure for AGent Open
Agent-readable description of artifact’s...
environment (CArtAgO) [Ricci et al., 2009b]
...functionality
what functions/services artifacts of that type provide Computational framework / infrastructure to implement and
...operating instructions run artifact-based environment [Ricci et al., 2007c]
how to use artifacts of that type Java-based programming model for defining artifacts
set of basic API for agent platforms to work within
Towards advanced use of artifacts by intelligent
artifact-based environment
agents [Piunti et al., 2008]
dynamically choosing which artifacts to use to accomplish
Distributed and open MAS
their tasks and how to use them workspaces distributed on Internet nodes
strong link with Semantic Web research issues agents can join and work in multiple workspace at a time
Work in progress Role-Based Access Control (RBAC) security model
defining ontologies and languages for describing the manuals Open-source technology
available at http://cartago.sourceforge.net
57 / 165 58 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Integration with Agent Languages and Platforms JaCa Platform
Integration of CArtAgO with Jason language/platform
a JaCa program is a dynamic set of Jason agents working
Integration with existing agent platforms [Ricci et al., 2008]
together in one or multiple CArtAgO workspaces
by means of bridges creating an action/perception interface
and doing data binding
Mapping
actions
Outcome
Jason agent external actions are mapped onto artifacts’
developing open and heterogenous MAS operations
introducing a further perspective on interoperability besides percepts
the ACL’s one
artifacts’ observable properties are mapped onto agent beliefs
sharing and working in a common work environment artifacts’ signals are mapped as percepts related to
common object-oriented data-model observable events
data-model
Jason data-model is extended to manage also (Java) objects
59 / 165 60 / 165
11. Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Example 1: A Simple Counter Artifact Example 1: User and Observer Agents
class Counter extends Artifact { USER(S) OBSERVER(S)
void init(){
defineObsProp("count",0); count 5 !create_and_use. !observe.
}
+!create_and_use : true +!observe : true
@OPERATION void inc(){ <- !setupTool(Id); <- ?myTool(C); // discover the tool
// use focus(C).
ObsProperty p = getObsProperty("count"); inc inc;
p.updateValue(p.intValue() + 1); // second use specifying the Id +count(V)
signal("tick"); inc [artifact_id(Id)]. <- println(“observed new value: “,V).
}
} // create the tool +tick [artifact_name(Id,”c0”)]
+!setupTool(C): true <- println(“perceived a tick”).
<- makeArtifact("c0","Counter",C).
+?myTool(CounterId): true
<- lookupArtifact(“c0”,CounterId).
Some API spots -?myTool(CounterId): true
<- .wait(10);
Artifact base class ?myTool(CounterId).
@OPERATION annotation to mark artifact?s operations
set of primitives to work define/update/.. observable
properties
signal primitive to generate signals Working with the shared counter
61 / 165 62 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Pre-defined Artifacts Example 2: Coordination Artifacts – A Bounded Bu↵er
Each workspace contains by default a predefined set of public class BoundedBuffer extends Artifact {
private LinkedList<Item> items;
private int nmax;
artifacts void init(int nmax){
items = new LinkedList<Item>();
providing core and auxiliary functionalities defineObsProperty("n_items",0);
this.nmax = nmax;
i.e. a pre-defined repertoire of actions available to agents... }
n_items 5
@OPERATION void put(Item obj){
Among the others await("bufferNotFull");
items.add(obj);
getObsProperty("n_items").updateValue(items.size()); put
workspace, type: cartago.WorkspaceArtifact }
get
functionalities to manage the workspace, including security @OPERATION void get(OpFeedbackParam<Item> res) {
await("itemAvailable");
Item item = items.removeFirst();
operations: makeArtifact, lookupArtifact, focus,... res.set(item);
getObsProperty("n_items").updateValue(items.size());
node, type: cartago.NodeArtifact }
@GUARD boolean itemAvailable(){ return items.size() > 0; }
core functionalities related to a node
@GUARD boolean bufferNotFull(Item obj){ return items.size() < nmax; }
operations: createWorkspace, joinWorkspace, ... }
console, type cartago.tools.Console
operations: println,...
Basic operation features
blackboard, type cartago.tools.TupleSpace output parameters to represent action feedbacks
operations: out, in, rd, ... long-term operations, with a high-level support for
.... synchronization (await primitive, guards)
63 / 165 64 / 165
Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up Introduction EOP OOP Conclusion Introduction Basic Advanced CArtAgO Wrap-up
Example 2: Producers and Consumers Remarks
PRODUCERS CONSUMERS
item_to_produce(0). !consume.
!produce.
+!consume: true
+!produce: true <- ?bufferReady;
<- !setupTools(Buffer); !consumeItems. Process-based operation execution semantics
!produceItems.
+!consumeItems: true action/operation execution can be long-term
+!produceItems : true <- get(Item);
<- ?nextItemToProduce(Item); !consumeItem(Item); action/operation execution can overlap
put(Item); !!consumeItems.
!!produceItems. key feature for implementing coordination functionalities
+!consumeItem(Item) : true
+?nextItemToProduce(N) : true <- .my_name(Me); Operation with output parameters as action feedbacks
<- -item_to_produce(N); println(Me,": ",Item).
+item_to_produce(N+1).
+?bufferReady : true
+!setupTools(Buffer) : true <- lookupArtifact("myBuffer",_).
<- makeArtifact("myBuffer","BoundedBuffer", -?bufferReady : true
[10],Buffer). <-.wait(50);
?bufferReady.
-!setupTools(Buffer) : true
<- lookupArtifact("myBuffer",Buffer).
65 / 165 66 / 165