As discussed in Exporting standalone batch runs, Christof Zellweger developed a .sh file for Repast that will run in “batch mode” on non-development Mac and *nix machines. That file and his comments appear below. (I’ve also posted a sample .bat file and a sample .command file, both contributed by others. You may get some benefit from looking at those as well.)
start_model.command, modified by Christof Zellweger in 2012 to use BatchMain
#!/bin/bash
# The version of Repast Simphony being used.
export VERSION=2.0.0
# The installed path of Repast. Quotes may be necessary if there is a space character in the path.
export REPAST="/path/to/your/repast/home/folder"
# The installed path of Eclipse. Quotes may be necessary if there is a space character in the path.
export ECLIPSE=$REPAST/eclipse
# The plugins path of Eclipse.
export PLUGINS=$ECLIPSE/plugins
export REPAST_SIMPHONY_LIB=$PLUGINS/repast.simphony.runtime_$VERSION/lib
# The Eclipse workspace containing the Repast model.
export WORKSPACE=/path/to/your/workspace/
# The name of the model. This might be case-sensitive. This is the name of your package. It should
# be the package at the top of all your .java files and match the "package" listed in your
# model.score file (when viewed as a text file).
export MODELNAME=
# The folder of the model. This might be case-sensitive. This is the base folder of your
# project in the file system.
export MODELFOLDER=$WORKSPACE/
# The file containing the batch parameters. For some additional information, see Repast
# documentation of batch parameters at http://repast.sourceforge.net/docs/reference/SIM/Batch%20Parameters.html
# and/or an example batch_params.xml file at
# http://www.pamelatoman.net/blog/2010/08/sample-batchparamsxml/.
# The following is the usual location within your Repast workspace - change according to your location / system
export BATCHPARAMS=$MODELFOLDER/batch/batch_params.xml
# Change to the root folder of your project so that the relative paths are handled correctly
cd $MODELFOLDER
# Execute in batch mode.
java -classpath $MODELFOLDER/lib/*:$MODELFOLDER/bin:$PLUGINS/repast.simphony.scenario_$VERSION/bin:
$PLUGINS/repast.simphony.batch_$VERSION/bin:$PLUGINS/repast.simphony.runtime_$VERSION/lib/*:
$PLUGINS/repast.simphony.runtime_$VERSION/bin:$PLUGINS/repast.simphony.core_$VERSION/lib/*:
$PLUGINS/repast.simphony.core_$VERSION/bin:$PLUGINS/repast.simphony.data_$VERSION/lib/*:
$PLUGINS/repast.simphony.score.runtime_$VERSION/lib/*:$PLUGINS/repast.simphony.score.runtime_$VERSION/bin:
$PLUGINS/repast.simphony.dataLoader_$VERSION/bin:$PLUGINS/repast.simphony.data_$VERSION/bin:
$PLUGINS/repast.simphony.score_$VERSION/bin:$REPAST_SIMPHONY_LIB/saf.core.runtime.jar:
$REPAST_SIMPHONY_LIB/commons-logging-1.0.4.jar:$REPAST_SIMPHONY_LIB/groovy-all-1.5.7.jar:
$REPAST_SIMPHONY_LIB/javassist-3.7.0.GA.jar:$REPAST_SIMPHONY_LIB/jpf.jar:$REPAST_SIMPHONY_LIB/jpf-boot.jar:
$REPAST_SIMPHONY_LIB/log4j-1.2.13.jar:$REPAST_SIMPHONY_LIB/xpp3_min-1.1.4c.jar:
$REPAST_SIMPHONY_LIB/xstream-1.3.jar repast.simphony.batch.BatchMain -params $BATCHPARAMS $MODELFOLDER/$MODELNAME.rs
Christof Zellweger writes:
I’ve tested this on Mac OS X Snow Leopard 10.6.8. I didn’t have a Linux box available but seeing that OS X uses a XNU (Unix Mach/BSD hybrid) kernel, I would assume that this script runs on many *NIX platforms unchanged and if not, only small changes would be necessary.
The main difference in this script (apart from usage of the *NIX ‘export’ equivalent to Window’s ‘set’ command) was that I’ve added 2-3 search locations/directories in the classpath argument. Plus I’ve added a few comments.