Integrating and Engineering Intelligent Systemsboissier/enseignement/defiia/... · Integrating and...

Post on 14-Oct-2020

0 views 0 download

Transcript of Integrating and Engineering Intelligent Systemsboissier/enseignement/defiia/... · Integrating and...

Integrating and EngineeringIntelligent Systems

– Agent’s Working Environment Programming –

O. Boissier

Univ. Lyon, IMT Mines Saint-Etienne, LaHC UMR CNRS 5516, France

UP AI Practices and Technologies DEFI IA – Winter 2020

UMR • CNRS • 5516 • SAINT-ETIENNE

JaCaMo meta-model

dynamic relation

composition

act

communicate

participate

Agent

Agent

GoalBelief

Action

Organisation

Group Scheme

Role Goal

Organisation

Norm

regulatecoun

t-as

empo

wer

perceive

Concept

Dimension

coordinate

Environment

Workspace

Operation

Environment

Artifact

Observableproperty

Interaction

*

*

*

*

Organisation

Group Scheme

Role Goal

Organisation

Norm

Organisation

Group Scheme

Role Goal

Organisation

Norm

***

**

*

*

*

Plan*

*

Manual

Observableevent

Event*

*

*

*

*

Organisation

Group Scheme

Role Goal

Organisation

Norm

Organisation

Group Scheme

Role

Goal

Organisation

Norm

***

**

Mission *

*

Link

Simplified view on JaCaMo meta-model [Boissier et al., 2011]

A seamless integration of three dimensions based on Jason [Bordini et al., 2007],

Cartago [Ricci et al., 2009a], Moise [Hübner et al., 2009] meta-models

2

Environment dimension

composition

Concept

Dimension

Environment

Workspace

Operation

Environment

Artifact

Observableproperty*

*

*

*

Environment

Workspace

Operation

Environment

Artifact

Observableproperty*

*

*

*

Environment

Workspace

Operation

Environment

Artifact

Observableproperty*

*

*

*

Manual

Observableevent

Simplified conceptual view (A&A meta-model [Omicini et al., 2008])

Simple artifactprogram:

3

Environment in JaCaMo: Agents andp Artifacts (A&A)

WHITEBOARDartifact

ARCHIVEartifact

COM. CHANNELartifact

TASK SCHEDULERartifact

RESOURCE artifact

CLOCKartifact

BAKERY

workspace

agents can joindynamically the workspace

4

A&A Basic Concepts [Omicini et al., 2008]

I AgentsI autonomous, goal-oriented pro-active entitiesI create and co-use artifacts for supporting their activities

I besides direct communication

I ArtifactsI non-autonomous, function-oriented, stateful entities

I controllable and observableI modelling the tools and resources used by agents

I designed by MAS programmers

I WorkspacesI grouping agents & artifactsI defining the topology of the computational environment

5

A&A Programming Model Features [Ricci et al., 2007b]

I AbstractionI artifacts as first-class resources and tools for agents

I ModularisationI artifacts as modules encapsulating functionalities, organized in

workspacesI Extensibility and openness

I artifacts can be created and destroyed at runtime by agentsI Reusability

I artifacts (types) as reusable entities, for setting up different kinds ofenvironments

6

A&A Meta-Model in More Detail [Ricci et al., 2010]

Artifact

Operation

Observable Event

generate

Agentuse

perceive

Workspace

Environment

ObservableProperty

update

perceive

observe

Manual

has

consult

link

create

dispose

link

join

quit

7

Outline

Environment Abstractions: Artifacts

Environment dynamics

Integrating A & E dimensions

Environment management infrastructure in JaCaMo

Conclusions and wrap-up

8

Artifact Abstract Representation

OperationX(Params)

...

ObsPropName(Args)

...

SIGNALS

USAGE

INTERFACE

OBSERVABLE

PROPERTIES

OperationY(Params)

...

LINK

INTERFACE

OPERATIONS

9

A World of Artifacts

put

n_items 0

max_items 100

get

a bounded buffer

inc

count 5

reset

a counter

switch

state true

a flag

setTodo

last_todo ...

cancelTodo

next_todo check_plant

an agenda

...

GetLastTradePrice

a Stock Quote Web Service

availablestate

...wsdl

postEvent

registerForEvs

clearEvents

an event service

query

createTable

addRecord

a data-base

...

1001n_records

table_names ...

... ...

in

rd

out

a tuple space

I Individual or personal artifacts: functionalities for a single agent use(e.g. agenda, library)

I Social artifacts: functionalities for structuring and managing theinteraction (e.g. a blackboard, a game-board)

I Boundary artifacts: access external resources/services (e.g. aprinter, a Web Service) or to represent devices enabling I/O withusers (e.g GUI, console)

10

Programming Artifacts – Some API spots

I Artifact base classI @OPERATION annotation to mark artifact’s operationsI set of primitives to define/update/... observable propertiesI primitive to generate signals: signal

class Counter extends Artifact { void init(){ defineObsProp("count",0); } @OPERATION void inc(){ ObsProperty p = getObsProperty("count"); p.updateValue(p.intValue() + 1); signal("tick"); }}

inc

count 5

11

Programming Artifacts – Basic operation features

I output parameters to represent action feedbacksI long-term operations, with a high-level support for synchronization

(await, @GUARD)

public class BoundedBuffer extends Artifact { private LinkedList<Item> items; private int nmax; void init(int nmax){ items = new LinkedList<Item>(); defineObsProperty("n_items",0); this.nmax = nmax; }

@OPERATION void put(Item obj){ await("bufferNotFull"); items.add(obj);

getObsProperty("n_items").updateValue(items.size()); }

@OPERATION void get(OpFeedbackParam<Item> res) { await("itemAvailable"); Item item = items.removeFirst();

res.set(item);getObsProperty("n_items").updateValue(items.size());

}

@GUARD boolean itemAvailable(){ return items.size() > 0; }

@GUARD boolean bufferNotFull(Item obj){ return items.size() < nmax; }}

put

n_items 5

get

12

Programming Artifacts – Internal operations

I execution of operations triggered by other operationsI implementing controllable processes

I Use of @INTERNAL_OPERATION to annotate the operationI Execution triggered by execInternalOp primitive

public class Clock extends Artifact {

boolean working; final static long TICK_TIME = 100;

void init(){ working = false; }

@OPERATION void start(){ if (!working){ working = true; execInternalOp("work"); } else { failed("already_working"); } }

@OPERATION void stop(){ working = false; }

@INTERNAL_OPERATION void work(){ while (working){ signal("tick"); await_time(TICK_TIME); } }}

!test_clock.

+!test_clock <- makeArtifac("myClock","Clock",[],Id); focus(Id); +n_ticks(0); start; println("clock started.").

@plan1+tick: n_ticks(10) <- stop; println("clock stopped.").

@plan2 [atomic]+tick: n_ticks(N) <- -+n_ticks(N+1); println("tick perceived!").

CLOCK CLOCK USER AGENT

13

Programming Artifacts – External control flow

Allowing interaction of an external control flow with artifacts withoutinterfering with the ones used by the environment runtime:I Use of ‘beginExternalSession‘ to make an explicit request of

starting an external sessionI Use of ‘endExternalSession(Boolean)‘ to close the session,

specifying whether it was successful or not, so as to release theexclusive access to the artifact.

After beginning the session, the external control flow can safely executemethods of the artifact, in a mutually exclusive way, without creatinginterferences.

14

Programming Artifacts – Artifact Linkability

WSP-X WSP-Y

linkedOp

I Basic mechanism to enable inter-artifact interactionI linking artifacts through interfaces (link interfaces)

I operations triggered by an artifact over an other artifactI Useful to design & program distributed environments

I realised by set of artifacts linked togetherI possibly hosted in different workspaces

15

Programming Artifacts – Artifact Linkability (Contd)

16

Programming Artifacts – Artifact Manual

I Agent-readable description of artifact’s...

I ...functionalityI what functions/services artifacts of that type provide

I ...operating instructionsI how to use artifacts of that type

I Towards advanced use of artifacts by intelligentagents [Piunti et al., 2008]

I dynamically choosing which artifacts to use to accomplish theirtasks and how to use them

I strong link with Semantic Web research issues

I Work in progress

I defining ontologies and languages for describing the manuals

17

Outline

Environment Abstractions: Artifacts

Environment dynamics

Integrating A & E dimensions

Environment management infrastructure in JaCaMo

Conclusions and wrap-up

18

Artifact dynamics

I Process-based operation execution semantics

I atomicity and transactionality: operations are executedtransactionally with respect to the observable state of the artifact

I concurrency: operations execution can overlap (use of the awaitprimitive to break the operation in multiple transactional steps)

I key feature for implementing coordination functionalities

I Observable property creation/change, when:

I the operation completes, successfullyI a signal is generatedI the operation is suspended (by means of an await)I If an operation fails, changes to the observable state of the artifact

are rolled back.

I Events creation

19

Environment Dynamics

Environment life-cycleI Creation/Deletion of Workspaces

Workspace life-cycle:I Creation/Deletion of ArtifactsI Creation/Deletion & Entry/Exit of Agents

Artifact life-cycle:I Atomic execution, Success/Failure, Activation/Deactivation of an

operationI Creation/Deletion/Update of Observable PropertiesI Linking/Unlinking with other artifacts

20

Outline

Environment Abstractions: Artifacts

Environment dynamics

Integrating A & E dimensions

Environment management infrastructure in JaCaMo

Conclusions and wrap-up

21

Integrating A & E dimensions

dynamic relation

composition

Agent

Agent

GoalBelief

Action

Concept Dimension

Environment

Workspace

Operation

Environment

Artifact

Observableproperty

Interaction

act

communicate

perceive

Environment

Workspace

Operation

Environment

Artifact

Observableproperty*

*

*

*

Agent

Agent

GoalBelief

Action

*

*

*

Plan*

*

Environment

Workspace

Operation

Environment

Artifact

Observableproperty*

*

*

*

Manual

Observableevent

Agent

Agent

GoalBelief

Action

*

*

*

Plan*

*

Event*

*

*

*

*

Mapping of:I Artifacts’ operations onto agent actionsI Artifacts’ observable properties onto agent beliefsI Artifacts’ signals onto belief-update events related to observable eventsI Jason data-model is extended to manage also (Java) objects

Dynamic actions repertoire:I given by the dynamic set of operations provided by the overall set of

artifacts available in the workspaceI can be changed by creating/disposing artifacts

22

Predefined actions repertoire

Accessible to agents through a predefined set of artifacts contained bydefault in each workspace:I Functionalities to manage the workspace (including security):

I operations: makeArtifact, lookupArtifact, focus,...I accessible through workspace, type: cartago.WorkspaceArtifact

I Core functionalities related to a node:I operations: createWorkspace, joinWorkspace, ...I accessible through node, type: cartago.NodeArtifact

I Others:I operations: println,... accessible through console, type

cartago.tools.ConsoleI operations: out, in, rd, ... accessible through blackboard, type

cartago.tools.TupleSpace

; pre-defined beliefs repertoire also

23

Interaction model – Action execution

I Action success/failure semantics is defined by operation semanticsI Executing an action suspends the intention until completion or

failure of the corresponding operationI Action completion events generated by the environment and

automatically processed by the agent/environment platform bridgeI No need of explicit observation and reasoning by agents to know if

an action succeededI The agent execution cycle is not blocked!

I The agent can continue to process percepts and possibly executeactions of other intentions

24

Interaction Model: Use

op(Params)

ValuePropName

ValuePropName...

...

AGENT

op(parms)action

I Performing an action corresponds to triggering the execution of anoperationI acting on artifact’s usage interface

25

Interaction Model: Operation execution

OPERATION EXECUTIONop(Params)

ValuePropNameValue...

...

SIGNALS OBS PROPERTIESCHANGE

AGENT

op(parms)action

action completion- with success or failure -

I A process structured in one or multiple transactional stepsI Asynchronous with respect to agent

I ...which can proceed possibly reacting to percepts and executingactions of other plans/activities

I Operation completion causes action completionI Action completion events with success or failure, possibly with

action feedbacks

26

Interaction Model: Observation

AGENTOBSERVER

Belief Base(or alike)

propName1(Value).propName2(Value).... ValuepropName1

ValuepropName2...

use

I Agents can dynamically select which artifacts to observeI focus/stopFocus actions

I By focussing an artifactI observable properties are mapped into agent dynamic knowledge

about the state of the world, as perceptsI e.g. belief base

I signals are mapped as percepts related to observable events

27

Example 1

class Counter extends Artifact { void init(){ defineObsProp("count",0); } @OPERATION void inc(){ ObsProperty p = getObsProperty("count"); p.updateValue(p.intValue() + 1); signal("tick"); }}

inc

count 5

User and Observer Agents Working with the shared counter

28

Example 1

!create_and_use.

+!create_and_use : true <- !setupTool(Id); // use inc; // second use specifying the Id inc [artifact_id(Id)].

// create the tool+!setupTool(C): true <- makeArtifact("c0","Counter",C).

!observe.

+!observe : true <- ?myTool(C); // discover the tool focus(C).

+count(V) <- println(“observed new value: “,V).

+tick [artifact_name(Id,”c0”)] <- println(“perceived a tick”).

+?myTool(CounterId): true <- lookupArtifact(“c0”,CounterId).

-?myTool(CounterId): true <- .wait(10); ?myTool(CounterId).

OBSERVER(S)USER(S)

User and Observer Agents Working with the shared counter

28

Example 2

public class BoundedBuffer extends Artifact { private LinkedList<Item> items; private int nmax; void init(int nmax){ items = new LinkedList<Item>(); defineObsProperty("n_items",0); this.nmax = nmax; }

@OPERATION void put(Item obj){ await("bufferNotFull"); items.add(obj);

getObsProperty("n_items").updateValue(items.size()); }

@OPERATION void get(OpFeedbackParam<Item> res) { await("itemAvailable"); Item item = items.removeFirst();

res.set(item);getObsProperty("n_items").updateValue(items.size());

}

@GUARD boolean itemAvailable(){ return items.size() > 0; }

@GUARD boolean bufferNotFull(Item obj){ return items.size() < nmax; }}

put

n_items 5

get

Producers and Consumers with Bounded buffer

29

Example 2

item_to_produce(0).!produce.

+!produce: true <- !setupTools(Buffer); !produceItems.

+!produceItems : true <- ?nextItemToProduce(Item); put(Item); !!produceItems.

+?nextItemToProduce(N) : true <- -item_to_produce(N); +item_to_produce(N+1).

+!setupTools(Buffer) : true <- makeArtifact("myBuffer","BoundedBuffer", [10],Buffer).

-!setupTools(Buffer) : true <- lookupArtifact("myBuffer",Buffer).

!consume.

+!consume: true <- ?bufferReady; !consumeItems. +!consumeItems: true <- get(Item); !consumeItem(Item); !!consumeItems.

+!consumeItem(Item) : true <- .my_name(Me); println(Me,": ",Item). +?bufferReady : true <- lookupArtifact("myBuffer",_). -?bufferReady : true <-.wait(50); ?bufferReady.

PRODUCERS CONSUMERS

Producers and Consumers with Bounded buffer29

Example 3Artifacts for User I/O – GUI Artifacts

setValue

value 16.0

user

ok

closed

agent

I Exploiting artifacts to enable interaction between human users andagents

30

Example 3Artifacts for User I/O – GUI Artifacts

public class MySimpleGUI extends GUIArtifact { private MyFrame frame; public void setup() { frame = new MyFrame(); linkActionEventToOp(frame.okButton,"ok"); linkKeyStrokeToOp(frame.text,"ENTER","updateText"); linkWindowClosingEventToOp(frame, "closed"); defineObsProperty("value",getValue()); frame.setVisible(true); }

@INTERNAL_OPERATION void ok(ActionEvent ev){ signal("ok"); }

@OPERATION void setValue(double value){ frame.setText(""+value); updateObsProperty("value",value); } ... @INTERNAL_OPERATION void updateText(ActionEvent ev){ updateObsProperty("value",getValue()); }

private int getValue(){ return Integer.parseInt(frame.getText()); }

class MyFrame extends JFrame {...}}

!test_gui.

+!test_gui <- makeArtifact("gui","MySimpleGUI",Id); focus(Id).

+value(V) <- println("Value updated: ",V). +ok : value(V) <- setValue(V+1).

+closed <- .my_name(Me); .kill_agent(Me).

GUI ARTIFACT USER ASSISTANT AGENT

31

Outline

Environment Abstractions: Artifacts

Environment dynamics

Integrating A & E dimensions

Environment management infrastructure in JaCaMo

Conclusions and wrap-up

32

CArtAgO in JaCaMo

I Common ARtifact infrastructure for AGent Open environment(CArtAgO) [Ricci et al., 2009b]

I Computational framework / infrastructure to implement and runartifact-based environment [Ricci et al., 2007c]

I Java-based programming model for defining artifactsI set of basic API for agent platforms to work within artifact-based

environment

I Distributed and open MAS

I workspaces distributed on Internet nodesI agents can join and work in multiple workspace at a time

I Role-Based Access Control (RBAC) security model

I Open-source technology

I available at http://cartago.sourceforge.net

33

Other Features

I Other CArtAgO features not discussed in this lectureI linkability

I executing chains of operations across multiple artifactsI multiple workspaces

I agents can join and work in multiple workspaces, concurrentlyI including remote workspaces

I RBAC security modelI workspace artifact provides operations to set/change the access

control policies of the workspace, depending on the agent roleI ruling agents’ access and use of artifacts of the workspace

I ...

I See CArtAgO papers and manuals for more information

34

Outline

Environment Abstractions: Artifacts

Environment dynamics

Integrating A & E dimensions

Environment management infrastructure in JaCaMo

Conclusions and wrap-up

35

Wrap-up

I Environment programmingI environment as a programmable part of the MASI encapsulating and modularising functionalities useful for agents’

workI Artifact-based environments

I artifacts as first-class abstraction to design and program complexsoftware environmentsI usage interface, observable properties / events, linkability

I artifacts as first-order entities for agentsI interaction based on use and observationI agents dynamically co-constructing, evolving, adapting their world

I CArtAgO computational frameworkI programming and executing artifact-based environmentsI integration with heterogeneous agent platforms

36

Some Research Explorations

I Cognitive stigmergy based on artifactenvironments [Ricci et al., 2007a]I cognitive artifacts for knowledge representation and

coordination [Piunti and Ricci, 2009]

I Artifact-based environments for argumentation [Oliva et al., 2010]I Including A&A in AOSE methodology [Molesini et al., 2005]I Defining a Semantic (OWL-based) description of artifact

environments ( CArtAgO-DL)I JaSa project = JASDL + CArtAgO-DL

I ...

37

Bibliography I

Boissier, O., Bordini, R. H., Hübner, J. F., Ricci, A., and Santi, A. (2011).Multi-agent oriented programming with jacamo.Science of Computer Programming, pages –.

Bordini, R. H., Hübner, J. F., and Wooldrige, M. (2007).Programming Multi-Agent Systems in AgentSpeak using Jason.Wiley Series in Agent Technology. John Wiley & Sons.

Hübner, J. F., Boissier, O., Kitio, R., and Ricci, A. (2009).Instrumenting Multi-Agent Organisations with Organisational Artifacts andAgents.Journal of Autonomous Agents and Multi-Agent Systems.

Molesini, A., Omicini, A., Denti, E., and Ricci, A. (2005).SODA: A roadmap to artefacts.In Dikenelli, O., Gleizes, M.-P., and Ricci, A., editors, 6th InternationalWorkshop “Engineering Societies in the Agents World” (ESAW’05), pages239–252, Kuşadası, Aydın, Turkey. Ege University.

38

Bibliography II

Oliva, E., McBurney, P., Omicini, A., and Viroli, M. (2010).Argumentation and artifacts for negotiation support.International Journal of Artificial Intelligence, 4(S10):90–117.Special Issue on Negotiation and Argumentation in Artificial Intelligence.

Omicini, A., Ricci, A., and Viroli, M. (2008).Artifacts in the A&A meta-model for multi-agent systems.Autonomous Agents and Multi-Agent Systems, 17(3):432–456.

Piunti, M. and Ricci, A. (2009).Cognitive artifacts for intelligent agents in mas: Exploiting relevant informationresiding in environments.In Knowledge Representation for Agents and Multi-Agent Systems (KRAMAS2008), volume 5605 of LNAI. Springer.

Piunti, M., Ricci, A., Braubach, L., and Pokahr, A. (2008).Goal-directed interactions in artifact-based mas: Jadex agents playing inCARTAGO environments.In Proc. of the 2008 IEEE/WIC/ACM Int. Conf. on Web Intelligence andIntelligent Agent Technology (IAT’08), volume 2. IEEE Computer Society.

39

Bibliography IIIRicci, A., Omicini, A., Viroli, M., Gardelli, L., and Oliva, E. (2007a).Cognitive stigmergy: Towards a framework based on agents and artifacts.In Weyns, D., Parunak, H. V. D., and Michel, F., editors, Environments forMultiAgent Systems III, volume 4389 of LNAI, pages 124–140. Springer.

Ricci, A., Piunti, M., and Viroli, M. (2010).Environment programming in multi-agent systems – an artifact-basedperspective.Autonomous Agents and Multi-Agent Systems.Published Online with ISSN 1573-7454 (will appear with ISSN 1387-2532).

Ricci, A., Piunti, M., Viroli, M., and Omicini, A. (2009a).Environment programming in CArtAgO.In Multi-Agent Programming: Languages,Platforms and Applications,Vol.2.Springer.

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

40

Bibliography IV

Ricci, A., Viroli, M., and Omicini, A. (2007b).

The A&A programming model & technology for developing agent environmentsin MAS.

In Dastani, M., El Fallah Seghrouchni, A., Ricci, A., and Winikoff, M., editors,Programming Multi-Agent Systems, volume 4908 of LNAI, pages 91–109.Springer Berlin / Heidelberg.

Ricci, A., Viroli, M., and Omicini, A. (2007c).

CArtAgO: A framework for prototyping artifact-based environments in MAS.

In Weyns, D., Parunak, H. V. D., and Michel, F., editors, Environments forMultiAgent Systems III, volume 4389 of LNAI, pages 67–86. Springer.

3rd International Workshop (E4MAS 2006), Hakodate, Japan, 8 May 2006.Selected Revised and Invited Papers.

41