Publisher Information
Agent Oriented Software Pty. Ltd. | |
P.O. Box 639, | |
Carlton South, Victoria, 3053 | |
AUSTRALIA | |
Phone: | +61 3 9349 5055 |
Fax: | +61 3 9349 5088 |
Web: | http://www.agent-software.com |
If you find any errors in this document or would like to suggest improvements, please let us know.
The JACK documentation set includes the following manuals and practicals:
Document | Description |
Agent Manual | Describes the JACK programming language and infrastructure. JACK can be used to develop applications involving BDI agents. |
Teams Manual | Describes the JACK Teams programming language extensions. JACK Teams can be used to develop applications that involve coordinated activity among teams of agents. |
Development Environment Manual | Describes how to use the JACK Development Environment (JDE). The JDE is a graphical development environment that can be used to develop JACK agent and team-based applications. |
JACOB Manual | Describes how to use JACOB. JACOB is an object modelling language that can be used for inter-process transport and object initialisation. |
WebBot Manual | Describes how to use the JACK WebBot to develop JACK enabled web applications. |
Design Tool Manual | Describes how to use the Design Tool to design and build an application within the JACK Development Environment. |
Graphical Plan Editor Manual | Describes how to use the Graphical Plan Editor to develop graphical plans within the JACK Development Environment. |
JACK Sim Manual | Describes how to use the JACK Sim framework for building and running repeatable agent simulations. |
Tracing and Logging Manual | Describes the tracing and logging tools available with JACK. |
Agent Practicals | A set of practicals designed to introduce the basic concepts involved in JACK programming. |
Teams Practicals | A set of practicals designed to introduce the basic concepts involved in Teams programming. |
1 Introduction
The Graphical Plan Editor (GPE) is designed for graphically viewing and editing JACK Intelligent Agents® (JACK) plans. The GPE is integrated with the Development Environment (JDE). Plans edited with the GPE may be compiled with the JACK Compiler Utility and traced with the JACK Plan Tracing Tool.
The GPE allows users to view and edit all the details of a plan in separate panels. The panels of the GPE can be displayed or hidden, depending on what a user needs to view while editing each plan. The window that contains these panels is called the Graphical Plan Editor window.
The GPE emphasizes the use of documentation in plans. Plan documentation assists users when creating and understanding plans. Separate documentation sections are included in the GPE for each relevant detail. Plan documentation, resources, variables, conditions and graphs may be edited in the GPE. The reasoning methods of a plan can be represented graphically in the GPE as directed graphs – the Plan Graph Editor is provided for this purpose. However, textual reasoning methods as well as graphical reasoning methods are allowed in plans developed using the JDE. Experience has shown that plans created with the GPE are easier to present to, and are more easily understood by, non-programmers and subject-matter experts because of their graphical nature.
This document describes the GPE and the Plan Graph Editor. These descriptions are applicable to both plans and teamplans.
When a plan is edited using the GPE, the title bar will display Plan: followed by the name of the plan that is currently being edited. When a plan reasoning method is opened using the Plan Graph Editor, the title bar will display Graphs: followed by the name of the plan.
When a teamplan is edited using the GPE, the title bar of the GPE will display Team Plan: followed by the name of the teamplan that is currently being edited. When a teamplan reasoning method is opened using the Plan Graph Editor, the title bar of the Plan Graph window will display Team Graphs: followed by the name of the plan.
Note that a teamplan cannot be opened with the GPE in Agent Mode, as teamplans are not visible within the JDE browser unless Teams Mode is active. Teams Mode can be toggled on or off by clicking the Teams Mode option in the View menu of the JDE.
1.1 Operating System notes
The instructions in this document are written with the expectation that the reader will be a PC user, but they are generally applicable to both Macintosh and Unix users. However, in some cases the instructions will be slightly different for Macintosh users.
Macintosh users should note the following:
- A left-click on a PC refers to an ordinary mouse click on a single button mouse.
- If using a single button mouse, click the single mouse button while holding down the CTRL key.
- To select multiple items (for example, graphs in the Printing Plan window), hold down the COMMAND key and click the desired items.
- The COMMAND key should be used instead of the CTRL key for keyboard shortcuts.
- The Preferences window is accessible from the JACK Developer Application menu instead of the Tools menu.
Unix users should note:
- The Copy to Clipboard button in the Export Plan Graphs window is only applicable for Macintosh and Windows users.
The screenshots used in the document were generated from a Macintosh; this was for readability purposes only.
2 Overview
This manual provides instructions for using the GPE to edit components of Graphical Plans and Graphical Reasoning Methods. It begins with a brief description of Graphical Plans and their features. Creating and opening graphical plans within the JDE is also described.
Instructions for editing graphical reasoning methods are outlined and include details of the types, categories and editors of nodes required for defining graphical plan logic. Management of Graphical Plans, including printing and exporting is also covered. The manual concludes with a description of the graphical plan and font preferences that affect the GPE.
3 Graphical plans
Graphical plans have the same components as regular JACK plans with the addition of graphical reasoning methods. Graphical reasoning methods allow the user to construct the logic of a plan graphically. Reasoning method statements are represented with nodes, which are created from the node types provided in the Plan Editor Palette. The nodes are connected with links to designate control flow.
Graphical plans have body, pass and fail reasoning methods by default. Plan execution starts and finishes in the body method. Pass and fail methods are used if any actions are required after plan success or failure. Other graphical reasoning methods may be added, and they may be renamed to replace default graphical reasoning methods.
Note: It is possible to have a plan with non-graphical and graphical reasoning methods.
3.1 Creating graphical plans
A new plan can be created in the JDE from either the Plan Types folder or a design within the current project. Refer to the Design Tool Manual for more information on designs. Once a plan has been created, a GPE window can be opened for the plan.
4 Opening graphical plans
The GPE is used to edit plans that have already been created from within the JDE. A separate GPE window is shown for each plan that is edited. Likewise, the Plan Graph Editor is used to edit graphical reasoning methods that have already been created for a plan from within the GPE. The Plan Graph Editor window provides access to all the graphical reasoning methods of the associated plan.
To open the GPE, follow the steps below.
- Open the JDE.
- Load a project into the JDE, or create a new project by following the steps given in the Development Environment Manual.
- Open the Agent Model folder in the JDE browser by clicking on the + symbol to the left of the Agent Model icon. The Agent Model will expand.
- Open the Plan Types folder in the Agent Model by clicking on the + symbol to the left of the Plan Types folder icon. The Plan Types folder will expand, and the various plans will become viewable.
- Right-click on the plan type to be edited. A pop-up dialog box will open, providing (among other options) the option to Edit Graphically.
- Click with either mouse button on the Edit Graphically option. The GPE will open.
Figure 4-1: An open Graphical Plan Editor window
4.1 Opening graphical reasoning methods
The Plan Graph Editor can either be opened from the GPE or directly from the Reasoning Methods folder of the JDE. In the former case, open the GPE according to the instructions above. Then select/create the reasoning method to be edited from the Graphs List and right-click the Edit Graph button.
To open the Plan Graph Editor directly from the JDE:
- In the JDE browser, expand the current plan by clicking the icon to the right of the plan name.
- Expand the Reasoning Methods folder of the plan by clicking the icon to the right of the folder. Graphical reasoning methods are distinguished from textual reasoning methods by the icon to the left of the reasoning method name; a text or pencil icon indicates a textual reasoning method, whereas a graph icon indicates a graphical reasoning method. Textual reasoning methods can not be edited graphically.
- Double-click a graphical reasoning method name. Alternatively, right-click a graphical reasoning method name and select the Edit option from the pop-up menu.
- A Plan Graph Editor window displaying the selected graph will open. If not already open, a GPE window will also open for this plan.
In either case a window like the following will be displayed. In the example below, the Plan Graph canvas is empty, as we are dealing with a newly created reasoning method.
Figure 4-2: Plan Graph Editor window
4.2 Editing graphical plans with both the JDE and the GPE
The documentation, resources and conditions (excluding conditions documentation) of a plan can be edited in both the JDE and the GPE. When one of these components is edited in the JDE or GPE, it is automatically updated in the other window. For example, if a new sentence was added to the plan documentation in the GPE, it would also appear in the plan documentation in the JDE browser.
Once a plan has been edited in the GPE, it may still be edited in the JDE. However, not all components of graphically edited plans can be edited in the JDE. For example, the variables and graphical reasoning methods (including documentation, variables and parameters) of plans must be edited in the GPE. Plan conditions may be edited in the JDE, although conditions documentation is not visible.
If a plan has existing body, pass or fail textual reasoning methods, and is opened in the GPE, a Subgraph/textual method conflict will occur. The user can choose to rename an existing textual reasoning method and create a new graphical reasoning method, or leave the original name as is.
Note: It is possible for a plan to have both graphical reasoning methods and textual reasoning methods.
Plans created and/or edited using the GPE cannot be edited with the JDE alone. They require editing with the GPE because they have graphical reasoning methods.
5 Editing graphical plans
Graphical plans are edited in GPE windows. A GPE window contains buttons for printing and exporting plans as well as the following panels for editing plan attributes:
- Documentation
Plan-level documentation. - Resources
Resources used by the plan (handled event, posted events, enclosing interfaces, belief data, textual reasoning methods, etc.). - Variables
Variables global to the plan. - Conditions
Relevance and context conditions. - Graphs List
Graphical reasoning methods required by the plan.
When a GPE window first appears, only the Documentation and Graphs List panels are displayed.
The toolbar of a GPE window has checkboxes with names corresponding to the above plan attributes which can be used to display or hide the panels. Panels are displayed or hidden by clicking on the checkbox or panel name. The GPE window grows and shrinks according to the panels that are displayed.
Note that the GPE only maintains a list of the graphical reasoning methods required by the plan. The actual content of these reasoning methods is specified and edited in the Plan Graph Editor.
5.1 Editing plan documentation
The Documentation panel of the GPE displays plan documentation as editable text. This panel is displayed by default. Documentation panel text may be edited in:
- The Documentation panel, and
- The Documentation section under the plan name in either the JDE browser or the Resources panel.
Figure 5-1: Documentation panel
When a new plan is created, the documentation text section in the Add Plan Type dialog window allows plan documentation to be added.
To add, edit or delete plan documentation:
- Select the Documentation checkbox with the left mouse button if it is not already selected. Alternatively, click the Documentation name to display the Documentation panel. The Documentation panel will open below the GPE tool bar.
- Documentation in text form can now be added, edited or deleted within the Documentation panel. Text may be cut, copied and pasted using the JDE Edit menu or keyboard shortcuts.
5.2 Editing plan resources
The Resources panel of the GPE displays the resources used by a plan. These resources are the same as those shown under the plan name in the JDE Browser. The Resources panel can be used to add, edit and delete plan resources in the same way as the JDE browser. The Resources panel is, in effect, a way that the user can see which JACK elements the plan is associated with, without needing to look at the JDE browser.
Figure 5-2: Resources panel
To display the plan resources, click the Resources checkbox.
To add a resource:
- Holding the mouse button down over the required resource, drag the required resource from the JDE browser into the appropriate section in the Resources panel.
- Release the mouse button once the cursor becomes an arrow. This will drop the required resource into the appropriate section in the Resources panel.
To edit a plan resource name:
- Right-click the resource name with the mouse.
- Select the Edit option in the pop-up dialog window.
- Edit the current name and press ENTER. Alternatively, select another resource to finish editing.
To edit a plan resource:
- Right click the resource name and select Edit from the pop-up dialog options. Alternatively, double-click on the resource name.
- Edit the resource text as required and click the Done button to close.
5.3 Editing plan variables
The Variables panel of the GPE displays a sortable list of plan variables. Variables declared in the Variables panel of the GPE window are global to the plan. Each variable has the following fields:
- Type
This refers to the data type of the variable. For example, a variable may be an int, double, String or other JACK or Java type. - Name
This refers to the name of the variable, as used in the plan code. For example, an event that is handled by a plan might have the name ev. - Value
This refers to the initial value of the variable when a plan instance is executed, if any. - Documentation
This refers to the description of the variable. Variable documentation may be used to describe the purpose and type of a variable, and how it is used in a plan.
As well as a list of plan variables, the Variables panel also has Delete and Add buttons for adding and deleting variables. Variables may be sorted by clicking on a field heading. Variables must have a name and type, but the Value and Documentation fields are optional. Note that the GPE does not validate variable names, types or values.
Figure 5-3: Variables panel
To add a variable with plan scope:
- Open the Variables panel in the GPE window by clicking the Variables checkbox in the Plan Graph tool bar, or by clicking the Variables name in the Plan Graph tool bar. The Variables panel will open.
- Click the Add button in the Variables panel.
- A new variable with name newVariable will be added.
Note: A newly added variable has no type, value or documentation.
To edit the Type, Name, Value or Documentation fields of a variable:
- Using the left button of the mouse, click the Type, Name, Value or Documentation field of the variable requiring editing with the mouse. The field name will become editable.
- Type in the required changes.
- Click another field, or press ENTER to finish editing.
To delete a variable:
- Select the variable to be deleted by clicking any of the variable's fields.
- Click the Delete button in the Variables panel.
Note that variables can only be deleted one at a time.
To sort the list of plan variables by a field, click a field heading using the mouse. The list of variables will be sorted according to that field.
Note: If plan variables are sorted during editing of the variable, any changes will be lost.
5.4 Editing plan conditions
The Conditions panel of the GPE displays the conditions for plan execution.
The following sections are displayed as editable text:
- Relevance Documentation
- Relevance
- Context Documentation
- Context.
Figure 5-4: Conditions panel
An Available Variables list is also displayed. This is a list of alphabetically sorted variable names and types. These variables may be inserted into text areas in the Conditions panel by clicking on one of the arrows to the left of the list. The Available Variables list in the Conditions panel includes plan variables, events, interfaces and belief data.
Once a variable name is inserted into an editable text area, the name will not be automatically updated if changed in the GPE. A variable name is inserted as text, so if the variable changes, the name is updated in the Available Variables list, but not in any text areas into which it has been inserted.
To edit a plan condition, first display the Conditions panel by selecting the Conditions checkbox in the tool bar or by clicking the Conditions name. The relevance and context conditions for the plan and their documentation can now be edited. Text in each of the corresponding text boxes can be cut, copied and pasted using the JDE Edit menu or keyboard shortcuts.
5.4.1 Relevance
The relevance condition component is a text box that contains the plan's relevance condition. The relevance condition is a static boolean method that is applied to an event instance for the purpose of determining whether or not the plan type is relevant for that event instance. The relevance condition text box should contain the definition of that method or be left empty. Documentation for the relevance condition is added to the relevance documentation text box.
5.4.2 Context
The context condition component is a text box that contains the plan's context condition. When a plan is relevant for handling an event, the context condition is used to determine the ways, if any, in which a plan type is applicable. The context condition text box should either contain a logical expression or be left empty. Documentation for the context condition is added to the context documentation text box.
The conditions panel of the GPE has an Available Variables list. This list contains the names of plan variables, events and beliefsets. If appropriate, variable names from the list can be copied into the context condition and context conditions documentation text box.
To copy a variable name :
- Select the variable name.
- Move the insertion point to the desired place in the documentation or conditions text box.
- Click the left arrow button next to the relevant text box.
- The variable name is inserted after the current cursor position.
Note: Once a variable name has been inserted, it is not automatically updated. This means that if a variable name is changed in the Variables panel, the old variable name will still be in the Conditions panel.
5.5 Editing the Graphs List
The Graphs List panel of the GPE displays a sortable list of graphical reasoning methods (graphs). This section contains instructions for creating, renaming and deleting graphs.
Note: The body, pass and fail methods may be renamed or deleted; however, the user must ensure that a plan has a body method before it is compiled and run.
Each graphical reasoning method has a Name and Documentation column. Below the list of graphical reasoning methods are the following buttons:
- Delete
The Delete button deletes graphical reasoning methods from the Graphs List. - Rename
The Rename button opens a dialog window that allows a graphical reasoning method name to be edited. - Edit Graph
The Edit Graph button opens the Plan Graph Editor window (if it is not already open). The Plan Graph Editor window is described in a later section. - Create Subgraph
The Create Subgraph button opens a dialog window that allows a new graphical reasoning method name to be entered, creating a graphical reasoning method with that name.
Note: Spaces are not allowed in graphical reasoning method names. Where a space is required, using an underscore ( _ ) is a good alternative.
Figure 5-5: Graphs List panel
5.5.1 Deleting graphs
To delete a graphical reasoning method:
- Select the method name from the list.
- Click the Delete button. A Confirm Deletion of Graph dialog window will appear.
- Click the Delete Graph button to confirm the deletion of the graphical reasoning method, or Cancel to cancel the deletion.
- The method will be deleted from the list.
Note: Graphical reasoning methods must be deleted individually from the Graphs List.
Figure 5-6: Confirm Deletion of Graph dialog window
5.5.2 Renaming graphs
To rename a graphical reasoning method:
- Click the Rename button. A Rename Subgraph dialog window with the current method name will appear.
- Edit the method name as required. The dialog window does not allow spaces.
- Click Apply Changes to confirm the renaming of the method or Cancel to cancel the action.
- The graphical reasoning method will be shown with the new name.
Figure 5-7: Rename Subgraph dialog window
5.5.3 Editing graphs
To edit a graphical reasoning method:
- Select the name of the method to be edited from the Graphs List.
- Click on the Edit Graph button. The Plan Graph Editor window will open, displaying the selected graphical reasoning method.
- Edit the method using the Plan Graph Editor.
Alternatively, double-click the method name in the Graphs List. The Plan Graph Editor window will open, displaying the selected method.
See the Editing Graphical Reasoning Methods chapter of this manual for instructions for the Plan Graph Editor.
5.5.4 Creating graphs
To create a graphical reasoning method:
- Click the Create Subgraph button. A Create New Subgraph dialog window will appear.
- Type the new graphical reasoning method name in the Create New Subgraph dialog window.
- Click the Create New button to create a new graphical reasoning method or click Cancel to cancel the operation.
- A new graphical reasoning method will be added under the currently selected method, or at the bottom of the Graphs List if no method is currently selected.
Note: The GPE does not allow duplicate graphical reasoning method names. The dialog window does not allow spaces in graphical reasoning method names. Also, like Java methods, reasoning methods cannot have spaces in method names.
Figure 5-8: Create new graphical reasoning method
5.5.5 Sorting graphs
To sort the Graphs List, click the Name or the Documentation heading of the Graphs List in the Graphs List panel. The Graphs List will be sorted alphabetically according to the selected heading.
6 Editing graphical reasoning methods
Editing of the graphical reasoning methods (also known as graphs or plan graphs) for a plan is performed in a Plan Graph Editor window. The title bar of the Plan Graph Editor displays the name of the particular plan whose graphical reasoning methods are currently being edited. The name of the graphical reasoning method that is currently being edited is displayed in a drop-down list next to the Plan Graph: option at the top of the Plan Graph Editor window. Clicking on the drop-down list displays a list of all the graphical reasoning methods for the plan. This allows the user to switch between the various graphical reasoning methods of a plan without needing to open and close each method separately.
The Plan Graph Editor window contains a tool bar with a Show Plan button and buttons to print and export graphical reasoning methods. The tool bar also provides access to the following panels:
- Documentation
Method-level documentation. - Variables
Variables local to the reasoning method. - Parameters
Reasoning method parameters. - Exceptions
Exception handling code. - Plan Graphs
The reasoning method logic, represented as a directed graph.
When the window first appears, only the Plan Graphs panel is displayed.
Figure 6-1: Plan Graph Editor window
6.1 Selecting graphs
To change the current graphical reasoning method being edited:
- Click the name of the current graphical reasoning method at the top of the Plan Graph Editor. A list of all methods is displayed.
- Click on the name of the method to be edited.
- The newly selected graphical reasoning method is displayed in the Plan Graph Editor.
Figure 6-2: Current graphical reasoning method
6.2 Editing graph documentation
This panel displays documentation for the current method as editable text. Graphical reasoning method documentation should give a description of the method. For example, documentation can include the actions in the method, names of other reasoning methods called in the method, and what the method does.
Figure 6-3: Documentation panel
Documentation for graphical reasoning methods can only be added and edited in the Plan Graph Editor.
The contents of the graphical reasoning method documentation may be added, edited or deleted in the Documentation panel. Text may be cut, copied and pasted using the JDE Edit menu or keyboard shortcuts.
6.3 Editing graph variables
The Variables panel of the Plan Graph Editor displays a sortable list of reasoning method variables. Variables declared in the Variables panel of the Plan Graph Editor window are local to the reasoning method.
Figure 6-4: Variables panel
To add, edit, delete or sort graphical reasoning method variables first open the Variables panel in the Plan Graph Editor by clicking on the Variables checkbox or Variables name in the tool bar. Then follow the steps relevant to each feature listed below.
6.3.1 Adding variables
To add a graphical reasoning method variable:
- Click the Add button in the Variables panel. A new variable option will appear, entitled newVariable.
- The newVariable can now be edited as required.
6.3.2 Editing variables
To edit the Type, Name, Value and Documentation fields of a graphical reasoning method variable:
- Click the relevant field. Type in the required changes.
- Click another field, or press ENTER to finish editing.
6.3.3 Deleting variables
To delete a graphical reasoning method variable click the Delete button.
6.3.4 Sorting variables
To sort the list of graphical reasoning method variables by field, click the heading of the field to sort by. The list of graphical reasoning methods variables will be sorted in ascending order according to the field clicked.
Note: If graphical reasoning method variables are sorted during editing of a variable, any changes will be lost.
6.4 Editing graph parameters
The Parameters panel displays parameters. Parameters allow calling reasoning methods to pass arguments to the current reasoning method. The features of this panel are similar to the Variables panel in the Plan Graph Editor window, except that the Parameters panel does not have a Value column.
Note: body, pass and fail do not have parameters. The Parameters panel is not shown for these methods.
Figure 6-5: Parameters panel
To add, edit, delete or sort parameters, first select the Parameters checkbox or click the Parameters name to display the Parameters panel.
6.4.1 Adding parameters
To add a parameter to a graphical reasoning method, click the Add button. A new parameter with name newVariable will be added. The new parameter has no type or documentation. If a parameter is previously selected, the new parameter is added below it.
6.4.2 Editing parameters
To edit the Type, Name and Documentation fields of a parameter, click the relevant field. Type in the required changes, and click another field or press ENTER to finish editing.
6.4.3 Deleting parameters
To delete a parameter, select the parameter to be deleted. Click on the Delete button, and repeat the process with any further parameters to be deleted, as parameters can only be deleted one at a time.
6.4.4 Sorting parameters
To sort the list of parameters by a field, click a field heading. The list of parameters will be sorted in ascending order according to the field selected.
Note: If graphical reasoning method parameters are sorted during editing of a parameter, any changes will be lost.
6.5 Editing graph exceptions
Each Plan Graph Editor window has an exceptions panel. This panel allows the user to type in any catch / finally statements as they would appear in Java code. The statements of the entire graph are then enclosed in a try statement, with the text in this box handling any exceptions.
The exceptions panel contains essentially all the exception handling code a user would write in normal textual code, except for the initial try block. Note that depending on the type of exception the user is trying to catch, the body of the reasoning method may require code that actually throws that exception.
Figure 6-6: Exceptions panel
6.6 Editing graph logic
The Plan Graph panel of the Plan Graph Editor has a tool bar and a canvas on which the structure of a graphical reasoning method may be drawn. A graphical reasoning method is drawn as a directed graph. The nodes of the graph are created from the node type provided in the Plan Editor Palette. Links are then created between these nodes to indicate control flow.
Figure 6-7: Plan Graph panel
Nodes may be added to a graphical reasoning method diagram in any order. When linking nodes, it is recommended that the flow of a graphical reasoning method be from top to bottom, to aid the viewer or designer of the method. Graphical reasoning methods must begin with one, and only one, Start node. It is also recommended that End nodes are added to show where the method finishes.
The font of graph component text can be changed in the Fonts preferences of the JDE. See the Font preferences section of the Editor preferences chapter of this manual for further information.
Graph components can be edited or removed by right-clicking on the required node or link and selecting the required option. For example, after right-clicking on a node the options are Edit Node... and Remove Node.
6.6.1 Plan Graph Editor tool bar
The Plan Graph Editor tool bar contains tools for editing and viewing a graphical reasoning method. To select a tool in the tool bar, choose the desired tool and click on the tool button. Certain tools cannot be selected at the same time: the Selection Mode tool and the Link Mode tool are examples of this. The Plan Graph Editor must be in either one mode or the other: it cannot be in both. Moving the mouse cursor over a particular tool on the tool bar elicits tool tips, which are floating text boxes providing descriptions of the relevant tool.
The following tools and buttons are located on the tool bar:
- Selection Mode button
This button switches the Plan Graph Editor into Selection Mode. In Selection Mode, nodes and links in a graphical reasoning method can be selected. Selecting a node or link allows it to be moved, edited and deleted. A node or link is selected and highlighted when clicked. - Link Mode button
This button provides the ability to draw a link between two nodes (points in a plan at which actions occur). When the mouse passes over nodes and links they are highlighted. Links may also be selected, edited and deleted in this mode. - Delete button
This tool is used to delete a node or link once it is selected. Note that there is no undo tool, and any deletions are final. - Open Plan Editor Palette button
This tool opens the Plan Editor Palette, which is described in the following section.
- Zoom slider
The zoom slider allows the current graphical reasoning method to be viewed at different magnifications. - Zoom selection list
The zoom selection list allows the current graphical reasoning method to be viewed at a magnification selected from the list. A value chosen by the user can also be entered directly. If the default GPE settings are used, the zoom selection list is not shown in the tool palette. It may be displayed by changing the GPE preferences in the JDE. These preferences are located in the Graphical Plans tab of the Preferences option in the JDE Tools menu. - Descriptive Mode button
This tool turns Descriptive Mode on or off. When a graphical reasoning method is viewed in Descriptive Mode, nodes in the method are shown with their documentation displayed. When Descriptive Mode is turned off, the nodes are shown with their code displayed. However, if a node does not have documentation, the node is shown with code instead. If a node does not have any code, it is shown with documentation whether Descriptive Mode is on or off.
6.6.2 Plan Editor Palette
The Plan Editor Palette contains node types that can be dragged and dropped onto the Graph canvas. It may be opened either with the Open Plan Editor Palette button or by clicking on the Plan Editor Palette option in the Tools menu of the JDE.
The Plan Editor Palette for both Agent Mode and Teams Mode is illustrated below. Note that in Teams Mode, the Plan Editor Palette has four additional nodes:
- Begin Parallel
- End Parallel
- Parallel Task
- Team Achieve.
These nodes can only be used in teamplans.
Figure 6-8: Plan Editor Palette in Agent Mode (left) and Teams Mode (right)
Apart from the Start, End and Fail nodes in the palette, a node editor is opened automatically when a node is added to a graphical reasoning method. A node editor can also be opened by double-clicking on a node.
A node editor has a short description of the node type and editable text areas for node documentation and each node argument. The number and types of arguments depend on the type of node being edited. An Available Variables list is displayed if there are any plan or graphical reasoning method variables.
Each node type has a different node editor. The text fields in a node editor change according to the arguments required by the node type. If a node type can represent two or more reasoning statements or if a reasoning statement has optional arguments, the node editor displays a drop-down Node Type: options menu. This allows the user to select the required statement and/or combination of arguments.
Each of the node editors consists of several text boxes into which relevant arguments and documentation etc. can be added and changed. The figure below displays the Begin Parallel node editor.
Figure 6-9: Begin Parallel node editor
The Available Variables list is a list of alphabetically sorted variable names and types. These variables may be inserted into text areas in the node editor by clicking on one of the arrows to the left of the list. The Available Variables list in the node editor includes plan variables, events, interfaces, belief data, graphical reasoning method variables and parameters.
Once a variable name is inserted into an editable text area, the name will not be automatically updated if changed in the GPE. A variable name is inserted as text, so if the variable changes, the name is updated in the Available Variables list, but not in any text areas into which it has been inserted.
6.6.3 Nodes
Each of the node types in the Plan Editor Palette (with the exception of the Note node) defines a step in a graphical reasoning method. The Note node is used to add documentation to a node or group of nodes. The other node types may contain documentation and JACK / Java code. Some node types represent reasoning method statements.
A node can reference variables that appear in the Variables panel of the GPE window (which have plan scope) or in the Variables panel of the reasoning method graph (which have reasoning method scope). If a variable is defined within a node (such as a Code node) that variable has node scope and is not visible outside the node.
6.6.3.1 Node types
The node types that are supported by the Plan Graph Editor and are accessible via the Plan Editor Palette are listed below. Note that some nodes represent one or two kinds of reasoning method statements. Also, each node type contains documentation, but the documentation for Start, End and Fail nodes is not displayed in Descriptive mode, and is only accessible by opening the node editor.
- Start node
This node indicates the beginning of a graphical reasoning method. It cannot have any incoming links, and may have only one outgoing link. A Start node always succeeds. If a Start node has no outgoing links, the method succeeds without performing any actions. Note that a graphical reasoning method must have a Start node if it has any nodes other than Notes, and can have one Start node at most. - End node
This node indicates the end of a graphical reasoning method. It can have any number of incoming links, but must have no outgoing links. End nodes are optional, but are recommended as they clearly show where the flow of a graphical reasoning method finishes. A method may have any number of End nodes.
- Fail node
This node indicates the end of a graphical reasoning method. When this node is reached the plan fails. Fail nodes can have any number of incoming links, but must have no outgoing links. A graphical reasoning method may have any number of Fail nodes. - Code node
A Code node contains JACK or Java code. For example, a Code node may be used to perform a calculation. If the code in the node fails, then the node fails. - Post/Send node
This node is used to execute either a post or send reasoning method statement. A Post node is used by an agent to post an event from within a plan. A Send node is used by an agent to send a message event to another agent. The node displays either post or send, depending on the reasoning method statement chosen in the node editor. A Post/Send node may have any number of incoming links and only one outgoing link. - Reply node
This node is used to execute a reply reasoning method statement. A Reply node is used by an agent to reply to a message event received from another agent. A Reply node may have any number of incoming links and only one outgoing link. - Wait node
A Wait node is used by an agent to wait for a condition to become true, with the option of also having a timeout condition or length of time. A Wait node can have any number of incoming links. It can have, at most, two outgoing links. - Subtask node
A Subtask node is used by an agent to post an event synchronously from within a plan. A Subtask node can have any number of incoming links. It can have, at most, two outgoing links. - Subgraph node
A Subgraph node is used to call a reasoning method within a plan. A Subgraph node can have any number of incoming links. It can have, at most, two outgoing links. - Maintain node
A Maintain node is used by an agent to post an event synchronously from within a plan only while a logical condition remains true. A Maintain node can have any number of incoming links. It can have, at most, two outgoing links.
- Achieve/Insist node
An Achieve node is used by an agent to post a goal event if a logical condition is false. An Insist node is used by an agent to repeatedly post a goal event while a logical condition is false. The node displays either achieve or insist, depending on the reasoning method statement chosen in the node editor. Achieve and Insist nodes can have any number of incoming links. They can have, at most, two outgoing links. - Test/Determine node
A Test node is used by an agent to test a logical condition and post a goal event if it is unknown. A Determine node is used by an agent to try and find a logical binding for which a goal event will pass. The Test/Determine node displays either test or determine, depending on the reasoning method statement chosen in the node editor. Test and Determine nodes can have any number of incoming links. They can have, at most, two outgoing links. - Decision node
A Decision node contains a test condition that is a boolean expression. A Decision node may have any number of incoming links and must have two outgoing links, or a warning is given. Links from a Decision node are labelled 'yes' or 'no' to reflect the path to be taken on success or failure. - Documentation node
Documentation nodes allow the user to add text comments to a graphical reasoning method, for example, to explain a particular node or collection of nodes. A Documentation node cannot have any incoming links, but may have links attaching it to particular nodes. - Begin Parallel, End Parallel and Parallel Task nodes
These nodes are used together to implement @parallel statements in a graphical teamplan. An @parallel statement consists of a Begin Parallel node, an End Parallel node, plus one or more Parallel Task nodes. Each Parallel Task node is connected to its own processing graph. These processing graphs are then connected to the End Parallel node. This is illustrated in the figures below. - Team Achieve node
A Team Achieve node is used by a team to activate a subteam, by sending an event to the subteam. The team that sent the @teamAchieve then waits until the event has been processed by the subteam.
The mapping between reasoning method statements and nodes is straightforward, except for @parallel statements. Implementation of an @parallel statement in a graphical reasoning method requires a combination of Begin Parallel, End Parallel, Parallel Task nodes together with the nodes required to implement the parallel tasks. As an example, consider the following @parallel statement:
@parallel(ParallelFSM.ANY,false,null,p) { watch: @teamAchieve(crew,crew.wm.watch()); fly: fly(p); };
The corresponding subgraph is shown below:
Figure 6-10: Subgraph in Descriptive mode
Figure 6-11: Subgraph in Non-descriptive mode
Note: In graphical reasoning methods, parallel tasks should only be referred to by label and not by index.
6.6.3.2 Node categories
Nodes can be categorised according to the maximum number of outgoing links (0, 1 or 2). The following three categories are defined for reference purposes:
- Action nodes
An action node either passes or fails. It can have either one or two outgoing links. If it has one outgoing link, the link must be a pass link. If it has two outgoing links one must be a pass link and one must be a fail link. The links are labelled according to the link type (pass or fail). Pass links and fail links are followed if node evaluation succeeds or fails respectively. If no fail link is present, node evaluation fails and the plan fails. - Decision nodes
A decision node evaluates to either true or false and has two outgoing links, a yes link and a no link. These links correspond to an evaluation of true or false respectively. - Terminal nodes
A terminal node is a node that has no outgoing links. The flow of a graphical reasoning method finishes at a terminal node. It is good practice to end a graphical reasoning method with an End node to clearly show where execution finishes.
Links | Category | Nodes |
0 | terminal | End, Fail |
1 | action | Post/Send, Reply |
1 | none | Start, Note, Parallel Task |
2 | action | Code, Subgraph, Subtask, Wait For, Maintain, Achieve/Insist, Test/Determine, End Parallel, Team Achieve |
2 | decision | Decision |
many | none | Begin Parallel |
Table 6-1: Graphical Plan Editor Nodes
6.6.3.3 Node editors
Each node type has a different node editor. The text fields in a node editor change according to the arguments required by the node type. If a node type can represent either of two or more reasoning method statements, the node editor gives a choice between the two statements.
The Available Variables list in the node editor contains the names of plan variables, events, beliefsets, graphical reasoning method variables and parameters. Available variable names may be inserted into the documentation and arguments of a node.
To insert a variable:
- Select the variable name from the list.
- Move the mouse cursor to the desired place in the documentation or argument text.
- Left-click the left arrow button next to the relevant text box. The variable name is inserted after the current cursor position.
- Once a variable name has been inserted, it is not automatically updated, and will need to be updated manually. This means that if a variable name is changed, the old variable name will remain in the text into which it was inserted.
Figure 6-12: Node editor
6.6.3.4 Node operations
Within the Plan Graph Editor, one can add, edit, delete and move nodes.
To add a node:
- Open the Plan Editor Palette by selecting the Open plan editor palette button on the tool bar, or selecting the Plan Editor Palette option from the Tools menu of the JDE menu bar.
- Select a node from the Plan Editor Palette by clicking on the new node type to be added.
- Drag-and-drop the node from the Plan Editor Palette to the Graph canvas.
- For nodes other than Start, End and Fail, a node editor window will open. In the node editor window, edit the node details (documentation and any arguments) and click the Add New button to add the new node, or click the Cancel button to close the node editor and cancel the operation.
Note: The node editor must be closed before continuing with further editing.
To edit a node after it has been added to a graphical reasoning method, double-click on the node using the left mouse button. Edit the node details (documentation and any arguments) in the node editor. Click the Apply Changes or Cancel button to close the node editor.
To delete a node from a graphical reasoning method, click on the node to be deleted while in Selection mode. The node will become highlighted. Now click on the Delete button on the tool bar or press the DELETE key on the computer keyboard. Note that when a node is deleted, any associated links are also deleted. This behaviour is different to that of the Design Tool.
Note: Nodes can also be edited or deleted by right-clicking on the link and choosing from the context menu.
To move a node, click the Selection mode tool in the tool bar, and then click the node. The node will become highlighted, and can thenceforth be moved by dragging with the mouse.
6.6.4 Links
Links are represented by single lines between two nodes. Some have an arrow at one end to indicate the direction of flow. Documentation may be added to all links in a graphical reasoning method diagram. Any link documentation appears as text on the link in Descriptive mode. Link documentation may be added, edited and deleted. The outgoing links of some node types may also be given a label.
6.6.4.1 Link types
Depending on the type of the node and the number of outgoing links, the outgoing links for a node are labelled with a link type. The possibilities are as follows:
- Action nodes that can have two outgoing links (Wait For, Subtask, Subgraph, Maintain, Achieve/Insist, Test/Determine , Code, End Parallel and Team Achieve) have the outgoing links labelled with link types of pass and fail to indicate which path is taken on success or failure of the node. The first link to be drawn from one of these node types will be assigned a link type of pass. The second link to be drawn will be assigned a link type of fail. These labels may be changed using the link editor – refer to the Link operations section below for further details.
- Decision nodes have two outgoing links which are labelled yes and no to reflect the path to be taken on the outcome of the decision. The first link to be drawn from a Decision node will be a yes link. The second will be a no link. These labels may be changed in the link editor – refer to the Link Operations section below for further details.
All remaining node types which have outgoing links (Post/Send, Reply, Start, Note, Begin Parallel and Parallel Task) have no labels associated with the outgoing links.
An example of the use of both pass/fail and yes/no links is shown below:
Figure 6-13: Subgraph pass/fail and yes/no links
6.6.4.2 Link categories
Two categories of links are supported within the Plan Graph Editor – floating links and fixed links. Floating links are created by targeting the mouse cursor anywhere on a component. To create a floating link, it is not necessary to be accurate. Targeting anywhere within the component icon enables a floating link to be formed. The GPE will automatically form the link from an appropriate link point (enlarged point on the perimeter of a component). Floating links can move from link point to link point and, should a component be moved on the canvas, the link between it and its associated component also moves. Fixed links are created by building a link from a link point on one component directly to a link point on another. To create a fixed link, it is necessary to be accurate with the mouse cursor, and create the link directly from link point to link point.
6.6.4.3 Link operations
Links can be added, edited and deleted.
The link tool is used to add a link between two nodes. When the mouse cursor is placed over a node while in Link mode it is highlighted, and attachment points are shown. These attachment points are used to link nodes together.
Figure 6-14: : A floating link connecting a Start node to a Decision node
The attachment point of a link can be changed by dragging a link from one link point to another. This can be done at both ends of a link. Links can also be reattached to another node: either end of the link can be reattached.
Loop constructs are implemented as cycles within the plan graph:
Figure 6-15: Subgraph pass/fail and yes/no links
Note: The order in which nodes are linked determines the direction of the arrow on the link.
6.6.4.4 Editing links
Links can be edited at any stage during the development process, and documentation can be added to links or edited at any stage. To edit the documentation for a link or to change its link type:
- Double-click with the left mouse button on the link to be edited.
- The Edit Link pop-up dialog will open. Depending on the nodes being linked, the editor may offer an option to change the link type. A text box for documentation is also provided.
- Enter the necessary documentation and make any changes to the link type that are required.
- Click the Apply Changes when finished, or Cancel to cancel the operation.
Figure 6-16: The link editor
Links can be deleted while in either Selection mode or in Link mode. To delete a link from a graphical reasoning method diagram:
- Click on the link to highlight it.
- Click on the Delete button on the tool bar, or press the DELETE key on the computer keyboard.
- The link and any associated documentation will be deleted.
Note: Links can also be edited or deleted by right-clicking on the link and choosing from the context menu.
7 Graphical plan management
7.1 Saving plans
A graphically edited plan is saved when the current project is saved in the JDE. Any unsaved components of a project, including plans, are highlighted in the JDE browser until they are saved. Refer to the Development Environment Manual for details.
7.2 Deleting plans
Deleting a graphically edited plan is completed in the same way as deleting a plan edited in the JDE. Refer to the Development Environment Manual for details.
7.3 Compiling plans
The JDE automatically generates gcode for graphical plans so compilation for a project containing graphical plans is the same as for a project containing non-graphical plans. Refer to the Development Environment Manual for details.
Graphically edited plans may be generated as traceable plans, which allows them to be traced during execution by the graphical Plan Tracing Tool (see the Plan Tracing Tool chapter of the JACK Tracing and Logging manual for further details). To generate traceable plans, the Generate traceable plans option must be selected in the Graphical Plans tab of the Preferences option in the JDE Tools menu.
7.4 Printing plans
Plans and their graphical reasoning methods are printed from the Print Plan window. To open the Print Plan window, click the Print button in the GPE window or Plan Graph Editor window.
Figure 7-1: Print Plan window
The following options are available for printing plans:
- Print Plan Details (Separate Page Only)
- Print Graph Details on Separate Pages
- Print Graphs in Descriptive Mode
- Select Graphs to Print
- Show Name
- Show Documentation
- Show Plan Handled Event
- Show Plan Conditions
- Show Variables and Parameters
- Show Exceptions
- Show Graph
- Center Graph Horizontally
- Center Graph Vertically
- Expand Graph to fit page.
7.4.1 Print Plan Details (Separate Page Only)
To print the details of the current plan, select the Print Plan Details (Separate Page Only) option name or checkbox. This option will print the following plan details:
- Plan name
- Plan documentation
- The name and type of the event handled by the plan
- Relevance condition
- Context condition
- Plan variables, including events that are posted or sent and belief data.
7.4.2 Select Graphs to Print
To print graphical reasoning methods, select one or more graphical reasoning method names from the list of methods in the Print Plan window.
Note: The Select All and Clear All buttons can be used when selecting graphical reasoning methods to print. Multiple methods can be selected by holding down the CTRL or SHIFT key, and clicking method names.
7.4.3 Print Graph Details on Separate Pages
To print the details of a graphical reasoning method on a separate page to the diagram, select the Print Graph Details on Separate Pages option.
To print the nodes of a graphical reasoning method with documentation, select the Print Graphs in Descriptive Mode option.
The following graphical reasoning method details may be selected and printed:
- Name (of plan)
- Documentation
- Plan Handled Event
- Plan Conditions
- Variables and Parameters
- Exceptions
- Graph.
Graphs may be centred horizonally or vertically and can be expanded to fit the page.
7.4.4 Print
Click on the Print button to print the required diagrams.
7.5 Exporting graphical reasoning methods
Plan Graphs can be exported as an image to a JPG or PNG file. To export a plan graph, click the Export plan graphs button on the GPE window or a Plan Graph Editor window. An Export Plan Graphs window similar to the figure below will open.
Figure 7-2: Export Plan Graphs window
Select the required graph, image dimensions and graph details to be exported. Then click the Export to File... button. An Export selected to the following file dialog will open and the file name and path of the exported image can be specified.
Note: When exporting multiple graphs, only the file path should be specified. The exported files will have names corresponding to the exported graph name.
8 Editor preferences
8.1 Graphical plan preferences
The Preferences option in the Tools menu of the JDE has a Graphical Plans tab with the options listed below. Note that when the options are changed, they are not applied to windows that are already open.
Figure 8-1: Graphical Plans tab in the Preferences option of the JDE Tools menu
- Generate traceable plans
The Generate traceable plans option creates traceable plans when JACK files are generated for a project. Note that only graphical reasoning methods in non-teams projects may be traced graphically. However, the exit and entry points of textual reasoning methods and events can be traced. - Plan Graph code generator warns about missing links in graphs
This option ensures that when JACK files are generated, any warnings about missing links are shown in the Error Log. For example, a warning will appear if a Code node has no incoming links and thus is not able to be executed.
- Show labels on plan editor palette
This option displays the names of node types (beneath the node icon) that are located in the Plan Editor Palette. The option is particularly useful when first becoming acquainted with the GPE, and can be toggled off when the user becomes more familiar with the various node types. - Show tick marks in the zoom slider
This option shows tick markings on the zoom slider. These markings indicate the percentage by which a graphical reasoning method is magnified from the default. It should be noted that when this option is selected it is not applied to Plan Graph Editor windows that are already open. - Show zoom slider
This option displays the zoom slider in the tool palette. It should be noted that when this option is selected it is not applied to Plan Graph Editor windows that are already open. - Show editable zoom selection list
This option displays a drop-down list of magnification percentage options to the left of the Toggle descriptive mode button in the tool palette. It should be noted that when this option is selected it is not applied to Plan Graph Editor windows that are already open. - Plan graph editor is initially in descriptive mode
This option displays a graphical reasoning method initially in descriptive mode when a Plan Graph Editor window is opened. - Always return to selection mode immediately after drawing a link
This options ensures that when a link has been drawn, the Plan Graph Editor will automatically change from Link mode to Selection mode. - Only show first sentence of non-note nodes in descriptive mode
This option only displays the first sentence of non-note node documentation within a node when descriptive mode is on. - Layout of text nodes in descriptive mode to fit
This option ensures that when descriptive mode is on that all node documentation is displayed within nodes in an approximately square layout using automatic text wrapping. If the previous option is selected, only the first sentence is displayed. - Limit the character length of node text shown
This option enables the user to set the number of characters shown in a node when descriptive mode is used.
8.2 Font preferences
The Preferences option in the Tools menu of the JDE has a Fonts tab with the options listed below. Three options are given in this tab to change the font of nodes, links and text in graphical reasoning methods. Note that when the options are changed and applied, Plan Graph Editor windows that are already open must be closed and then reopened for font changes to take effect.
Each preference has an Edit button, which opens a Font Chooser window. The Font Chooser window contains a list of fonts available on the system being used, and from this list the Family, Typeface and Size of the font can be chosen.
Figure 8-2: Fonts tab in the Preferences option of the JDE Tools menu
The three options relevant to Graphical Plans are:
- Font for object type text in graphical plans (close and reopen opened graphs)
This preference specifies the font of node object names, e.g. a reply node, in graphical reasoning methods. - Font for object code text in graphical plans (close and reopen opened graphs)
This preference specifies the font of code in node objects in graphical reasoning methods.
- Font for link text in graphical plans (close and reopen opened graphs)
This preference specifies the font of links in graphical reasoning methods.