main menu:
  » home
  » introduction
  » indigolog overview
  » oaa overview
  » interface model
  » developing agents
  » simple example
  » advanced example
  » other interface models
  » implementation details
  » tips
  » links

 

   

General agent pattern

 

IndiGolog OAA agent may be viewed as an agent that executes its IndiGolog control routine and additionally has access to other OAA agents in the system and is capable of reacting to the incoming OAA messages.

This is the general pattern of changing the state of the agent in response to incoming OAA events. The reactions to these events can usually be programmed using interrupts. The main IndiGolog program may then look like this:

proc(control,
[
   <probably, some initialization>
   prioritized_interrupts
       ([
         interrupt(<check the value of the fluent that changes
                    when some very important OAA event arrives>,
                   <do something to respond>),
         interrupt(<check the value of the fluent that changes
                    when some less important OAA event arrives>,
                   <do something to respond>),
         interrupt(true, <do something - normal execution>)
       ])
]).


The first two interrupts are then the reactive part of the program, while the third one is the proactive part.

If we follow the above process, then writing an IndiGolog agent that is both proactive and reactive involves:

  1. Declaring the needed procedure solvables using

    initial_solvables(<solvables list>)

  2. Declaring the corresponding exogenous actions. The declared exogenous actions should be the exact copies of the procedure solvables. For example, if we declare the solvable:

    solvable(update_status(New_Status), [], [])

    then we will need to have the following exogenous action:

    exog_action(update_status(New_Status)).

  3. Declaring the fluents, whose values are going to change when certain OAA events arrive. For example:

    prim_fluent(status).

  4. Writing the successor-state axioms that relate the incoming events and the corresponding fluents. For example:

    causes_val(update_status(New_Status),status,New_Status,true).

  5. Writing the main procedure using interrupts as described above. Name the procedure 'control'.

  6. Specifying the name of the agent using

    agent_name(<name>)


Multifile Declaration


In order to build an executable agent program, one needs to compile the Prolog source file and then link it with IndiGolog interpreter, IndiGolog-OAA interface and OAA libraries.

For this process to succeed, the agent source file has to start with the following multifile declaration:

:- multifile prim_action/1, prim_fluent/1, causes_val/4, poss/2, proc/2, exog_action/1.

It should be the first (uncommented) line of the file. Declaring a predicate multifile means that its clauses can be spread across several different files. This is exactly the case here.

Files Needed for Compilation

Note: The following applies to Quintus Prolog for Unix. These scripts are unlikely to run under MS Windows.

These are the files needed to successfully compile an IndiGolog OAA agent:

  1. <name of your program>.pl — The source code for the agent.

  2. interface.pl — The IndiGolog-OAA interface file (rename to ".pl").

  3. interpreter_m.pl — The IndiGolog interpreter (rename to ".pl").

  4. oaa.pl — The OAA Prolog library.

  5. com_tcp.pl — The OAA communication library.
Each of the files needs to be compiled using the following command line:

qpc -c <name of the file>.pl

This will generate the file in the Quintus Object Format with the same name and with extension 'qof'.

Creating Java agents

For help on creating OAA agents in Java see the OAA documentation. You can also take a look at one of the examples provided here.

 


 
© 2001 All Rights Reserved. See Legal Notice.