How To Implement Coordination Protocols Using The New GPGP2 Framework

How To Implement Coordination Protocols Using The New GPGP2 Framework

Overview

In brief, an implementation consists these components:
  • The protocol design in terms of a set of finite-state-machines (FSMs).

  • FSM scripts. One script for each FSM. The basic role of the scripts is to specify the states, conditions, and actions within the state, by defining several message types and event types. The Java code for message handlers and event handlers are left in the next component, the coordination module.

  • The coordination module, aka the "bean". This would be a Java class that extends the base FSMCoordination class. This module manage the FSMs and perform the coordination actions, i.e., it is the mastermind of the FSMs. Most part of this class consists of message handlers and event handlers. Often the module needs to communicate with the other modules in the same agents, for instance the ProblemSolver, the Scheduler, etc. The bulk of implementation of the protocol takes place here.
Of course, you also need agents (ProblemSolver) that utilize this protocol, which may be non-trivial as well.

The Steps

  1. Design the protocol as serveral FSMs on paper. The FSMs should be as detailed as possible. Keep in mind that the FSMs in different agent are interacting, so there might be some synchronization needed.

  2. Write a script for each FSM, which specifies the names of the states and the rules of state transitions.

    A rule generally consists of 4 parts:

    1. starting state,
    2. condition for the transition to take place. Such conditions may include:
      • a KQMLmessage is received (from FSMs in other agents)
      • a CoordinationEvent is received (from the coordination module)
      • a timeout is detected (within the FSM)
    3. actions to be performed when the condition is satisfied. Such actions may include:
      • send out a KQMLmessage (to FSMs in other agents)
      • send out a CoordinationEvent (to the coordination module)
    4. finishing state.

  3. Generate Java source code by using the FSMCC compiler to compile the scripts. The resulting source files will appear in your IHome/modules/agent/agent/coordinate directory. Each Java source file define a new Java class which extends the abstract FSM class. Brett's FSMCC guide tells you how to do that (and beyond).

  4. Then, create the coordination module, i.e., the class to handle the protocol itself. Implement the message handler and event handlers needed in the FSMs. Provide ways of interaction between this bean and other beans. This bean extends the FSMCoordination bean, which in turn extends AgentComponent.

  5. Then, you need to write some agents and task structures to see how they work together...