E FFICIENTLY E VOLVING S WARM B EHAVIORS U SING G RAMMATICAL E VOLUTION W ITH PPA- STYLE B EHAVIOR T REES
A BSTRACT
Evolving swarm behaviors with artificial agents is computationally expensive and challenging.
Because reward structures are often sparse in swarm problems, only a few simulations among hundreds evolve successful swarm behaviors.
Additionally, swarm evolutionary algorithms typically rely on ad hoc fitness structures, and novel fitness functions need to be designed for each swarm task.
This paper evolves swarm behaviors by systematically combining PostconditionPrecondition-Action (PPA) canonical Behavior Trees (BT) with a Grammatical
Evolution.
The PPA structure replaces ad hoc reward structures with systematic postcondition checks, which allows a common grammar to learn solutions to different tasks using only environmental cues and BT feedback.
The static performance of learned behaviors is poor because no agent learns all necessary subtasks, but performance while evolving is excellent because agents can quickly change behaviors in new contexts.
The evolving algorithm succeeded in 75% of learning trials for both foraging and nest maintenance tasks, an eight-fold improvement over prior work.
I NTRODUCTION
Bio-inspired models have produced efficient algorithms in various domains (Karaboga & Basturk, 2007; Dorigo et al., 2006).
The potential benefits of bio-inspired algorithms are limited by the cumbersome task of observing animal behavior and creating mathematical models to describe both individual and collective behaviors (Sumpter & Pratt, 2003; Gordon, 2010).
A promising alternative is to design novel swarm behaviors using evolutionary algorithms.
Evolving swarm behaviors in non-episodic setting requires group-level objectives and rewards to be divided into individual objectives and rewards, which is a form of the credit assignment problem (CAP) (Sutton, 1984).
Existing swarm evolution algorithms address CAP by designing ad hoc fitness functions that give the artificial agents sufficient feedback to solve a particular task (Ferrante et al., 2013; Neupane et al., 2018).
Unfortunately, designing an ad hoc fitness function for each task requires expert knowledge, and is subject to human biases (Nelson et al., 2009).
Also, evolving swarm behaviors require the designer to choose and aggregate various controllers, evolutionary algorithms, and fitness functions.
In many cases, only a few combinations are viable to evolve collective behaviors, and the success rate is low among those viable combinations.
A multi-agent Grammatical Evolution (GE) (O’Neill & Ryan, 2001) algorithm called GEESE evolved colony-level foraging behaviors, outperforming conventional GE and hand-coded solutions on a foraging task (Neupane et al., 2018).
GEESE’s controllers were Finite State Machines (FSMs) and the group fitness was the total food collected, but GEESE could only evolve foraging behaviors.
GEESE-BT (Neupane & Goodrich, 2019b; Neupane, 2019) used a more expressive grammar that could evolve both foraging and cooperative transport behaviors.
GEESE-BT’s controllers were behavior trees (BTs), and GEESE-BT used ad hoc fitness functions from the theory of intrinsic moti- vators.
Unfortunately, the ad hoc reward structures were not sufficient to evolve successful behaviors with high success rate and required a new fitness function for each new task.
This paper presents the BeTr -GEESE (“better geese”) algorithm, which produces successful swarm behaviors while learning even though no single agent has all necessary behaviors at any given point during the evolution.
BeTr -GEESE improves GEESE-BT in three significant ways: (i) primitive behaviors use Postcondition-Precondition-Action (PPA) structures (Sprague et al., 2018); (ii) the grammar used PPA-style BT programs; and (iii) the task-specific ad hoc rewards were replaced with BT execution node status, enabling direct feedback from PPA nodes.
The evolving algorithm succeeds in 75% of learning trials for two tasks (foraging and nest maintenance), an eight-fold improvement over GEESE-BT.
Two limitations are noteworthy.
First, swarm success requires agents to perform ongoing evolution.
This is problematic if agents experience catastrophic failures while learning, such as when a physical robot crashes in the world.
Second, the algorithm is only applied to multiagent tasks that are divisible and additive tasks, meaning that the swarm’s task can be broken into subtasks achievable by individual programs (Steiner, 1972).
R ELATED W ORK
Early work in evolving robot controllers include (a) staged evolution of a complex motor pattern generator to control a walking robot (Lewis et al., 1992) and (b) evolving neural-network-based control architectures for visually guiding robots (Cli et al., 1993).
Neural networks can directly map robot inputs to outputs (Lewis, 1996; Trianni et al., 2003), but tend to be data-hungry and not transparent (Fan et al., 2021).
Kriesel et al.
(2008) applied evolution to swarm systems and demonstrated that simple evolved individuals can produce effective swarm behaviors.
Evolutionary robotics algorithms differ from each other in the choice of the evolutionary algorithm and the choice of the agent’s controller.
Individual robot controllers have been designed using Neural Networks (NN), Finite state machines (FSM) and hierarchical FSMs (HFSM) (Petrovic, 2008; Pint ´ er-Bartha et al., 2012; K ¨ onig et al., 2009; Brooks, 1986; Valmari, 1996).
Behavior
Trees (BT) often provide more readable, scalable, modular, and reactive structures than HFSMs and
NNs (Colledanchise & ¨ Ogren, 2017).
Duarte et al.
(2016) evolved swarm behaviors for physical robots and demonstrated scalability, flexibility, and resilience; results were shown for swarm-level dispersion, homing, clustering, and monitoring.
GE and state machine-type controllers have been combined to evolve swarm behaviors (Neupane et al., 2018; Neupane & Goodrich, 2019a; Ferrante et al., 2013).
Even though GE exploits prior knowledge in the form of grammars to learn better solutions much faster than conventional genetic programs (O’Neill & Ryan, 2001), results depend on the design of ad hoc reward structures.
The lateral genetic transfer of controllers in BeTr -GEESE is bio-inspired.
Prior work claims that complex behaviors rarely evolve solely from crossover and mutation alone but require endosymbiosis or horizontal transfer (Jablonka & Lamb, 2014; Lane, 2015; Quammen, 2018).
With the horizontal transfer, evolving single agents with sparse and delayed reward is more computationally efficient than evolving complex controllers (Lee, 1999; Engebr˚aten et al., 2018).
PPA structures have been widely used (Fikes & Nilsson, 1971; Knoblock, 1995).
Sprague et al.
(2018) used PPA structures to construct a modular, versatile, and robust control architecture for mission-critical autonomous underwater vehicles.
The PPA structure ensured that the execution of
BT followed goal fulfillment priorities.
Colledanchise et al.
(2019) introduced a standard backward chaining algorithm to create a PPA structure automatically, and showed that the structure could skip actions that were already executed and only plan when the postconditions were not satisfied.
¨Ogren (2020) proved convergence guarantees for a particular PPA-BT structure, and Parashar et al.
(2021) presented a PPA layered strategy to transform a mission into decomposable tasks.
BT-based collective behaviors have been used in non-evolutionary-based optimization.
Kucking et al.
(2018) used BTs to perform foraging and aggregation.
Kuckling et al.
(2021) extended that work with a set of behavioral modules within a predefined BT structure.
The algorithm optimized swarm behaviors for foraging and marker aggregation tasks when agents could communicate.
GEESE-BT O VERVIEW
GEESE (Neupane et al., 2018) and GEESE-BT (Neupane & Goodrich, 2019b) are multi-agent grammatical evolution (GE) algorithms that are similar to standard GE in terms of initialization, genetic operators, and genotype-to-phenotype mapping.
Each agent is initialized with a fixed-length array of integers called the genome.
Each element in the genome is called a codon, and the integer value associated with each codon is the codon value.
The conversion of the genome to a program with the help of Backus-Naur form (BNF) grammar is the genotype-to-phenotype mapping.
The max-treedepth parameter controls the number of unexpanded non-terminals in the current parse tree.
GEESE agents uses three evolution steps: sense , act , and update .
During the sense phase, agents exchange genome information with any (nearby) agents in the field of view.
The willingness to transfer their gene is controlled by the INTERACTION PROB parameter.
During the act phase, an agent queries its storage pool to determine whether the pool size exceeds STORAGE THRESHOLD parameter.
Higher thresholds indicate that interactions with more agents are needed before evolving.
Like prior GE work O’Neill & Ryan (2001), if the threshold is exceeded, agents apply genetic operations to the gene pool in the order: a) selection, b) crossover, and c) mutation.
Selection samples a subset of genotypes based on the fitness value to form a new population.
Crossover combines two genomes to produce a new genome.
Mutation randomly flips the bits of the genome.
During the update phase, an agent replaces its current genotype with a new genotype if there is a new genotype with higher fitness.
Each evolution/learning time-step, all agents sense, act, and update.
[Table]
GEESE-BT (Neupane & Goodrich, 2019b) replaced the state-machine controllers in GEESE with
Behavior Trees (BT).
Paraphrasing Neupane & Goodrich (2019b) for context, a BT is a directed rooted tree with internal control flow nodes and leaf execution nodes (Colledanchise & ¨Ogren, 2018).
BT execution starts at the root node by generating ticks at a fixed frequency.
After each tick, a node returns running , meaning that processing is ongoing, success , meaning that the node’s objective is achieved, or failure , meaning neither running nor success.
Control nodes include selectors , which act as logical or , parallel and sequence nodes, which act as logical and , and condition nodes, which act as logical if .
B E T R -GEESE
BeTr-GEESE shares the core evolutionary stages (sense, act, and update) and genetic operations as
GEESE and GEEST-BT, but has three significant improvements: a) PPA-based primitive behaviors, b) PPA-style BNF grammars, and c) a BT-induced fitness function.
Since each of these changes impact swarm performance, each is experimentally evaluated in Sections 4.4-4.6, respectively.
BeTrGEESE uses the same parameters as GEESE-BT (Table 1) to ensure unbiased comparison.
4. A GENT L IFECYCLE
The BeTr-GEESE algorithm runs for a particular number of steps, which is defined before the start of the simulation 1 .
n agents are initialized in a grid environment as described in Section 4.2, and a random genome of length 100 is created.
The genome is transformed to a BT controller by the genotype-to-phenotype mapping process using the swarm BNF grammar described in appendix B.
Each agent interacts with the environment using the BT controllers and updates its fitness value using diversity fitness and an overall fitness function A t described in Section 4.6.
( Diversity fitness is the total number of unique behaviors nodes divided by the total behaviors defined in the grammar.)
Then the agents independently perform the sense, act, and update methods described in Section 3.
4. S IMULATION P ARAMETERS
A 100x100 grid environment was used with a hub of radius ten at the origin.
The population hadlearning agents.
Agents moved with speed of 2 units per time step.
Task performance is measured in terms of food or debris moved at the end of 12,000 learning steps.
12,000 learning steps was adopted from GEESE-BT (Neupane & Goodrich, 2019b), and from empirical analysis it was observed that for all three task reported in GEESE-BT obtained best performance when the simulation was run for at least 12,000 steps.
The swarm simulation environment was created using the Mesa agent-based modeling framework (Kazil et al., 2020).
The simulator lacks the high fidelity physic engine, making it faster to run experiments with a large number of agents but greatly simplifies the robot-environment interactions.
BT controllers for the agents were created using Behavior Tree framework py trees (Stonier & Staniaszek, 2021) and PonyGE2 (Fenton et al., 2017) was used to implement the Grammatical
Evolution algorithms GEESE, GEESE-BT, and BeTr-GEESE.
All experiments were performed on a machine with an i9 CPU, 64 GB RAM running 16 parallel threads.
4. E VALUATION M ETRICS
BeTr -GEESE is evaluated using two swarm tasks, Foraging and Nest Maintenance .
The Foraging task requires agents to retrieve food from a source to a hub.
A single foraging site of radius ten with multiple “food” objects is randomly placed at 30 units from the hub.
The total food units is set to equal agent population.
Task performance is the percentage of food at the hub.
The Nest Maintenance task requires agents to move debris near the hub to a place outside a fixed boundary.
Multiple “debris” objects are placed within ten units radius of the hub.
The desired boundary is set at 30 units radius away from the origin.
The total debris units at the hub is equal to the agent population.
Task performance is the percentage of debris that is outside the boundary.
The simulation is labelled learning when the agents are evolving controllers where the behaviors of the agent changes with time.
The simulation is labelled test when the agent controllers from a learning simulation are transferred to a new simulation environment and the agents controllers remains static and do not evolve.
For all the experiments reported in this paper, test simulation does not differ drastically but only in the positions of sites and obstacles placed randomly at the runtime.
Foraging is deemed successful if more than 80% food is collected, and nest maintenance is successful if more than 80% debris is removed.
Success rate is defined as the ratio of the number of successful trials to the total number of simulations.
Learning efficiency is defined as foraging or maintenance percentage at the end of a learning simulation.
4. A DDING PPA TO P RIMITIVE B EHAVIORS
Figure 1(a) illustrates a standard Postcondition-Precondition-Action (PPA) Behavior Tree (BT), which is defined as a BT where the selector root node (“ ? ”) ensures that the action node on its right branch of the sequence control node ( → ) is not carried out if the postcondition node is already satisfied Colledanchise & ¨Ogren (2018).
Figure 1(c) illustrates how GEESE-BT requires a precondition ( IsCarryable ) to be satisfied and the task ( Carry ) successfully performed.
The and operator is implemented as a sequence BT node ( → ).
BeTr -GEESE uses the PPA structure in Figure 1(a) for
BeTr implementing all primitive behaviors (PB) described in appendix A. For illustration, CompositeSingleCarry PB is shown in Figure 1(b).
The root selector node (represented as the “ ? ”) checks the postcondition (left branch, AlreadyCarrying ) and calls the sequence node in the right child only if the postcondition is not met.
The right child checks preconditions and implements the action.
The postcondition ensures that the planner does not need to re-execute when the goal has been met.
The green and blue boxes in Figures 2a-2b compare learning efficiency (over a range of fitness function conditions, described below) between the GEESE-BT primitive behaviors (PB) and the PPAbased primitive behaviors (BeTr -PB) for the two tasks.
The PPA structure improves performance across all fitness function conditions and for both tasks.
[Figure]
4. A DDING PPA TO THE G RAMMAR
Appendix B presents the grammar used by BeTr -GEESE, which is modified from the GEEST-BT grammar to use the PPA structure.
The blue and yellow boxes in the leftmost and middle groups of
Figures 2a-2b both use PPA-based PBs, but the yellow boxes use PPA-based grammars, respectively.
Changing the grammar to use PPA structures further improves learning efficiency for both tasks.
4. R EPLACING AD HOC F ITNESS WITH BT S TATUS
Essential Fitness Elements.
There are various choices of the fitness function in evolutionary robotics based on the type of controllers and amount of priory task knowledge the designer has (Nelson et al., 2009).
GE requires a diverse genetic population, and both foraging and nest maintenance require exploring the world.
Thus, two fitness elements are required: diversity (type I) and exploration (type II).
The phenotype is an agent program learned from the grammar.
For
GEESE-BT and BeTr -GEESE, the program is a behavior tree.
Diversity fitness is denoted by
D : { Phenotypes } → R , promotes diversity in the genotype, and is defined as the total number of unique behavior nodes in the BT divided by the total possible behaviors defined in the grammar.
Exploration fitness is denoted by E : { Locations } −→ R , promotes visiting new locations, and is defined as the number of unique world locations visited by the agent.
Ad hoc Fitness Elements.
GEESE-BT uses ad hoc fitness functions.
Prospective fitness (type III) rewards “intrinsic” actions like picking up, carrying, or dropping objects.
Task-specific fitness (type
IV) uses hand-tuned fitness functions designed to reward collective actions: total food at the hub and the total debris away from the hub, respectively.
BT Feedback Fitness.
The BT feedback fitness (type V) is denoted by B : { BehaviorTreeStatus } −→ R and is defined as the sum of potstcondition, constraint, and selector node rewards.
When a postcondition node status is success , a subjectively chosen reward of +1 indicates that some potentially useful condition in the world holds.
A subjectively chosen reward of − 2 occurs when a constraint node status is failure .
A subjectively chosen reward of + is returned when the root selector node status success, indicating that some sub-task has been accomplished somewhere in the BT.
Based on Nelson et al.
(2009), BT feedback (type V) incorporates a low level of prior knowledge, whereas ad hoc fitness (type III & type IV) incorporates high or excessive prior knowledge.
BT feedback is superior to ad hoc fitness because it requires less prior knowledge, is general for all swarm tasks, and remains the same while the task changes.
Blending Fitness Types.
GEESE-BT blends types I–IV to produce overall fitness.
Since types III and IV are ad hoc, overall fitness is ad hoc.
By contrast, BeTr -GEESE rewards behaviors that promote genetic diversity, promote world exploration, observe or accomplish subtasks, or avoid constraint violations.
Let A t denote an agent’s fitness, defined as the exponential blend A t =
β ( A t − 1 ) + ( E t + B t ) , with β empirically set to
Historical blending temporal sparsity diversity, exploration,
Fitness Results.
The leftmost and middle group in Figures 2a-2b use only diversity or diversity plus exploration fitness.
Performance improves with exploration fitness.
The rightmost group in the figures uses diversity, exploration, and the ad hoc fitness for GEESE-BT (green) and for GEESE with PPA structures (blue).
The yellow box in the rightmost group uses diversity and exploration, and replaces the ad hoc and hand-tuned rewards with BT status.
The rightmost group shows that replacing ad hoc fitness with BT status yields substantial improvement.
Out of 64 simulation runs,
BeTr-GEESE succeed 75% of the time, whereas GEESE-BT succeeded only 9.3%.
P ERFORMANCE OF F IXED P ROGRAMS
BeTr -GEESE agents succeed while evolving, but they perform poorly once evolution stops (fixed agents).
This section presents results for various mixtures of 100 fixed agents.
5. H OMOGENEOUS P OPULATIONS OF B EST -P ERFORMING A GENTS
Create a homogeneous population by selecting the fittest agent at the end of the evolution and forming a population with 100 copies of that agent.
Homogeneous populations of evolved BeTr -GEESE and GEESE-BT agents fail on both tasks.
The performance of homogeneous populations is poor because of the types of programs evolved.
The foraging task requires at least four PPA sub-trees: explore the environment and find the site, carry the food, bring the food back to the hub, and drop the food at the hub.
Among 100 independent evolution experiments, 3235 different BeTr -GEESE programs were evolved, 97.8% had just one PPA sub-tree, and 2% had two PPA sub-trees.
These static programs are not capable of solving the problem by themselves.
By contrast, GEESE-BT more frequently produced agents with all four necessary subtrees but still failed, indicating heterogeneous controllers are needed.
5. H ETEROGENEOUS P OPULATIONS OF H IGH -P ERFORMING A GENTS
The fitness of an individual agent can be deceiving because the agent might be fit only when other agents in a heterogeneous population are performing necessary supporting tasks (Page, 2010).
Create a heterogeneous population by sorting the agents at the end of evolution by their fitness value, identifying the top n% of the agents, and then cloning those agents to create 100 agents.
As with the homogeneous agents, the performance of a heterogeneous population of BeTr -GEESE agents was terrible; less than 1% of the food available is brought to the hub so the results are not shown in the figure.
Each agent is capable of only doing one subtask, and that means that agents cannot both pick up and drop objects.
By contrast, Figure 3 shows that heterogenous blends of GEESEBT agents often succeed, especially on the nest-maintenance task, precisely because they can learn more complicated programs.
However, as more types of agents are added to the population, interference occurs, presumably because less fit agents perform only partial tasks and thus prevent top-performing agents from fully performing all tasks.
5. H ETEROGENEOUS P OPULATIONS OF B LENDED A GENTS
The better performance of the more complicated GEESE-BT programs suggests a way to blend the modular BeTr -GEESE programs so that they are more complicated as follows.
First, sort agents most fit to least fit.
Second, select the top n % of the agents.
Each of these agents typically has a BT that performs only one subtask.
Third, or these agents together by forming a root BT node with a parallel node and then adding agents as children to this root node.
The parallel control node was chosen as it loosely acts as a logical or , meaning that the blended agent allows its modular BeTr -GEESE programs (sub-trees) to contribute to the behavior of the agent.
For each agent, the order of the sub-trees is randomized so that different agents try execute subtasks in different orders.
Figure 3 shows performance of heterogeneous populations of BeTr -GEESE agents formed using this blended approach.
Heterogeneous populations of blended GEESE-BT agents are not shown because they perform no better than the heterogeneous populations formed in Section 5.2.
The performance of blended BeTr -GEESE populations slowly increases and peaks at 50% and then decreases gradually for both tasks.
Blending works precisely because the resulting agents capture pieces of agents capable of successfully performing needed subtasks.
C ONCLUSION AND F UTURE W ORK
The PPA-structures used in BeTr -GEESE cause agents to learn simple programs capable of performing required subtasks.
The evolving population of BeTr -GEESE agents succeeds because mutation, crossover, and lateral transfer cause the agents to change between simple programs while learning, effectually “time-multiplexing” between the simple programs.
Subjective observations of animations of the evolution reveal a type of time-multiplexing that allows agents to adapt to different circumstances in their learning environment, effectually negating the need to rely on static strategies.
GEESE-BT’s success while learning is low because it is difficult to learn complicated programs even with the ad hoc reward structures designed to promote efficient learning.
Heterogeneous populations of fixed BeTr -GEESE agents perform poorly because each agent learns only a portion of the entire task.
The success of the heterogeneous population can be improved by blending the simple agents together, but performance is still not satisfactory.
Future work should explore BeTr -GEESE agents could rapidly adapt to changing conditions, provided that the grammar has a sufficiently rich set of execution nodes and primitive behaviors.
Additionally, future work should explore genetic algorithm hyper-parameter settings that might enable
BeTr -GEESE to evolve complex, resilient behaviors more efficiently.
A P RIMITIVE B EHAVIORS
The CompositeDrop behavior enables agent to drop the item it is currently carrying at the current location, and the CompositeSingleCarry allows an agent to pickup an object at its current location.
The MoveTowards primitive behavior allows the agent to move a unit step towards a particular object in the environment, and MoveAway moves the agent a unit step away from an object.
Explore moves the agent a unit step in a random direction.
Obstacle avoidance in MoveTowards , MoveAway , and
Explore use the simple bug following algorithm from Lumelsky & Stepanov (1987), which checks for obstacles or traps in its line-of-sight.
If an object is detected, the agent moves one unit distance parallel to the object’s surface.
B PPA G RAMMAR
[Equation] [Equation]
[Equation] [Equation]
postconditions
[Equation]
postcondition
[Equation]
[Equation] [Equation]
⟨ postcondition
[Equation] [Equation]
postconditiont
[Equation] [Equation]
PostCnd
[Equation]
[PostCnd
[Equation]
postconditiont
[Equation] [Equation]
PostCnd]
[Equation] [Equation]
postconditiont
[Equation]
NeighbourObjects
[Equation]
NeighbourObjects
[Equation]
sobjects
[Equation]
IsCarrying ⟨ dobjects ⟩
NeighbourObjects
[Equation]
dobjects ⟩| DidAvoidedObj ⟨ sobjects ⟩| IsVisitedBefore ⟨ sobjects ⟩
[Equation]
⟨ ppasequence
[Equation]
::=
[Sequence] ⟨ preconditions ⟩ [Act] ⟨ action ⟩ [/Act][/Sequence] | [Sequence] ⟨ constraints ⟩ [Act] ⟨ action ⟩ [/Act][/Sequence] | [Sequence] ⟨ preconditions ⟩⟨ constraints ⟩ [Act] ⟨ action ⟩ [/Act][/Sequence] (9) ⟨ preconditions ⟩ ::=
[Sequence] ⟨ precondition ⟩ [/Sequence] (10) ⟨ precondition ⟩ ::= ⟨ precondition ⟩ [PreCnd] ⟨ preconditiont ⟩ [/PreCnd] | [PreCnd] ⟨ preconditiont ⟩ [/PreCnd] (11) ⟨ preconditiont ⟩ ::=
IsDropable ⟨ sobjects ⟩| NeighbourObjects ⟨ objects ⟩| IsVisitedBefore ⟨ sobjects ⟩|
NeighbourObjects ⟨ objects ⟩ invert | IsVisitedBefore ⟨ sobjects ⟩ invert |
IsCarrying ⟨ dobjects ⟩|
IsCarrying ⟨ dobjects ⟩ invert (12) ⟨ constraints ⟩ ::
=
[Sequence] ⟨ constraint ⟩ [/Sequence] (13) ⟨ constraint ⟩ ::= ⟨ constraint ⟩ [Cnstr] ⟨ constraintt ⟩ [/Cnstr] | [Cnstr] ⟨ constraintt ⟩ [/Cnstr] (14) ⟨ constraintt ⟩ ::=
CanMove | IsCarryable ⟨ dobjects ⟩| IsDropable ⟨ sobjects ⟩ (15) ⟨ action ⟩ ::= MoveTowards ⟨ sobjects ⟩| Explore |
CompositeSingleCarry ⟨ dobjects ⟩| CompositeDrop ⟨ dobjects ⟩| MoveAway ⟨ sobjects ⟩ (16) ⟨ objects ⟩ ::= ⟨ sobjects ⟩|⟨ dobjects ⟩ (17) ⟨ sobjects ⟩ ::
=
Hub | Sites (18) ⟨ dobjects ⟩ ::=
Food | Debris (19) ⟨ SuccessNode ⟩ :: =
[PostCnd]DummyNode[/PostCnd]
Productions 1–4 define control nodes as part of a hierarchical set of PPA-structured sub-trees.
Productions 5–7 define postconditions, which can be dummy nodes, an embedded PPA sub-tree, or condition nodes.
Production rule 19, the DummyNode , is a condition node that always returns Success.
Production 8 defines the right sub-tree of a PPA structure that sequentially combined preconditions and actions.
Productions 9–11, define preconditions using condition nodes.
Productions 12–14, define constraints using condition nodes.
Production 15 calls the BT-based subtrees in which the primitive behaviors of the agent are defined.
Productions 16–18 define static elements in the swarm environment, specifically a hub, and sites, all of which have fixed sizes.
Production 18 defines movable objects, food and debris, in the environment.
A hub is where agents originate, a site is a source of food for the agents, food is an object to be carred to the hub, and debris is an object to be removed from the hub.
All execution nodes have self-explanatory names.