Previously I am working with an ABM model, which is now turning to be put into the production environment (embed it into an online platform system).
In order to do this, I have two important objectives to achieve:
How to pack and distribute the model and the assiciated files to other people, in an aggragated way, preferably as one single jar file, which could be called easily and automatically by other program to run the simulation when needed. Running the model in headless mode is prefered. The repast GUI control window pop up should be avoided when calling and running the model. BTW:the current version of the model does not require the batch runs of different scenarios at the same time, only a single run each time needed.
How to hide/obfuscate the source code of the model completely or at least partially, in order to secure my intellectual property assoicated with the model itself.
For 1, this isn’t ideal but you could essentially mimic what a single batch run does. It is not a single jar solution, but it is certainly the easiest way to do a single headless run. So,
With all that in place, you should be able to run your model using
repast.simphony.batch.InstanceRunner as the main class, using a shell script. On MacOS, that script would look something like:
cd instance java -cp "../lib/*" repast.simphony.batch.InstanceRunner -pxml ../scenario.rs/batch_params.xml -scenario ../scenario.rs -id 1 -pinput param_line.txt
The param_line.txt file should be a single line with your model parameters in this format:
RtP1tV1,P2tV2,... where R is a run number (i.e. 1), ‘t’ is a tab, P1 is the name of the first parameter, V1 is the value of the first parameter and so on.
More info about InstanceRunner arguments here:
What you’d give to people is a zipped copy of the top level directory and the model can be run by executing your shell script. Like I said, its not ideal, but its the only headless solution I can think of.