How to Use NetLogo_Console with BehaviorSpace and xml files - Examples and tips

81 views
Skip to first unread message

Aaron Andre Brandes

unread,
Mar 22, 2023, 9:22:53 PM3/22/23
to netlog...@googlegroups.com

Hi NetLogo Users,

Since the introduction of NetLogo 6.3.0 we have received many questions concerning the use of NetLogo_Console, BehaviorSpace output files, BehaviorSpace xml experiments, and whether BehaviorSpace experiments can have a less than combinatorial set of variable values. Much of this information is mentioned in the documentation, but it seems to me folks could benefit from a more extensive set of examples for MacOS, Linux and Windows. This email is my response, which wound up being much lengthier than I originally intended. A zip file is attached that contains a copy of the contents of this email, as well as scripts and xml files for use with the examples. Feedback is welcome. If you have improvements to share, please address the whole group. I would particularly welcome Windows versions of the Linux/MacOS scripts as well as methods for running scripts in parallel on Windows.

Thanks,

Aaron

 

 

NetLogo_Console with BehaviorSpace and xml files

 

Introduction

This document expands the content of the on-line documentation for running Behaviorspace experiments specified by xml files from the command line. The first section focusses on running a single experiment. The second section explains how to run multiple small experiments to explore a combination of variable values that is not complete. The zip file bspace-experiments.zip contains scripts and xml files referenced here. Their text is also included in an appendix to this document.

 

Running a BehaviorSpace xml experiment from the command line in MacOS, Linux and Windows.

 

 

In NetLogo 6.3.0 the preferred way run experiments is with NetLogo_Console which should be run from the directory in which it is located.

 

This section addresses

  • Locating and running NetLogo_Console in different platforms
  • Output options
  • Threads
  • Creating a BehaviorSpace xml experiment
  • Using a NetLogo earlier than 6.3.0

 

Locating and running NetLogo_Console on different platforms

 

These examples assume the user has extracted the zip file bspace-experiments.zip to the appropriate location, which is $HOME for MacOS and Linux and %USERPROFILE%\Documents for Windows, or created the files using the information at the end of this file.

 

MacOS example

  • Table output goes to the terminal because the value “-“ is used.
  • When looking at the output notice that the run numbers (first column of the output) are in ascending order. This is because only one thread is used.

 

 

cd /Applications/NetLogo\ 6.3.0

./NetLogo_Console --headless \

  --model "models/Sample Models/Earth Science/Fire.nlogo" \

  --setup-file ~/bspace-experiments/fire-setups.xml \

  --experiment experiment3 \

  --threads 1 \

  --table -

 

Linux example

  • Table output goes to the terminal Output goes to terminal
  • Note that if you don't specify the number of threads NetLogo will set it to the number of logical CPUs. With a large model it is usually more efficient to use no more than half the CPUs.
  • Multiple threads are used in this example. Since table results are written as soon as they are computed, and threads need not complete in order the run numbers may not be in ascending order.
  • Note that this experiment does not exist in the models library. The xml file is contained in the zip file.

 

# For Linux the NetLogo directory depends on where you installed it.

NL_INSTALL_DIR="$HOME/NetLogo" # Replace with your NetLogo installation directory

NL_DIR="$NL_INSTALL_DIR/NetLogo 6.3.0/lib/app"

cd "$NL_DIR"

./NetLogo_Console --headless \

  --model "models/Sample Models/Biology/Flocking.nlogo" \

  --setup-file ~/bspace-experiments/flocking-setups.xml \

  --experiment flock-basic \

  --table -

 

Steps to create your own BehaviorSpace xml file

  1. Open your model of interest. If it comes from the NetLogo models library copy it to a directory you can write to.
  2. Create an experiment.
  3. Save the model.
  4. Create a new file with a name ending with .xml.
  5. Add the following two header lines:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE experiments SYSTEM "behaviorspace.dtd">

  1. Open the model's .nlogo file with an editor.

7)  Locate and copy the xml that begins with <experiments> and ends with </experiments> (It occurs towards the end of the .nlogo file.)

  1. Paste those lines into the .xml file after the two header lines.

 

Specifying output files

  • By default, output files are written to the directory in which NetLogo_Console is
  • run, so you probably want to specify the full path to your output file.
  • In these examples both a table and a spreadsheet are output. The spreadsheet output is written after all runs complete and requires BehaviorSpace to use more memory.
  • If your experiment fails before completion table output, which is written as the experiment progresses, can be useful for determining the parameters that were being executed.

 

MacOS or Linux

One way to specify the output directory in MacOS or Linux is to create a shell variable such as $OUTDIR. Be sure the directory exists before running NetLogo_Console.

 

OUTDIR=$HOME/bspace-results

mkdir -p $OUTDIR # Creates directory if necessary, doesn’t fail if it already exists

./NetLogo_Console --headless \

  --model "models/IABM Textbook/chapter 4/Wolf Sheep Simple 5.nlogo" \

  --setup-file "$HOME/bspace-experiments/my-wsp-setups.xml" \

  --experiment "My WSP Exploration" \

  --threads 5 \

  --table "$OUTDIR/wolf-sheep-table.csv" \

  --spreadsheet "$OUTDIR/wolf-sheep-spreadsheet.csv"

 

Windows

In this example the output directory %USERPROFILE%\Documents\bspace-output must be created. The xml file is in the directory %USERPROFILE%\Documents\bspace-experiments

If you know how to create the output directory only if it doesn't exist, please share the code. Other enhancements, such as more use of variables etc, as well as comments on this document are welcome.

 

mkdir  %USERPROFILE%\Documents\bspace-output

 

cd "C:\Program Files\NetLogo 6.3.0"

 

If you are running 32 bit NetLogo on a 64 bit Windows machine

cd "C:\Program Files (x86)\NetLogo 6.3.0"

 

NetLogo_Console --headless ^

  --model "models\IABM Textbook\chapter 4\Wolf Sheep Simple 5.nlogo" ^

  --setup-file "%USERPROFILE%\Documents\bspace-experiments\my-wsp-setups.xml" ^

  --experiment "My WSP Exploration" ^

  --threads 5 ^

  --table "%USERPROFILE%\Documents\bspace-output\wolf-sheep-table.csv" ^

  --spreadsheet "%USERPROFILE%\Documents\bspace-output\wolf-sheep-spreadsheet.csv"

 

Using a NetLogo earlier than 6.3.0

We recommend using NetLogo 6.3.0 unless you need an earlier version for compatibility with some other software. Downloads are here.

 

For earlier versions use the netlogo-headless script. The appropriate Java must be installed and the system variables JAVA_HOME and PATH must be properly set.

 

For MacOS or Linux

In the examples replace the line

./NetLogo_Console --headless \

with

./netlogo-headless.sh \

and cd to the directory containing the script, updating the location of the model if necessary.

 

For Windows

Replace the line

NetLogo_Console --headless ^

with

netlogo-headless.bat ^

and cd to the directory containing the script, updating the location of the model if necessary.

 

Collecting non-combinatorial data for a NetLogo BehaviorSpace experiment using xml from command line.

 

Introduction

Currently BehaviorSpace can only perform experiments with a full set of combinations of all the values each variable can take on. If one variable takes on 5 values, another 4 values and a third 6 values there are 120 combinations, each of which may have repetitions. At times however, NetLogo users want to use a more limited set of parameters, especially if runs are time consuming. The Design of Experiments (DOE) provides methodologies, such as the use of orthogonal matrices that aims to collect data that will be of maximal use in an ANOVA (analysis of variance) with fewer than the full set of combinations. Sensitivity analysis is another use case.

 

There are some applications that call NetLogo from R or python that may have this capability, although to my knowledge they are either no longer being maintained, or have not yet been updated to use NetLogo 6.3.0.

 

 

Running multiple BehaviorSpace experiments contained in a single xml file

 

A way to work around this limitation of NetLogo is to include each desired set of variables as an experiment, and then use NetLogo_Console to run each of the experiments.  The approach of running a single set (or small set of variables) per run can also be useful when doing cluster computing if there are not sufficient resources (such as time duration) to allow all the runs in one submitted job.

 

The xml experiment file

The following example makes use of the file wsp-experiments.xml. This file is contained in zip file bspace-experiments.zip which you may have already extracted the to the appropriate location, which is for MacOS and Linux and %USERPROFILE%\Documents for Windows. (You can also create it from the text in the appendix.)

 

The file wsp-experiments.xml was created by repeating the text of the single experiment in my-wsp-setups.xml three times and editing one or more of the variable values. In this case the variations are not particularly meaningful. I would appreciate it if anyone can share a meaningful example that illustrates the use of DOE or sensitivity analysis.

 

MacOS or Linux

Multiple experiments in MacOS or Linux can be run using the script do-multi-bspace-expts.sh that allows users to run is attached, and also included at the end of this file. The basic idea is that the model name, experiment xml file, output directory are provided, and that each experiment's name is given by a provided prefix plus an experiement number. A prefix for the name of the output table works in the same way. At its core the script iterates over the following for every experiment number.

 

# Run experiment i

    ./NetLogo_Console --headless \

      --model "$MODEL_NAME" \

      --setup-file "$EXP_XML_FILE" \

      --experiment "$EXP_PREFIX${i}" \

      --table "$OUT_DIR/$OUT_FILE_PREFIX${i}.csv"

 

All of the arguments except the experiment number are currently hard-coded, and can easily be replaced. If you are familiar with the shell built-in getopts (tutorial), it would be straight forward to set up script input options such as -m (or –model) etc. Please share if you have time to do this. Note – I have tested the examples on Windows 10 and a MacOS system with bash 5.2 in the terminal (installed using the packager homebrew which is useful for making the MacOS terminal behave more like Linux.) The scripts were also tested on MacOS.

 

Windows

If you can create a script to accomplish what the previous script does, please share it.

 

For this example the xml file should be in directory %USERPROFILE%\Documents\bspace-experiments and the output files require a directory %USERPROFILE%\Documents\bspace-output to exist

 

 

cd "C:\Program Files\NetLogo 6.3.0\app"

or

cd C:\Program Files (x86)\NetLogo 6.3.0\app

 

:: Run experiment 1

echo "Experiment WSP1"

NetLogo_Console --headless ^

  --model "models\IABM Textbook\chapter 4\Wolf Sheep Simple 5.nlogo" ^

  --setup-file "%USERPROFILE%\Documents\bspace-experiments\wsp-experiments.xml" ^

  --experiment "WSP1" ^

  --table "%USERPROFILE%\Documents\bspace-output\wolf-sheep-table-1.csv" ^

  --spreadsheet "%USERPROFILE%\Documents\bspace-output\wolf-sheep-spreadsheet-1.csv"

 

:: Run experiment 2

echo "Experiment WSP2"

NetLogo_Console --headless ^

  --model "models\IABM Textbook\chapter 4\Wolf Sheep Simple 5.nlogo" ^

  --setup-file "%USERPROFILE%\Documents\bspace-experiments\wsp-experiments.xml" ^

  --experiment "WSP2" ^

  --table "%USERPROFILE%\Documents\bspace-output\wolf-sheep-table-2.csv" ^

  --spreadsheet "%USERPROFILE%\Documents\bspace-output\wolf-sheep-spreadsheet-2.csv"

 

:: Run experiment 3

echo "Experiment WSP3"

NetLogo_Console --headless ^

  --model "models\IABM Textbook\chapter 4\Wolf Sheep Simple 5.nlogo" ^

  --setup-file "%USERPROFILE%\Documents\bspace-experiments\wsp-experiments.xml" ^

  --experiment "WSP3" ^

  --table "%USERPROFILE%\Documents\bspace-output\wolf-sheep-table-3.csv" ^

  --spreadsheet "%USERPROFILE%\Documents\bspace-output\wolf-sheep-spreadsheet-3.csv"

 

:: Run experiment 4

echo "Experiment WSP4"

NetLogo_Console --headless ^

  --model "models\IABM Textbook\chapter 4\Wolf Sheep Simple 5.nlogo" ^

  --setup-file "%USERPROFILE%\Documents\bspace-experiments\wsp-experiments.xml" ^

  --experiment "WSP4" ^

  --table "%USERPROFILE%\Documents\bspace-output\wolf-sheep-table-4.csv" ^

  --spreadsheet "%USERPROFILE%\Documents\bspace-output\wolf-sheep-spreadsheet-4.csv"

 

Merging of Table Output Files

Analyzing your data may require merging of table output files. This is another opportunity for users to share their skills.

Here is a Linux command line that keeps the header of the first output file, removes all double quotes, removes the [run number] column and sorts the data numerically.

( head -7 wolf-sheep-experiment-table1.csv | sed -e 's/"//g' -e 's/\[run number\],//' && tail -n +8 -q wolf-sheep-experiment-table*.csv |  sed -e 's/"//g' -e  's/[^,]*,//' | sort -n) > merged-wolf-sheep-experiment-table.csv

 

Performance – runs in parallel

The previous examples run the experiments sequentially. Running some experiments in parallel may improve total execution time.

The solutions offered here apply only to MacOS and Linux, Windows solutions are welcomed.

The script do-indexed-bspace-expt.sh takes as input the experiment number, and runs just that experiment.

 

Run experiments in background

If you are in the directory containing the script you can run multiple experiments in the background, and time them using the following line in the terminal. (For all these examples, the use of  time is not necessary, only use if you care about execution time.)

 

time (./do-indexed-bspace-expt.sh 1 &  ./do-indexed-bspace-expt.sh 2 &  ./do-indexed-bspace-expt.sh 3 &  ./do-indexed-bspace-expt.sh  4 & wait)

One sample result was

 

real 0m59.921s

user 10m44.705s

sys  0m23.451s

 

Note that "real time" corresponds to the actual wall clock time everything takes to complete, "user time" is process-specific CPU time, usually larger than real time when multiple CPUs are used, and that system time is compute time not specific to your process.

 

To time a sequential run try

time (./do-indexed-bspace-expt.sh 1 ;  ./do-indexed-bspace-expt.sh 2 ;  ./do-indexed-bspace-expt.sh 3 ;  ./do-indexed-bspace-expt.sh  4 )

 

I ran each method 5 times and the mean for the first was 64.7 sec compared to 73.8 for the other, for a percent difference of 13.1%.

 

Use xargs -P <n>

xargs -P <n> allows you to run <n> commands in parallel.

  • runs at most <n> commands in parallel at a time,
  • additional commands starting only when a previously launched process terminates.

While -P is a nonstandard option, both the GNU (Linux) and macOS/BSD implementations support it. The advantage of this over the previous approach is that it will work well when the number of experiments exceeds the maximum number of experiments you want to run at once. So <n> is analogous to the value of --threads.

 

Example

time xargs -P 4 -I {} sh -c 'eval "$1"' - {} <<'EOF'

./do-indexed-bspace-expt.sh 1

./do-indexed-bspace-expt.sh 2

./do-indexed-bspace-expt.sh 3

./do-indexed-bspace-expt.sh 4

EOF

 

The construct <<"EOF' begins a here document, which ends with EOF.  See for example: https://tldp.org/LDP/abs/html/here-docs.html.

 

GNU Parallel

I have not tried GNU Parallel http://www.gnu.org/software/parallel/ which offers more sophisticated process handling and can make use of networked computers.

 

One usage is

(echo prog1; echo prog2) | parallel

Which can also be expressed as

parallel ::: prog1 prog2

 

Caveat on Number of simultaneous experiments

Remember that using more CPUs simultaneously is not necessarily better because they can compete for resources. When using BehaviorSpace we recommend not using more threads than half the number of logical CPUs. Similar considerations hold with the methods used above. Of course your mileage may vary.

 

Feedback welcomed

I would appreciate hearing about successful uses of multiple CPUs to reduce computing time, as well as cautionary tales. Please share with the whole netlogo-users group.

 

Appendix

File List

The named files are all in the zip file bspace-experiments.zip.

In addition their contents are included in this appendix

 

Bash scripts to run experiments

do-indexed-bspace-expt.sh

do-multi-bspace-expts.sh

 

xml files for BehaviorSpace experiments

fire-setups.xml

flocking-setups.xml

my-wsp-setups.xml

wsp-experiments.xml

 

List of Models in Models Library containing BehaviorSpace experiments

List-of-NetLogo-Models-with-BehaviorSpace-experiments.txt

 

File Contents

do-indexed-bspace-expt.sh

#!/usr/bin/env bash

 

# Sample script to execute a single experiment from a single xml file

 

# Set VERBOSE=TRUE to get additional output

VERBOSE=""

 

# In this version only the number of the experiment is input.

# The experiment names must have the form experiment_prefixN

# in terms of the variables used in the script this will be

# $EXP_PREFIX${EXPT_NUMBER}

 

if [ $# -ge 1 ]

then

    EXPT_NUMBER="$1"

else

    echo "The input should be the experiment number"

    exit

fi

 

 

# These variables could be passed as arguments

 

# Specify the NetLogo installation directory

# If using Linux, comment out the next executable line, and

# uncomment and update the lines for Linux.

 

#MacOS

NL_DIR="/Applications/NetLogo 6.3.0"

[ TRUE == "$VERBOSE" ] && echo "NetLogo directory: $NL_DIR"

 

#Linux

# For Linux it is relative to whatever your installation directory

# Fill in the appropriate value

# NL_INSTALL_DIR=""

# NL_DIR="$NL_INSTALL_DIR/NetLogo 6.3.0/lib/app"

 

# Specify the absolute model name 

MODEL_NAME="$NL_DIR/models/IABM Textbook/chapter 4/Wolf Sheep Simple 5.nlogo"

[ TRUE == "$VERBOSE" ] && echo "model: $MODEL_NAME"

 

# Specify the xml file containing the experiments

EXP_XML_FILE="$HOME/bspace-experiments/wsp-experiments.xml"

[ TRUE == "$VERBOSE" ] && echo "xml file: $EXP_XML_FILE"

 

# Specify the experiment prefix (to which the experiment number will be added)

EXP_PREFIX="WSP"

[ TRUE == "$VERBOSE" ] && echo "experiment prefix: $EXP_PREFIX"

 

# This script uses the sample file "my-wsp-setups.xml"

# To modify for your own use add an experiment to your model of interest.

# Then copy the xml that appears near the end of the .nlogo file to a new file with the extension .xml.

# You can add multiple copies of the experiment with the desired modifications to the data values, as in my-wsp-setups.xml

 

# Specify an output directory

OUT_DIR="$HOME/bspace-results"

[ TRUE == "$VERBOSE" ] && echo "output directory: $OUT_DIR"

 

# Specify the output file prefix (to which the experiment number and

# the .csv extension will be added)

OUT_FILE_PREFIX="wolf-sheep-experiment-table"

[ TRUE == "$VERBOSE" ] && echo "output file prefix: $OUT_FILE_PREFIX"

 

# create the output directory if needed

mkdir -p $OUT_DIR

 

# save directory so we can switch back to it

SAV_DIR="$(pwd)"

 

cd "$NL_DIR"

[ TRUE == "$VERBOSE" ] && echo "current dir: $(pwd)"

 

[ TRUE == "$VERBOSE" ] && echo "experiment: $EXP_PREFIX${EXPT_NUMBER}"

[ TRUE == "$VERBOSE" ] && echo "output file: $OUT_DIR/$OUT_FILE_PREFIX${EXPT_NUMBER}.csv"

 

# Run experiment i

    ./NetLogo_Console --headless \

      --model "$MODEL_NAME" \

      --setup-file "$EXP_XML_FILE" \

      --experiment "$EXP_PREFIX${EXPT_NUMBER}" \

      --table "$OUT_DIR/$OUT_FILE_PREFIX${EXPT_NUMBER}.csv"

 

cd "$SAV_DIR"

 

do-multi-bspace-expts.sh

#!/usr/bin/env bash

 

# Sample script to execute multiple experiments from a single xml file

 

# These variables could be passed as arguments

 

# Specify the NetLogo installation directory

# If using Linux, comment out the next executable line, and

# uncomment and update the lines for Linux.

 

#MacOS

NL_DIR="/Applications/NetLogo 6.3.0"

echo "NetLogo directory: $NL_DIR"

 

#Linux

# For Linux it is relative to whatever your installation directory

# Fill in the appropriate value

# NL_INSTALL_DIR=""

# NL_DIR="$NL_INSTALL_DIR/NetLogo 6.3.0/lib/app"

 

# Specify the absolute model name 

MODEL_NAME="$NL_DIR/models/IABM Textbook/chapter 4/Wolf Sheep Simple 5.nlogo"

echo "model: $MODEL_NAME"

 

# Specify the xml file containing the experiments

EXP_XML_FILE="$HOME/bspace-experiments/wsp-experiments.xml"

echo "xml file: $EXP_XML_FILE"

 

# Specify the experiment prefix (to which the experiment number will be added)

EXP_PREFIX="WSP"

echo "experiment prefix: $EXP_PREFIX"

 

# This script uses the sample file "my-wsp-setups.xml"

# To modify for your own use add an experiment to your model of interest.

# Then copy the xml that appears near the end of the .nlogo file to a new file with the extension .xml.

# You can add multiple copies of the experiment with the desired modifications to the data values, as in my-wsp-setups.xml

 

# Specify an output directory

OUT_DIR="$HOME/bspace-results"

echo "output directory: $OUT_DIR"

 

# Specify the output file prefix (to which the experiment number and

# the .csv extension will be added)

OUT_FILE_PREFIX="wolf-sheep-experiment-table"

echo "output file prefix: $OUT_FILE_PREFIX"

 

# create the output directory if needed

mkdir -p $OUT_DIR

 

# save directory so we can switch back to it

SAV_DIR="$(pwd)"

 

cd "$NL_DIR"

echo "current dir: $(pwd)"

 

echo

# Specify the number of experiments to be run

NUM_EXPTS=4

echo "$NUM_EXPTS experiments"

 

for (( i=1; i<=$NUM_EXPTS; i++ ))

do

    echo "experiment: $EXP_PREFIX${i}"

    echo "output file: $OUT_DIR/$OUT_FILE_PREFIX${i}.csv"

 

# Run experiment i

    ./NetLogo_Console --headless \

      --model "$MODEL_NAME" \

      --setup-file "$EXP_XML_FILE" \

      --experiment "$EXP_PREFIX${i}" \

      --table "$OUT_DIR/$OUT_FILE_PREFIX${i}.csv"

done

 

cd "$SAV_DIR"

 

fire-setups.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE experiments SYSTEM "behaviorspace.dtd">

<experiments>

  <experiment name="experiment" repetitions="10" runMetricsEveryStep="true">

    <setup>setup</setup>

    <go>go</go>

    <exitCondition>not any? fires</exitCondition>

    <metric>burned-trees</metric>

    <enumeratedValueSet variable="density">

      <value value="40"/>

      <value value="0.1"/>

      <value value="70"/>

    </enumeratedValueSet>

  </experiment>

</experiments>

 

flocking-setups.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE experiments SYSTEM "behaviorspace.dtd">

<experiments>

  <experiment name="flock-basic" repetitions="1" runMetricsEveryStep="true">

    <setup>setup</setup>

    <go>go</go>

    <timeLimit steps="3"/>

    <metric>count turtles</metric>

    <enumeratedValueSet variable="max-cohere-turn">

      <value value="3"/>

      <value value="6"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="max-separate-turn">

      <value value="1.5"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="vision">

      <value value="5"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="minimum-separation">

      <value value=".5"/>

      <value value="1"/>

      <value value="2"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="population">

      <value value="300"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="max-align-turn">

      <value value="5"/>

    </enumeratedValueSet>

  </experiment>

</experiments>

 

my-wsp-setups.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE experiments SYSTEM "behaviorspace.dtd">

<experiments>

  <experiment name="My WSP Exploration" repetitions="5" runMetricsEveryStep="false">

    <setup>setup</setup>

    <go>go</go>

    <timeLimit steps="2000"/>

    <metric>count wolves</metric>

    <metric>count sheep</metric>

    <metric>sum [grass-amount] of patches</metric>

    <enumeratedValueSet variable="energy-gain-from-grass">

      <value value="2"/>

    </enumeratedValueSet>

    <steppedValueSet variable="number-of-wolves" first="5" step="1" last="15"/>

    <enumeratedValueSet variable="movement-cost">

      <value value="0.5"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="energy-gain-from-sheep">

      <value value="5"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="number-of-sheep">

      <value value="500"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="grass-regrowth-rate">

      <value value="0.3"/>

    </enumeratedValueSet>

  </experiment>

</experiments>

 

wsp-experiments.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE experiments SYSTEM "behaviorspace.dtd">

<experiments>

  <experiment name="WSP1" repetitions="5" runMetricsEveryStep="false">

    <setup>setup</setup>

    <go>go</go>

    <timeLimit steps="2000"/>

    <metric>count wolves</metric>

    <metric>count sheep</metric>

    <metric>sum [grass-amount] of patches</metric>

    <enumeratedValueSet variable="energy-gain-from-grass">

      <value value="2"/>

    </enumeratedValueSet>

    <steppedValueSet variable="number-of-wolves" first="5" step="1" last="15"/>

    <enumeratedValueSet variable="movement-cost">

      <value value="0.5"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="energy-gain-from-sheep">

      <value value="5"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="number-of-sheep">

      <value value="500"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="grass-regrowth-rate">

      <value value="0.3"/>

    </enumeratedValueSet>

  </experiment>

  <experiment name="WSP2" repetitions="5" runMetricsEveryStep="false">

    <setup>setup</setup>

    <go>go</go>

    <timeLimit steps="2000"/>

    <metric>count wolves</metric>

    <metric>count sheep</metric>

    <metric>sum [grass-amount] of patches</metric>

    <enumeratedValueSet variable="energy-gain-from-grass">

      <value value="1"/>

    </enumeratedValueSet>

    <steppedValueSet variable="number-of-wolves" first="5" step="1" last="15"/>

    <enumeratedValueSet variable="movement-cost">

      <value value="0.5"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="energy-gain-from-sheep">

      <value value="5"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="number-of-sheep">

      <value value="500"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="grass-regrowth-rate">

      <value value="0.3"/>

    </enumeratedValueSet>

  </experiment>

  <experiment name="WSP3" repetitions="5" runMetricsEveryStep="false">

    <setup>setup</setup>

    <go>go</go>

    <timeLimit steps="2000"/>

    <metric>count wolves</metric>

    <metric>count sheep</metric>

    <metric>sum [grass-amount] of patches</metric>

    <enumeratedValueSet variable="energy-gain-from-grass">

      <value value="2"/>

    </enumeratedValueSet>

    <steppedValueSet variable="number-of-wolves" first="5" step="1" last="15"/>

    <enumeratedValueSet variable="movement-cost">

      <value value="0.5"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="energy-gain-from-sheep">

      <value value="6"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="number-of-sheep">

      <value value="500"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="grass-regrowth-rate">

      <value value="0.3"/>

    </enumeratedValueSet>

  </experiment>

  <experiment name="WSP4" repetitions="5" runMetricsEveryStep="false">

    <setup>setup</setup>

    <go>go</go>

    <timeLimit steps="2000"/>

    <metric>count wolves</metric>

    <metric>count sheep</metric>

    <metric>sum [grass-amount] of patches</metric>

    <enumeratedValueSet variable="energy-gain-from-grass">

      <value value="2"/>

    </enumeratedValueSet>

    <steppedValueSet variable="number-of-wolves" first="5" step="1" last="15"/>

    <enumeratedValueSet variable="movement-cost">

      <value value="0.5"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="energy-gain-from-sheep">

      <value value="5"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="number-of-sheep">

      <value value="500"/>

    </enumeratedValueSet>

    <enumeratedValueSet variable="grass-regrowth-rate">

      <value value="0.5"/>

    </enumeratedValueSet>

  </experiment>

</experiments>

 

List-of-NetLogo-Models-with-BehaviorSpace-experiments.txt

All NetLogo models that have BehaviorSpace experiments

Paths are given in MacOS/Linux format, relative to the models directory.

 

To generate the list for MacOS or Linux

cd /Applications/NetLogo\ 6.3.0/models # or Linux models directory

find . -type f -name "*.nlogo" -print0 | xargs -0 grep -l '<experiments>'

 

./Alternative Visualizations/Ethnocentrism - Alternative Visualization.nlogo

./Sample Models/System Dynamics/Unverified/Tabonuco Yagrumo.nlogo

./Sample Models/Networks/Small Worlds.nlogo

./Sample Models/Social Science/Economics/Bidding Market.nlogo

./Sample Models/Social Science/Ethnocentrism.nlogo

./Sample Models/Biology/Repressilator 1D.nlogo

./Sample Models/Biology/Evolution/Anisogamy.nlogo

./IABM Textbook/chapter 7/Voting Sensitivity Analysis.nlogo

./IABM Textbook/chapter 8/Simple Viral Marketing.nlogo

./IABM Textbook/chapter 6/Spread of Disease.nlogo

./IABM Textbook/chapter 4/Wolf Sheep Simple 5.nlogo

./Curricular Models/PNoM/PNoM 1 Diffusion Sandbox.nlogo

./Curricular Models/GenEvo/Synthetic Biology - Genetic Switch.nlogo

./Curricular Models/BEAGLE Evolution/Red Queen.nlogo

./Curricular Models/Urban Suite/Urban Suite - Cells.nlogo

./Code Examples/Extensions Examples/vid/Movie Recording Example.nlogo

./Code Examples/Extensions Examples/time/Discrete Event Whack-a-Mole.nlogo

 

List all BehaviorSpace experiments for a given NetLogo model

 

# Execute in model directory

find . -type f -name "ActualModelName.nlogo" -print0 | xargs -0 grep  "<experiment name"

 

All experiments for the Anisogamy Model

find . -type f -name "Anisogamy.nlogo" -print0 | xargs -0 grep  "<experiment name"

 

./Sample Models/Biology/Evolution/Anisogamy.nlogo:  <experiment name="critical-mass-500k" repetitions="6" runMetricsEveryStep="false">

./Sample Models/Biology/Evolution/Anisogamy.nlogo:  <experiment name="default-params-50k" repetitions="300" runMetricsEveryStep="false">

./Sample Models/Biology/Evolution/Anisogamy.nlogo:  <experiment name="no-critical-mass-50k" repetitions="300" runMetricsEveryStep="false">

./Sample Models/Biology/Evolution/Anisogamy.nlogo:  <experiment name="zygote-critical-mass-gamete-mass-mutation-heatmap-500k" repetitions="5" runMetricsEveryStep="false">

./Sample Models/Biology/Evolution/Anisogamy.nlogo:  <experiment name="gamete-zygote-critical-mass-heat-map-500k" repetitions="4" runMetricsEveryStep="false">

./Sample Models/Biology/Evolution/Anisogamy.nlogo:  <experiment name="speed-size-relationship-critical-mass" repetitions="30" runMetricsEveryStep="false">

./Sample Models/Biology/Evolution/Anisogamy.nlogo:  <experiment name="default-parameters-with-screenshots" repetitions="1" runMetricsEveryStep="true">

 

 

 

 

-- 

Aaron Brandes, Software Developer

Center for Connected Learning and Computer-Based Modeling

 

bspace-experiments.zip
Reply all
Reply to author
Forward
0 new messages