Jam agents in a Nutshell Version 65 76i 1



Download 391.89 Kb.
Page13/15
Date09.06.2017
Size391.89 Kb.
#20093
1   ...   7   8   9   10   11   12   13   14   15

EXAMPLE PLANS


A number of example and test plans are included in the JAM agent distribution. These are located in com/irs/jam/examples directory. Many of these plans are for regression tests – tests to make sure that changes to the agent architecture do not break or otherwise cause illegal or unusual agent behavior. We briefly describe each of these plans in this section. JAM programmers are encouraged to copy the example files and play with modifications to them to learn about JAM actions, semantics, constructs, and runtime behavior.

agent-go.jam


Demonstrates the JAM agent mobility functionality (actions and receiver class). Requires an instance of the AgentMobilityServer (in the com/irs/jam directory) to be running to receive the agent.

blocks-world.jam


This plan contains a solution to a simple implementation in the classic “blocks world” domain. The top-level plan establishes the goal of having Block1 on top of Block2 on top of Block3 on top of the table. The file specifies three different initial world models for the agent. The top set of facts specifies a starting situation that is identical to the goal state. The agent should recognize this and performs no actions. The second set of facts specifies Block1 on Block2 and Block2 and Block3 on the table. The agent needs to clear Block2 before performing any stacking. The third set of facts sets up the blocks so that they are initially inverted from the goal state (i.e., Block3 on Block2 on Block1).

basic.jam


This plan contains a procedural test of deeply nested plan constructs of all sorts.

checkpoint-agent.jam


Exercises the built-in checkpointing functionality of JAM. Both the version of checkpointAgent that returns the execution state of the agent as a JAM variable as well as the version that writes the agent state to a file is invoked.

memberaccess.jam


Demonstrates how to access Java class members without having to write any special interfacing code.

load.jam


Demonstrates use of the load action, where new agent specifications can be given to the agent while the agent is running.

retrieveall.jam


Demonstrates the retrieveall and nextfact actions by stepping through two different world model relations that have multiple world model entries with the same relation name.

variablescope.jam


Demonstrates how variables are scoped and how they can be passed between goals and subgoals.

unpost.jam


Demonstrates the post and unpost actions for adding and removing top-level goals to the agent.

threads3.jam


Shows the behavior of many JAM constructs, including parallel, do_all, do_any, atomic, and do…while.

javanew.jam


Exercises the "new" primitive function for creating Java objects from the JAM plan level without the need to write a special primitive function for each object type.

hanoi.jam


This agent specification file solves the Towers of Hanoi game. The number of disks can be changed by modifying the first goal argument in the file.

methodinvoke.jam


Tests JAM's capability to invoke Java-native class methods as expression functions. Also tests JAM's capability to detect null Java object pointers from the plan level.

introspec.jam


Tests a couple of special primitive functions that provide JAM’s plans insight into the status of aspects of goals and variables that wouldn’t otherwise be accessible. Specifically, it shows how to use the predicate pIsToplevelGoalp to test whether a plan/intention is running for a goal that is a toplevel goal and pIsVariableInitializedp to test whether a JAM variable has had a value assigned to it.

relations.jam


This file tests and demonstrates the many relational and computational functions implemented within JAM.

subgoals.jam


This file tests goal/plan argument passing and scoped variables. Behaviorally, “Plan 2” will fail the first time it is executed because the update changes the World Model entry and invalidates “Plan 2”'s context. The agent retries the top-level goal and this time “Plan 2” and “Plan 3” run successfully.

threads1.jam


This file tests simple subgoaling and demonstrates specification of both goal and plan utility, several constructs including parallel and atomic, and several actions and primitive functions.

debugging.jam


This file tests simple subgoaling, actions, and primitive functions.

trycatch.jam


This file demonstrates the programming paradigm of wrapping subgoaling with an or construct to achieve a form of TRY-CATCH. The first branch of the or “tries” to achieve the subgoal. If the subgoal fails, then the second branch “catches” the failure. A surrounding do-while construct retries the subgoal a number of times before giving up.

doallany1.jam


This file contains the same plans as ex6.jam except for the use of do_any rather than the or. This highlights the non-deterministic nature of the do_any and how the deterministic nature of or can be used to advantage.

observerfail.jam


This file demonstrates the behavior of the JAM interpreter to an attempt at subgoaling from within the Observer procedure. In short, the interpreter simply prints out a warning message and execution is otherwise not affected.

nativejava.jam


This file tests and demonstrates the invocation of dynamically discovered and loaded, externally-defined, class functions. The test Java class used in the test plan is included in the comments at the top of the file as well as included as a distinct file in the "examples" directory of the JAM distribution.


Download 391.89 Kb.

Share with your friends:
1   ...   7   8   9   10   11   12   13   14   15




The database is protected by copyright ©ininet.org 2024
send message

    Main page