Depending on the application, it may be useful to have agents
that are reactive or proactive, but not both. Here are the descriptions
of such alternatives for IndiGolog OAA agents.
Creating OAA-like reactive or proactive agents in IndiGolog does
not differ much from creating OAA agents in Prolog. Since current
IndiGolog interpreter is written in Prolog, most of the interfacing
code for an IndiGolog agent is exactly the same as for a pure Prolog
agent. The only difference is that the callbacks not only can be
Prolog predicates, but also IndiGolog procedures:
oaa_AppDoEvent(<name of user-defined solvable>, _GoalParams)
:-
indigolog(<name of IndiGolog procedure to handle the request>).
Reactive Agents

To create a simple reactive IndiGolog agent the programmer needs
to declare procedure solvables, specify which IndiGolog procedures
will be the corresponding callbacks and enter the OAA event loop
by executing oaa_MainLoop(true) . The callback procedures
will be called whenever some OAA agents require services of this
particular IndiGolog agent. All the other OAA events (e.g. updates
to data solvables) are handled by the OAA library, and the developer
does not need to worry about them.
All the functionality of OAA is accessible from within the primitive
actions. IndiGolog agent can in turn call oaa_Solve
to request services of other agents.
This way the OAA Prolog library will have full control over the
execution of the program. The agent becomes a purely reactive one.
Proactive
Agents

At another end of the spectrum, one can create a purely proactive
IndiGolog OAA agent. This is again quite the same as creating a
proactive OAA agent in Prolog. Here, instead of entering OAA event
loop by executing oaa_MainLoop(true) , one can just
connect to the OAA facilitator and start executing an IndiGolog
procedure:
oaa_Ready(true),
indigolog(<name of IndiGolog procedure>).
This way the IndiGolog part of the system has full control over
the execution of the program. We must note that if the controller
has declared some procedure solvables, their callbacks will never
be called since the OAA library does not have control over the execution
of the program and cannot monitor for incoming messages from other
OAA agents in the system. OAA library can only deliver answers to
the queries asked within IndiGolog procedures through calls to oaa_Solve .
|