This README will guide you to generate the results presented in the paper Learning Behavior Trees from Planning Experts Using Decision Tree and Logic Factorization. This repository is the so called SETUPI in the paper.
- Install python3.8 and R
- Install GraphViz
- (Optional) create a python3 virtual environment and activate it
- Install packages in python
pip install pydot pyyaml matplotlib celluloid sympy wheel pandas sklearn graphviz networkx pyeda
If you have troubles installing pyeda in windows, we provide the wheel file. Run the commandpip install pyeda-0.28.0-cp38-cp38-win_amd64.whl
If you want to visualize the tree (more instruction later) runpip install IPython
- Install packages in R
install.packages('C50')
Check the settings and change them so the output will be saved in the top level directory
Open a terminal in the top level directory. Note that these steps are sequential and they need to be run in order. If you would like to skip one step, in the output
folder we provide the files (created during the steps) that are needed to run the following steps. Copy paste the file in the right directory and run the next step
-
(Optional) If you want to visualize the manually defined initial BT run the notebook
show_BT.ipynb
This notebook can be used to easily visualize any BT given its definition (string). -
To create the simulation data copy paste in the terminal:
python run_simulations.py
Expected output:ExecutedTraces.csv
in the top level directory -
To learn the rules run the script
c50.R
in R Expected output:c50-rules.txt
in the top level directory -
-
To convert the rules into the BT using BT-Factor copy paste in the terminal:
python BT-Factor.py
Expected output: BTFactor folder in the top level directory with 3behavior_tree
files (.dot
,.png
,.svg
) and theBT.py
file. The BT (string form) will be printed in the terminal -
To convert the rules into the BT using BT-Factor without Horn Clauses change the
defaul_action_and_horn_clauses
variable (defined at line 19 ofBT-Factor.py
) toFalse
, save and copy paste in the terminal:python BT-Factor.py
Expected output: BTFactor_DNF folder in the top level directory with 3behavior_tree
files (.dot
,.png
,.svg
) and theBT.py
file. The BT (string form) will be printed in the terminal
-
-
To One-Hot-Encoding the executed traces and thus creating the input for RE:BT-Espresso copy paste in the terminal:
python hotencode.py
Expected output:ExecutedTracesOneHot.csv
-
To run RE:BT-Espresso copy paste in the terminal:
python RE-BT-Espresso.py
Note that we already provide the pruning values (line 578 ofRE-BT-Espresso.py
) generated by using the minimal cost-complexity pruning (Wathieu et all. 2022). If you want to run with different pruning values comment line line 578 ofRE-BT-Espresso.py
Expected output: REBTEspresso folder in the top level directory with 3
behavior_tree
files (.dot
,.png
,.svg
), and 3python
files (BT.py
,alpha.py
,possible_to_improve.py
). The BTs (string form) will be printed in the terminal -
To run 200 simulations, copy paste in the terminal
python run_experiments.py
Expected output:performance-correctness.csv
in the \results directory -
To compute the results copy paste in the terminal:
python evaluation.py
Expected output: results printed in the terminal -
To compute the GED results presented in Table 4 copy paste in the terminal:
python GED-Calculation.py
Expected output: ```GED.txt `` in the \results directory