%%alias
Aliased from [Behavior Trees|BehaviorTrees]
%%

From the description of __[Behaviour Trees]__ on [BehaviorTree.CPP||https://www.behaviortree.dev/]:
%%blockquote
A Behavior Tree (__BT__) is a way to structure the switching between different 
tasks in an autonomous agent, such as a robot or a virtual entity in a computer game.

BTs are a very efficient way of creating complex systems that are both modular and reactive. 
These properties are crucial in many applications, which has led to the spread 
of BT from computer game programming to many branches of AI and Robotics. 
%%

From the description of __[Behaviour Trees]__ on Wikipedia:
%%blockquote
A __behavior tree__ is a [mathematical model|https://en.wikipedia.org/wiki/Mathematical_model]  of  [plan|https://en.wikipedia.org/wiki/Automated_planning_and_scheduling]  execution used in  [computer science|https://en.wikipedia.org/wiki/Computer_science] ,  [robotics|https://en.wikipedia.org/wiki/Robotics] ,  [control systems|https://en.wikipedia.org/wiki/Control_systems]  and  [video games|https://en.wikipedia.org/wiki/Artificial_intelligence_(video_games)]. They describe switchings between a finite set of tasks in a modular 
fashion. Their strength comes from their ability to create very complex tasks composed of simple tasks, without worrying how the simple tasks are implemented. Behavior trees present some similarities to  [hierarchical state machines|https://en.wikipedia.org/wiki/State_machine] 
 with the key difference that the main building block of a behavior is a
 task rather than a state. Its ease of human understanding make behavior
 trees less error prone and very popular in the game developer 
community. Behavior trees have been shown to generalize several other 
control architectures. Mathematically, they are  [directed acyclic graphs|https://en.wikipedia.org/wiki/Directed_acyclic_graph] .
%%


!! Code

* [Behavior Trees|https://gitlab.com/robot-libraries/behaviortrees] by Rud Merriam (C++)
**  [BehaviorTree|https://gitlab.com/robot-libraries/behaviortrees/behaviortree] \\%%(font-size:small) "The Behavior Tree code uses a logging library of my own which isn't in a repo. I think if you globally replace ''mys::tout'' with ''std::cout'' and remove the ''#include <Trace.h> ''references it will compile." %%
**  [BT Test|https://gitlab.com/robot-libraries/behaviortrees/bt-test] (requires a C++ unit testing library, TUT, that isn't widely available)


!! References

* [Behavior tree (artificial intelligence, robotics and control)|https://en.wikipedia.org/wiki/Behavior_tree_(artificial_intelligence,_robotics_and_control)] on Wikipedia
* ''[Behavior trees for AI: How they work|https://www.gamedeveloper.com/programming/behavior-trees-for-ai-how-they-work]'' \\  ''An introduction to Behavior Trees, with examples and in-depth descriptions, as well as some tips on creating powerful expressive trees''. by Chris Simpson
* ''[Designing AI Agents’ Behaviors with Behavior Trees|https://towardsdatascience.com/designing-ai-agents-behaviors-with-behavior-trees-b28aa1c3cf8a]: Designing and Implementing Behaviors for AI Agents'', Debby Nirwan
* [Behavior Tree Engine|https://github.com/ToyotaResearchInstitute/task_behavior_engine] (in Python) on github
* [How Behavior Trees Modularize Hybrid ControlSystems and Generalize Sequential BehaviorCompositions, the Subsumption Architecture, and Decision Trees|https://www.researchgate.net/publication/309616544_How_Behavior_Trees_Modularize_Hybrid_Control_Systems_and_Generalize_Sequential_Behavior_Compositions_the_Subsumption_Architecture_and_Decision_Trees], Michele Colledanchise and Petter &Ouml;gren (PDF)
* [BehaviorTree.CPP|https://www.behaviortree.dev/], a __C++__ library that provides a framework to create BehaviorTrees. The site includes a descripton of BTs, Getting Started pages as well as a tutorial
* [PyTrees|https://py-trees.readthedocs.io/en/devel/index.html], a Python Behaviour Tree library
* [Awesome Behavior Trees|https://github.com/BehaviorTree/awesome-behavior-trees], some resources on BTs on github

----

[{Tag Robots BehaviourBasedSystems}]