Colored Trails and BDI (CTAPL)

Notice: Beta

Please note that this page is under construction. Also, CTAPL is currently in Beta development. For more information on CTAPL, please contact Bart Kamphorst or Arlette van Wissen.

Introduction

CTAPL is designed to bring well-defined BDI structures into the Colored Trails (CT) project. This is done by allowing BDI agents, written in the practical agent programming language 2APL, to communicate with a CT environment. The advantage of CTAPL is that agents can qualitatively reason in terms of beliefs, goals and plans.

Download

CTAPL can be downloaded from svn. Use

svn co https://viki.eecs.harvard.edu/repos/ct3/branches/ctapl [--username <username]

Publications

  • Bart Kamphorst, Arlette van Wissen, Virginia Dignum. Incorporating BDI agents into human-agent decision making research. The 10th Annual International Workshop "Engineering Societies in the Agents' World" (ESAW 2009).

Conceptual Design

CTAPL is a form of middleware. Through a 2APL external environment, communication between 2APL and Colored trails is proxied. No Colored Trails core code is altered, so in principle any CT configuration file may be loaded and any CT game can be played by 2APL BDI agents. CTAPL consists of four components:

  • a 2APL external environment
  • a MessageListener class
  • a hook in Colored Trails in the form of a generic Java CT agent (GenericAgentImpl)
  • 2APL communication code that 2APL agents have to use in order to communicate with the CT framework.

The relation between the different components is demonstrated in the flowchart below. In the upcoming section the components will be discussed in more detail.

Components

2APL external environment

The 2APL framework allows for external environments. External environments provide an interface to the Java programming language. By using the 2APL external environment Java API, it is possible to define external actions that 2APL agents can perform. An example:

public Term getOpponentPin(String agentname) throws ExternalActionFailedException {
  int pin = agents.get(agentname).getOpponentPin();

  APLNum aplid = new APLNum(pin);
  return aplid;
}

In the 2APL agent this external action can be invoked with the following syntax:

@ctenv( getOpponentPin(), L1);

Note

Please note that the 2APL platform always sends along the name of the agent performing the external environment. This is why the call to getOpponentPin() takes no arguments within the 2APL syntax, but the actual method takes String agentname as input. This argument is necessary for all external actions in the external environment and should always be the first argument (there can be more than one input argument though).

It is also possible for the external environment to generate events that are passed to the agents. This construct is used by the MessageListener class (see below for more information).

The external environment is to be found in

apapl/environments/ctenv/Env.java

It extends the apapl.Environment class.

MessageListener class

The MessageListener class can be found here:

apapl/environments/ctenv/MessageListener.java
GenericAgentImpl class

CTAPL uses a generic CT agent as a hook to communicate with the CT server. This class is located here:

agents/ctagents/generic/GenericAgentImpl.java

To add specific functionality to the agent, it is recommended to add new methods to GenericAgentImplExtension.java. This class extends GenericAgentImpl.java and it is this class that is actually instantiated by the external environment.

2APL communication code

The 2APL communication code holds all methods that 2APL agents need to communicate with the CT framework. The 2APL BDI code is located here:

agents/aplagents/genericBDI.2apl

You can include the general BDI code with the following import statement:

Include: genericBDI.2apl

Compiling CTAPL

To compile CTAPL, navigate to the root directory of CTAPL and run ant:

>$ cd /path/to/ctdir/ct3
>$ ant

This command will compile both the ct3 binary as the 2APL external environment. The ant build file can be found in the root directory of CTAPL and is called build.xml.

Running CTAPL

In order to run CTAPL, follow these instructions:

  1. Start the 2APL framework
    1. Select the non-Jade radiobutton
    2. Make sure that the IP address points to localhost and click on 'OK'
  2. Start the CT server
  3. Start any CT clients or other CT agents
  4. Open the .mas agent specification file within the 2APL platform (this will load the 2APL agents that will interact with the CT server)
  5. Load the CT configuration file (either manually or by using the controller)
  6. Hit the 'Play' button in the 2APL GUI to start the agents