Joint Behaviors

From ABL
Revision as of 13:09, 1 August 2006 by Dbueno (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction to Joint Goals and Behaviors

In ABL, the basic unit of coordination is the joint goal. When a goal is marked as joint, ABL enforces synchronized entry into and exit from the behaviors chosen to accomplish the goal. The keyword joint can be used to modify both goals and behaviors. The joint declaration tells ABL that entry into and exit from the joint behavior must be coordinated with team members. Entry into a behavior occurs when the behavior is chosen to satisfy a subgoal. Exit from the behavior occurs when the behavior succeeds, fails, or is suspended. The algorithm for executing a joint subgoal and coordinating entry appears below:

  1. The initiating agent chooses a joint behavior for the joint goal based on signature matching, precondition satisfaction, and specificities.
  2. If a joint behavior is found for the joint goal, mark the goal as negotiating and broadcast an intention to enter the goal to all team members, otherwise fail the goal.
  3. If all team members respond with an intention to enter the joint goal, add the joint behavior (and behavior children) to the ABT.
  4. If any team member reports an intention to refuse entry to the joint goal, broadcast an intention to refuse entry and fail the behavior when all team members respond with an intention to refuse entry.

When ABL executes a joint goal, a behavior is chosen for the goal using normal behavior selection methods, with the additional constraint that the behavior must be joint (marked with the joint keyword). Joint behaviors include a specification of the team members who must participate in the behavior. If a joint behavior is found for the joint goal, ABL marks the goal as negotiating and begins negotiating entry with team members specified in the joint behavior. Note that negotiating is a new state for joint goal steps. A normal (non-joint) goal can either be not executing, in which case it is a leaf step available for execution, executing, in which case a behavior has been chosen for the goal and added to the ABT, or suspended, in which case it is removed from the conflict set if it was not previously executed, or all leaf steps in the subtree rooted at the goal are removed from the conflict set if it was previously executed. In the negotiating state, the goal step is removed from the conflict set. That line of expansion is blocked until negotiation completes, but all other parallel lines of expansion are still pursued. If the negotiation takes awhile, perhaps because there are a large number of distributed teammates who are synchronizing during the negotiation, all negotiating agents continue to execute the decision cycle and engage in behavior. An intention-to-enter message is sent to all team members. The initiating message includes information about the goal signature and arguments.

The goal remains in the negotiating state until all team members respond with an intention to enter or an intention to refuse entry. If all agents respond with intention-to-enter messages, this signals that all agents in the team have found appropriate behaviors in their local behavior libraries; the goal state is changed to executing, and the selected behavior and its steps are added to the ABT. If any agent responds with an intention to refuse entry, presumably because, given the goal signature and goal arguments, it couldn’t find a satisfied joint behavior, the initiating agent sends all team members an intention to refuse entry. When all agents report that they intend to refuse entry, the initiating agent fails the joint behavior (whose steps never actually got a chance to execute). This causes the goal to attempt to find a different joint behavior with satisfied precondition, perhaps one with a different set of team members. Just as with a normal (non-joint) goal, if no such alternate behavior can be found, the goal fails. Figure 5 6 shows the entry negotiation algorithm for the initiator of a joint goal, that is, the agent who originally executes the joint goal step, and who thus begins the joint behavior selection and negotiation process. The teammates of a joint goal initiator use a similar negotiation algorithm. The only difference is that for non-initiators, a joint goal with appropriate signature and arguments must be created and attached to the root collection behavior of the ABT. The algorithm of coordinating exit from a joint behavior is shown below:

  1. An initiating agent broadcasts to all team members an intention to exit (either succeed, fail, or suspend) an executing joint goal.
  2. All agents receiving an intention to exit respond by broadcasting to all team members their own intention to exit (succeed, fail, or suspend).
  3. When all team members respond with the appropriate intention to exit, the joint goal is succeeded, failed or suspended as appropriate.

For example, assume that a joint behavior has been successfully entered by a team. At this point each member of the team is executing a joint behavior from their local behavior library with the same signature, arguments, and team members. One of the team members, in executing their local joint behavior, encounters a condition where they should exit the behavior. Perhaps the last step of the behavior succeeds, causing the joint behavior and goal to succeed, or the context condition fails, causing the joint behavior and goal to fail, or a higher priority conflicting goal (either joint or non-joint) enters the ABT, causing the joint goal to suspend. The agent encountering this situation becomes the initiator of the intention to exit; this exit initiator is not necessarily the same agent as the entry initiator. The exit initiator marks the joint goal as negotiating and broadcasts the appropriate intention to exit to all team members. While the joint goal is in the negotiating state it blocks that line of expansion; all other lines of expansion in the ABT are still active. As each team member receives an intention to exit, it marks its local version of the joint goal as negotiating and broadcasts an exit intention. Once exit intentions have been received from all team members, an agent exits the negotiating goal (succeeds, fails or suspends the goal).

Joint Behavior Example

joint sequential behavior StalkWithSamAndTracy() {
    teammembers Sam Tracy;

    subgoal StalkPrey();

This is a behavior which, when chosen causes intention-to-enter to be broadcast to Sam and Tracy.

Joint Goal Example

sequential behavior Test() {
    long startTime = System.currentTimeMillis();
    with (success_test {
        (System.currentTimeMillis() > startTime + 4000)})
    with (team_needed_for_success) joint subgoal TestJointBehavior();

This joint subgoal will search the joint family of behaviors named TestJointBehavior for matching behaviors. It specifies that the entire team must succeed for this local agent's behavior to succeed.