ISPSE 2000 November 1 2 2000 Role EP

  • Slides: 36
Download presentation
ISPSE 2000 (November 1 -2, 2000) Role. EP: Role Based Evolutionary Programming for Cooperative

ISPSE 2000 (November 1 -2, 2000) Role. EP: Role Based Evolutionary Programming for Cooperative Mobile Agent Applications Naoyasu UBAYASHI(Toshiba Corporation) Tetsuo TAMAI (University of Tokyo)

Agenda 1. Introduction 2. Problems of constructing cooperative mobile agent applications 3. Role. EP

Agenda 1. Introduction 2. Problems of constructing cooperative mobile agent applications 3. Role. EP model and Java Role. EP Framework 4. Related works 5. Conclusion

Introduction

Introduction

Background Recently, cooperative distributed applications based on mobile agent systems are increasing. Using mobile

Background Recently, cooperative distributed applications based on mobile agent systems are increasing. Using mobile agents, we can develop cooperative distributed applications that run over the Internet more easily and more flexibly than before. But, there are problems. . .

Problems • It is difficult to understand collaborations among agents and travels of individual

Problems • It is difficult to understand collaborations among agents and travels of individual agents as a whole because traveling/collaboration functions come to be intertwined in the code. • It is difficult to define behaviors of agents explicitly because they are influenced by the external context. Agents may change their functions dynamically. host traveling function intertwined! agent collaboration function

Goal of this research This research proposes the concept of Role. EP (Role Based

Goal of this research This research proposes the concept of Role. EP (Role Based Evolutionary Programming) in order to alleviate the problems mentioned here. Targets 1) Role. EP separates concerns on mobility/collaboration from agent systems. 2) Role. EP provides a systematic evolutionary programming style.

Problems of constructing cooperative mobile agent applications ~ Traditional approaches ~

Problems of constructing cooperative mobile agent applications ~ Traditional approaches ~

Traditional approaches 1. Orthodox approach 2. Design-pattern approach 3. AOP approach

Traditional approaches 1. Orthodox approach 2. Design-pattern approach 3. AOP approach

Example A distributed information retrieval system (a typical example of cooperative distributed applications based

Example A distributed information retrieval system (a typical example of cooperative distributed applications based on mobile agent systems)

Viewpoints for estimation Viewpoints Separation of concerns 1) roaming around hosts (mobility) 2) contract-net

Viewpoints for estimation Viewpoints Separation of concerns 1) roaming around hosts (mobility) 2) contract-net protocol (collaboration) Evolution User proxy agent --- (evolve) ---> Manager agent

Case 1: Orthodox approach A program description maps domain structures to program structures.

Case 1: Orthodox approach A program description maps domain structures to program structures.

Description of case 1 -- Described in Java public class User. Proxy { public

Description of case 1 -- Described in Java public class User. Proxy { public void roam(){ : dispatch(get. Next. Host. Address(), "contract. Net_start"); } Traveling function Code for roaming around hosts is mixed with code for executing the contractnet protocol. public void contract. Net_start(){ : // broadcasts a task-announcement message // to all agents existing in the host. } public void contract. Net_bid(){ Contract-net : function // if all biddings are finished, // selects the best contractor. : best-contractor. award(); } public void contract. Net_end(){ : dispatch(get. Next. Host. Address(), Traveling "contract. Net_start") function }}

Estimation of case 1 Merit none Problem It is difficult to understand a program

Estimation of case 1 Merit none Problem It is difficult to understand a program behavior as a whole since traveling/collaboration functions that compose a program are not described separately. Estimation Viewpoints Separation of concerns Evolution Estimation       × ×

Case 2: Design-pattern approach Approach Collaborations among agents are structured using design patterns focused

Case 2: Design-pattern approach Approach Collaborations among agents are structured using design patterns focused on mobile agents. Design patterns for Aglets (Aridor, Y. and Lange, D. B. ) 1) Traveling Patterns: Itinerary, Forwarding, Ticket, etc. 2) Task Patterns: Master-Slave, Plan, etc. 3) Collaboration Patterns: Meeting, Locker, Messenger, Facilitator, Organized Group, etc.

Description of case 2 -- Described in Aglets public class User. Proxy extends Aglets{

Description of case 2 -- Described in Aglets public class User. Proxy extends Aglets{ public void roam(){ // sets sequential planning itinerary = new Seq. Plan. Itinerary(this); itinerary. add. Plan(Host. Address 1, "contract. Net_start"); : itinerary. add. Plan(Host. Address. N, "contract. Net_start"); // starts the trip Traveling itinerary. start. Trip(); function } Itinerary Pattern Separated! (within an agent) public void contract. Net_start(){ // broadcasts a task-announcement message // to all agents existing in the host. : // waits until contract-net process is finished } public void contract. Net_bid(){ // if all biddings are finished, // selects the best contractor. : best-contractor. award(); } public void contract. Net_end(){ // saves results of the task execution. : Contract-net // notifies this agent. function }}

Estimation of case 2 Merit Code for roaming around hosts is separated from code

Estimation of case 2 Merit Code for roaming around hosts is separated from code for executing the contract-net protocol. Problem Separations of traveling/collaboration descriptions are limited only within an agent. As shown in the program, if a roaming agent wants to behave as a manager at the host machine the agent moves into, functions requested for a manager should be described as methods of the agent ! Estimation Viewpoints Separation of concerns Evolution Estimation      △ ×

Case 3: AOP approach (Aspect Oriented Programming) Approach AOP is a programming paradigm such

Case 3: AOP approach (Aspect Oriented Programming) Approach AOP is a programming paradigm such that a system is divided into a number of aspects and a program is described per aspect. A function that is dispersed among a group of objects is defined as an aspect. A compiler, called weaver, weaves aspects and objects together into a system. Kendall, E. A. proposed role model designs and implementations with Aspect. J that is an aspect-oriented extension to Java.

Description of case 3 public class User. Proxy{ public void roam(){ … }} public

Description of case 3 public class User. Proxy{ public void roam(){ … }} public class Info. Searcher{ public void execute. Task(){ … }} Traveling function static weaving aspect Manager extends Role{ // introduces empty behavior // to the class User. Proxy introduce public void User. Proxy. start(){} introduce public void User. Proxy. bid(){} introduce public void User. Proxy. end(){} weaver // advise weaves for aspect instances // that will be attached to an instance // of the class User. Proxy advise public void User. Proxy. start(){ before{. . . } } program advise public void User. Proxy. bid(){ before{. . . } } advise public void User. Proxy. end(){ before{. . . } } Contract-net } function -- Described in Aspect/J aspect Contractor extends Role{ // introduces empty behavior // to the class Info. Searcher introduce public void Info. Searcher. task. Announce(){} introduce public void Info. Searcher. award(){} // advise weaves for aspect instances // that will be attached to an instance // of the class Info. Searcher advise public void Info. Searcher. task. Announce(){ before{. . . } } advise public void Info. Searcher. award(){ before{ // calls a method of the class Info. Searcher execute. Task(); } } } Contract-net function

Estimation of case 3 Merit Code for roaming around hosts is separated from code

Estimation of case 3 Merit Code for roaming around hosts is separated from code for executing the contract-net protocol completely. Problem Each aspect must be defined per a role. A description that cross-cuts roles may be dispersed in several aspects. Dynamic evolution is not emphasized. Estimation Viewpoints Separation of concerns Evolution Estimation      △ △

Estimation of traditional approaches (summary) Approaches Orthodox approach Design-pattern approach AOP approach Viewpoints (Separation

Estimation of traditional approaches (summary) Approaches Orthodox approach Design-pattern approach AOP approach Viewpoints (Separation of concerns) × △ △ (Evolution) × × △

Role. EP model and Java Role. EP Framework

Role. EP model and Java Role. EP Framework

Role. EP Model Role. EP is composed of four model constructs -- agents, roles,

Role. EP Model Role. EP is composed of four model constructs -- agents, roles, objects and environments Traveling/Collaboration function separated Original Function Evolution (object ---> agent)

Model constructs (1) Environment A field where a group of mobile agents collaborate with

Model constructs (1) Environment A field where a group of mobile agents collaborate with each other. Role A function that an agent assumes in a field. Traveling/collaboration functions including tours around hosts and message communications among agents are described by role attributes and role methods.

Model constructs (2) Object, Agent An object(instance) becomes an agent by binding itself to

Model constructs (2) Object, Agent An object(instance) becomes an agent by binding itself to a role(instance) that is defined in an environment, and acquires functions needed for collaborating with other agents that exist in the same environment. Binding-operations are implemented by creating delegational relations between roles and objects dynamically.

Model constructs (Summary) environment : : = [environment attributes, environment methods, roles] role :

Model constructs (Summary) environment : : = [environment attributes, environment methods, roles] role : : = [role attributes, role methods, binding-interfaces] object : : = [attributes, methods] agent : : = [roles, object] agent. binding-interface => object. method

Construction of Cooperative Mobile Agent Applications in Role. EP Cooperative distributed applications based on

Construction of Cooperative Mobile Agent Applications in Role. EP Cooperative distributed applications based on mobile agent systems, which may change their functions dynamically in order to adapt themselves to their external context, can be constructed by synthesizing multiple environments dynamically. Evolutionary construction

Epsilon/J --Java Role. EP Framework Epsilon/J is a framework that supports Role. EP concepts

Epsilon/J --Java Role. EP Framework Epsilon/J is a framework that supports Role. EP concepts including environment and roles. This framework, which is presented as class libraries, is implemented on Aglets that is a mobile agent system based on Java.

Description in Epsilon/J object public class User. Proxy extends Epsilon. Obj{ public void life(){

Description in Epsilon/J object public class User. Proxy extends Epsilon. Obj{ public void life(){ bind. . . } } public class Info. Searcher extends Epsilon. Obj{ public void life() { bind … } } Environment & role public class Roaming extends Environment{ public class Visitor extends Role{ …} } public class Contract. Net extends Environment{ public class Manager extends Role{ public void start(){} public void bid(){} public void end(){} } public class Contractor extends Role{ public void award(){} } } Dynamic evolution!

Estimation of Role. EP Approaches Viewpoints (Separation of concerns) (Evolution) Role. EP ○ ○

Estimation of Role. EP Approaches Viewpoints (Separation of concerns) (Evolution) Role. EP ○ ○ Orthodox approach Design-pattern approach AOP approach × △ △ × × △

Merits of Role. EP 1) Construction mechanisms for traveling/collaboration components Environment classes can be

Merits of Role. EP 1) Construction mechanisms for traveling/collaboration components Environment classes can be regarded as traveling/collaboration components. 2) Evolution mechanisms for agents: An object can dynamically evolve to an agent that can behave multiple roles. Using Role. EP, programs that adapt to external context can be described easily. 3) Agentification mechanisms: In Role. EP, a role corresponds to a transducer that accepts messages from other agents and translates them into messages that an object can understand. Role. EP can be regarded as one of dynamic agentification mechanisms.

Related works

Related works

Related works Separation of Concerns Aspect Oriented Programming (Kiczales, G. , et al. )

Related works Separation of Concerns Aspect Oriented Programming (Kiczales, G. , et al. ) Subject Oriented Programming (Harrison, W. and Ossher, H. ) Role model (Van. Hilst, M. and Notkin, D. ) Mobile agents Mobile Ambients (Cardelli, L. and Gordon, A. D. ) This model gives a layered agent structure. In this model, agents run on fields constructed by synthesizing contexts (environments) dynamically.

Conclusion

Conclusion

Summary We proposed Role. EP, a new approach that constructs cooperative mobile agent applications.

Summary We proposed Role. EP, a new approach that constructs cooperative mobile agent applications. Role. EP separates concerns on mobility from agent systems. Role. EP provides a systematic evolutionary programming style.

Appendix

Appendix

AOP vs Role. EP viewpoint AOP Role. EP aspects components joint points aspects components

AOP vs Role. EP viewpoint AOP Role. EP aspects components joint points aspects components join points environments and roles objects roles weaving method weaver binding-operation aspect reuse dynamic aspect syntheses dynamic evolution dynamic method adding dynamic method modification emphasized not so emphasized emphasized --- (between aspects and components)