an agent-oriented programming language targeting the microsoft clr [agentservice and apx]

46
An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX] l . i . d . o . DIST - University of Genova

Upload: abigail-zamora

Post on 31-Dec-2015

37 views

Category:

Documents


1 download

DESCRIPTION

An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]. l . i . d . o . DIST - University of Genova. Introduction. speaker: Mauro Coccoli. Outline. The Team Agent Platform Agent Oriented Language Portability Issues - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

An Agent-Oriented Programming Language Targeting the Microsoft CLR

[AgentService and APX]

l . i . d . o . DIST - University of Genova

Page 2: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

Introduction

speaker: Mauro Coccoli

Page 3: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 3

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Outline

The Team

Agent Platform

Agent Oriented Language

Portability Issues

http://www.lido.dist.unige.it/ags.asp

Page 4: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 4

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

The Team

Mauro CoccoliAlberto GrossoChristian VecchiolaDaniele MarinoAndrea GozziAcademic Support by

Prof. A. BoccalatteProf. M. Paolucci

Page 5: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 5

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Platform

Runtime Agents

Execution Environments

Class Library

Page 6: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 6

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Language

Object Oriented Paradigm

Agent Oriented Paradigm

Improved Programmability

Page 7: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 7

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Portability Issues

.NET

Mono

Rotor - SSCLI

Page 8: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

AgentServicePlatform

speaker: Alberto Grosso

Page 9: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 9

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Summary

Agents and MASs

AgentServicePlatform Architecture

Agent Model

Runtime Environment

Page 10: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 10

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

AgentAutonomous entity

IntelligenceReactivityPro-activenessMulti-behaviour

Agents and MASs[1]

Page 11: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 11

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Multi–agent system

Community where agents interact in order to meet their goals

Cooperation

Competition

Negotiation

Agents and MASs[2]

Page 12: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 12

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent system applicationsProblems dealing with distributed and concurrent systems

Electronic commerce and electronic marketsReal time monitoring and management of telecommunication networks Information handling in information environments like the Internet Improving the flow of transport trafficOptimization of industrial manufacturing and production processes

Agents and MASs[3]

Page 13: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 13

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

FIPAThe Foundation for Intelligent Physical Agents FIPA was formed in 1996 to produce software standards for heterogeneous and interacting agents and agent-based systems The aim is to provide standard strategies for agent communication, referring to industrial and commercial world

Agents and MASs[4]

Page 14: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 14

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

What does FIPA standardize?The platform architecture

Agent communication Message structure

Message exchange interaction protocols

Content language (ACL)

Agents and MASs[5]

Page 15: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 15

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Programming Frameworksagent model definitionplatform architecture definition

FIPA compliantagent implementation and schedulingcommunication systemservices (persistence, white and yellow pages, …)

integration with “non-agent” software and services

Agents and MASs[6]

Page 16: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 16

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

AgentService

FeaturesTechnology

Common Language Infrastructure

Platform FIPA abstract architecture compliance

Extremely modular and customizable structure

Page 17: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 17

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

AgentService - Architecture

AMS

DF

MTS

Runtime Environment for Agents

Platform ContextAgentService platform

AgentsAdditional Modules

Agent Management System- agents management- scheduling of agent activities- platform services supervision- white pages services

Directory Facilitator- agents localization- yellow pages services

Message Transport System- agent communication- message dispatching

FIPA Service Components (Agents)

Core Modules

Page 18: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 18

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

AgentService – Agent Model

Agent

Knowledge objects

Behaviour objects

Runtime stubs

KnowledgeShared data structureConcurrent accessDeadlock avoidancePersistence

BehaviourAgent activityConcurrent executionAccess to FIPA services

Runtime environmentExposes platform services

Messaging System, Persistence, Yellow and White Pages, Logging

[1]

Page 19: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 19

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

AgentService - Agent Model

Agent ImplementationTwo different models

Design Time: AgentTemplate

Run Time: Agent

An Agent is created upon an AgentTemplate

The AgentTemplate defines the “type” of the agentKnowledge Units

Behaviours

The Agent is the run-time container of the AgentTemplate and binds the template to the platform execution environment

[2]

Page 20: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 20

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

AgentService – Agent Model

1..* 1..*

AgentTemplate - behaviourList- knowledgeList + Initialize()+ Ending()+ Resume()+ OnIncomingConversation()

MyAgent - behaviourList- knowledgeList + Initialize()+ Ending()+ Resume()+ OnIncomingConversation()

Knowledge

- items

+ this[string]

MyKnowledge

- items properties

Behaviour

+ knowledgeList + conversationList

+ Body()

MyBehaviour

+ knowledgeList + conversationList

+ Body() + methods

[3]

Page 21: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 21

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

AgentService - Runtime

Agent SchedulingEach Agent is deployed in a dedicated Application Domain

Application Domain featuresintra-process structure

execution boundaries for data and type isolation

lightweight process

security profile

multi-threading

[1]

Page 22: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 22

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Creation of the Application Domain

AMS

DF

MTS

storage

messaging

persistence

logging

Upload of assemblies containing:- AgentTemplate type- Knowledge and Behaviour types

User request: create an agent of type X

All the assemblies necessary to create agent defined by the template X

are retrieved

AgentTemplate

Knowledge types and default instances

Behaviour types and default instances

Agent Instance

template

Runtime stub

Registration

AgentService - Runtime[2]

Page 23: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 23

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Service - Conclusions

AgentServiceAgent ModelModular ArchitectureAdvanced Scheduling System

Work in progressFIPA ACLA library of Agent, Knowledge, and Behaviour types ready to useAOSE methodologyInteraction protocol designer (AUML)

Page 24: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

Agent Programming eXtensions

speaker: Christian Vecchiola

Page 25: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 25

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Programming eXtensions

AO application development object-oriented frameworks

framework programming patterns

design to development gap:agent oriented perspective for design

object oriented perspective for code

Page 26: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 26

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Programming eXtensions

Is OO programming too bad?...obviously not:

powerful

general purpose

intuitive

but....enhancements to support agent oriented development

Page 27: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 27

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Programming eXtensions

APXfacilities to define and handle new elements related to agent programming

agent, behaviour and knowledge types

a compiler applies the programming patterns required by AgentService

checks the code

Page 28: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 28

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Programming eXtensions

Is it feasible?the idea

the new structural elements of APX simplify and speed up the code development

the APX compiler is able to automate many of the task required by AgentService

this is a practice already used in today compilersusing statement implementation

lock statement implementation

Page 29: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 29

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Programming eXtensions

Is it feasible?the language

only few syntactical and semantical elements have been added

such elements are integrated into an object oriented programming language (C#)

the learning curve is very smooth

Page 30: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 30

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Programming eXtensions

Is it feasible?the compiler

changes to the compiler are only related to the front-end (scanner, parser, semantic analyzer)

changes and add-on can be applied seamlessly to an already exixsting C# compiler

there are a lot of ready to use and modify C# compilersSSCLI (aka rotor) csc

Mono mcs

Portable .NET

Page 31: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 31

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Programming eXtensions

FeaturesAgentService object model

AgentTemplate class

Knowledge class

Behaviour class

APX typesagent template

knowledge template

behaviour template

Page 32: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 32

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Programming eXtensions

agent templateAgentTemplate class

Knowledge objects- K1 myKnow1- K2 myKnow2

Behavior objects- B1 myBehavior1- B2 myBheavior2

+ Initialize method+ Ending method+ Resume method+ OnIncomingConversation method

agent AgentName {

init { // definition and creation of knowledge // and behaviour that characterize the agent // agent setup and initialization // mostly C# code …

} .... done { // agent cleanup and resource release // mostly C# code …

}}

agent AgentName {

init { // definition and creation of knowledge // and behaviour that characterize the agent // agent setup and initialization // mostly C# code …

} .... done { // agent cleanup and resource release // mostly C# code …

}}

APX provides a more agent oriented interface and hides the underlying object oriented model of the platform.AgentService provides particular classes to

implement the previous agent model. It needs an opportune programming pattern to develop a “safe” agent.

Page 33: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 33

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Programming eXtensions

knowledge templateknowledge JobKnowledge {

int JobID; System.DateTime ArrivalTime; System.DateTime StartingTime; System.DateTime StoppingTime;

MachineType MachineRequestedType; // every CLR object // no pointers!!! // no APX templates!!}

knowledge JobKnowledge {

int JobID; System.DateTime ArrivalTime; System.DateTime StartingTime; System.DateTime StoppingTime;

MachineType MachineRequestedType; // every CLR object // no pointers!!! // no APX templates!!}

Page 34: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 34

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Programming eXtensions

acquire statementmyKnow1.JobID = 7;

acquire (myKnow1, ….) { // access here all the myKnow1 fields..

int jobID = myKnow1.JobID; ….. ….. myKnow1.ArrivalTime = arrivalTime; …..}

int j = myKnow1.JobID;

myKnow1.JobID = 7;

acquire (myKnow1, ….) { // access here all the myKnow1 fields..

int jobID = myKnow1.JobID; ….. ….. myKnow1.ArrivalTime = arrivalTime; …..}

int j = myKnow1.JobID;

compiler error: variable out of scope

compiler error: variable out of scope

myKnow1.JobID = 7;

// what happens is there is an invocation to a knowledge// property without acquiring a lock? // .... runtime exception

try { this.LockKnowledge(myKnow1, ….); // access here all the myKnow1 fields..

int jobID = myKnow1.JobID; ….. ….. myKnow1.ArrivalTime = arrivalTime; …..}finally { this.ReleaseKnowedge(true);}

int j = myKnow1.JobID;

myKnow1.JobID = 7;

// what happens is there is an invocation to a knowledge// property without acquiring a lock? // .... runtime exception

try { this.LockKnowledge(myKnow1, ….); // access here all the myKnow1 fields..

int jobID = myKnow1.JobID; ….. ….. myKnow1.ArrivalTime = arrivalTime; …..}finally { this.ReleaseKnowedge(true);}

int j = myKnow1.JobID;

Page 35: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 35

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Programming eXtensions

ImplementationAPX was developed by using the SSCLI as codebase

clone of the sscli/clr/src/csharp/csharp treemodified elements

scanner (introduction of the new tokens)parser (construction of new nodes in the syntactic tree)semantic analyzer (new checks added)

Page 36: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 36

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Programming eXtensions

APX compiler

Agent source program

Components developed with VC++ .NET, VB.NET,

Oberon, Eiffel.NET

Managed assembly

CompilerHost

lexer: minor changes, recognize new tokens

parser: major changes, synthesys of new constructs, additional information added to the nodes

semantic analyzer: no changes integration with the new info added to the nodes

APX semantic analyzer: performs additional checks to ensure that the code is AgentService compliat

intermediate code generator: no changes

emitter: no changes

APX node builder: parser support: creates node for the AgentService specific types, tags the nodes with additional info

Compilerfront end

back end

Page 37: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 37

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Programming eXtensions

DEMO

Page 38: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 38

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Agent Programming eXtensions

ConclusionsAPX are a set of programming extensions to the C# language to support agent programming

APX were designed to....speed up the coding phase

..deliver useful tool to end user

Page 39: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

Portability Issues

speaker: Daniele Marino

Page 40: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 40

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Why porting AgentService?

CLI:Virtual Execution

Enviroment

Nowadays:Strong internetworking

Portingof

Agent Service

Portability

Many OSes

Page 41: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 41

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Rotor & Mono: Overview

SDK

SDKCompiler, debugger ...CLI

CLIExecution Enviroment

PAL

PalSystem Interface

System

System.Xml

System Library.NET 1.0

[1]

Page 42: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 42

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Rotor & Mono: Overview[2]

C# Compilers and environmentRotor: csc, clix

Mono: mcs, mono

Framework Class Library

Tools for debug and analisys

Page 43: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 43

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Porting Issues

Non standard librariesSystem.Xml

Non standard behaviour

System specific pathPath separator symbol (”/” vs “\”)

Path termination character

Page 44: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 44

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Conclusions

Rotor:.NET 1.0 Framework Supported

Standard library implementations

Lack of GUI development tool

[1]

Page 45: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

04/19/23 45

l . i . d . o . – DIST – University of Genova

Academic Days 2004Academic Days 2004

AgentService

Conclusions

Mono:.NET 1.1 Framework Supported

Active developing

Work either on Linux or on OS X

[2]

Page 46: An Agent-Oriented Programming Language Targeting the Microsoft CLR [AgentService and APX]

Thank you for your attention

www.lido.dist.unige.it