Skip to content

How to Run our Models

Martin Llofriu edited this page Feb 19, 2018 · 21 revisions

Introduction

Our models are implemented using the SCS platform. In order to run them, java and R must be installed, the platform source must be cloned and compiled, and the model has to be ran from a terminal. We recommend to run them in ubuntu, as it is our main platform of development.

Installing Java

The Java SDK, version 7 or newer must be downloaded and installed. We recommend using the Oracle version. Follow this instructions to install it, or these to use apt.

Getting SCS sources

On a Linux environment, we recommend to clone the source. To do so, open a terminal and type

git clone git@github.com:mllofriu/scs.git

Alternatively, a zip of the source can be downloaded and extracted from the SCS page.

Compiling SCS

master branch

The compilation is done through the use of ant. If ant is not installed, it can be installed (in Ubuntu): sudo apt-get install ant

Then:

cd scs
ant compile

It should all compile without errors.

v2 branch

The v2 branch switched to maven for dependency management and compilation. Maven might need to be installed, (in Ubuntu): sudo apt-get install maven

Then:

cd scs
mvn package

This will take a while at first, as it needs to download all packages.

After this step, you are ready to run any of the models.

Installing R

Before installing R packages, you'll need xml2-config (sudo apt install libxml2-dev).

Go to this page for information.

After installing R, some packages must be installed. In a terminal, cd into the scs folder. Execute R, and type:

load ("installedpackages.rda")
for (count in 1:length(installedpackages)) install.packages(installedpackages[count])

It might prompt for selecting a mirror the first time, pick any one.

For the v2 branch:

load ("scripts/installedpackages.rda")
for (count in 1:length(installedpackages)) install.packages(installedpackages[count])

Running a model

To run a model, one needs to specify the following:

  • The experiment XML file to be used: defines which experiment, and thus which model, is going to be executed. The model's wiki page should specify this information.
  • The location where the logs should be stored: this is arbitrary, we usually use a subfolder of the logs/ folder.
  • The group to be executed: each experiment xml defines one or more experimental groups. Different groups execute different sets of trials, and sometimes some tasks apply only to certain groups. For example, dorsal hippocampus deactivation will only be performed to the Dorsal group. The wiki page of the model should define the available groups.
  • The individual to be executed: this is a numeric index. When running a single instance, this is irrelevant, it can be always 0.

To run the model, the visualExec.sh script can be used. When in the scs folder:

./scripts/visualExec.sh <XML file> <log folder> <group name> <individual number>

For example, to run the Multiple-T with replay model:

./scripts/visualExec.sh multiscalemodel/src/edu/usf/ratsim/experiment/xml/multipleTexperiment.xml logs/multTtest/ Control 0

Visualizing the simulation

When using the VirtualUniverse simulator (default), the simulation can be visualized by enabling it in the experiment XML. The tag at the top, contains a tag, which if set to true, the simulation is displayed. The parameter in each trial (also in the XML file) specifies the sleep time in milliseconds between cycles.

Running Batch

Many individuals must be simulated to get statistical information about the groups' performance.

The XML file defines a number of individuals per group. Some scripts are included to run many individuals in parallel. Using the script scripts/runAllSerial.sh, one can run all the individuals at once:

./scripts/runAllSerial.sh <XML> <log folder> <number of groups> <number of individuals>

Taking the multi-scale actor critic Morris [model] (https://github.com/mllofriu/scs/wiki/Multi-Scale-Actor-Critic-Morris-Maze-Model), there are 2 groups with 16 individuals each:

./scripts/runAllSerial.sh multiscalemodel/src/edu/usf/ratsim/experiment/xml/morris/multiscale/actorcritic/virtual.xml logs/testParallelMSACMorris/ 2 16

This will run 2 individuals in parallel, until all 32 individuals are executed. The output and error are redirected to the "out" file. Thus, tail -f out will show it in realtime.

Now, the runtime plots (see the model's page) will include information from all individuals and groups.