Revenir à la page d'accueil
Plan du site   |   Plan d’accès   |   UTBM
  
Projets Européens
Réseaux d'Excellence
Projets Nationaux
Contrats Industriels
Projets thématiques
    ASPECS Methodology
       Introduction
       A quick overview of ASPECS
       System Requirements Analysis
       Agent Society Design
       Implementation
          Holon Architecture Definition
          Code Reuse
          Code Production of Organisations and Roles
          Organisations and Roles Unit Tests
          Code Production of Holons
          Holon Unit Tests
       Deployment
       References
       Comparisons with existing Agent-Oriented Methodologies
Conférences
Séminaires
Accueil > Activités et projets > Projets thématiques > ASPECS Methodology > Implementation > Code Production of Holons
Code Production of Holons

Code Production of Holons

Goal

This activity focuses on code production for holons. In the Janus platform, each holon is represented by a class. Janus offers two main kinds of holons: a threaded and a non-threaded one. The programmer has to choose the most appropriate one for the specific problem.


Input

The structure of the Holon code is identified in the output of the Holarchy Design activity. This activity also defines aspects related to holons and roles dynamics that will help in both choosing between a threaded and non-threaded implementation of each holon, and the associated scheduling policy.


Output

(Holon) Code.


Work to be done

Starting from the results of the Holarchy Design activity, the programmer chooses the most adapted version of JHolon (threaded and nonthreaded) and can code the holon implementation by using the associated Janus primitives. When a non-threaded implementation is chosen, holon scheduling aspects have to described too. The three methods that govern the life-cycle of each holon have also to be defined (textitactivate(), live(), end()); they are associated to the three main states of the holon’s life: activation, execution, and termination. As inspired by the Madkit synchronous engine11, Janus provides a full set of tools to manage non-threaded holons execution.


Example

Figure 31 depicts part of the code of the JPlayersSimulatorHolon Holon. This holon class inherits from the Janus LightHolon class that provides an abstract definition of non threaded holon. As regards the three basic methods used to govern the holon’s life-cycle, in this example, activitation corresponds to the definition of the capacities that the holon owns and the request of roles that have to be played by the current holon. Execution deals with scheduling of holon’s roles. And finally the previously acquired roles are released during the termination phase.

 

 

1 package janus.demos.robotsimulator.holon;
2 /* ... */
3 public class JPlayersSimulatorHolon extends LightHolon {
4 
5 private GroupAddress TeamGA;
6 
7 public void activate() {
8 //Capacity initialisation : adding the capacity required by the JPlayersSimulator role
9 addCapacity(PlayStrategyCapacity.class, new PlayStrategyService(this));
10 
11 TeamGA = getOrCreateGroup(TeamSimulationOrganization.getInstance());
12 println("About to request role "+TeamGA);
13 
14 if(requestRole(JPlayersSimulator.class,TeamGA)){
15 println("role JPlayersSimulator assigned");
16 }
17 }
18 
19 public void live() {
20 //Role scheduling
21 while(true) {
22 for (Role role : getRoles())
23 role.behavior();
24 }
25 }
26 
27 public void end() {
28 if(leaveRole(JPlayersSimulator.class,TeamGA)){
29 getLogger().info("role TeamSimulationOrganization:JPlayersSimulator disassigned");
30 } else {
31 getLogger().error("Pb during disassignation of TeamSimulationOrganization:JPlayersSimulator role");
32 }
33 }
34 }
Figure 31: Part of the code of the JPlayersSimulatorHolon Holon

 

 

  90010 Belfort cedex - Tél : +33 (0)3 84 58 33 19 - Fax : +33 (0)3 84 58 33 42 - Mentions légales