1

I am wondering how to

1) how to run model directly in Eclipse without GUI - just run the model like run other java codes in Eclipse and print out something i am interested.

2) how to run it in headless mode without even Eclipse - I plan to deploy my model in a remote server, which the server or my own PC could run the model automatically at a specific time of the day.

3) Every time when I change the code, I have to launch a new GUI in order to reflect the code changes. It takes at least 5 seconds to open the GUI. This is very inefficient way of model development and debugging. What is the better strategy available?

Jack
  • 1,339
  • 1
  • 12
  • 31

1 Answers1

2

For headless, or batch, running of models, take a look at the Repast Batch Getting Started Guide. This can either allow you to run multiple runs without a GUI, as in (1), or if you look at section 9.2, it will allow you to run from the command line without invoking Eclipse, as in your case (2). If you want more control, I'd suggest looking at the InstanceRunner class and utilize the complete_model.jar payload that is generated by the Batch GUI or batch_runner.jar.

  1. Unarchive the complete_model.jar
  2. Then use the InstanceRunner class from the command line, like so from within the complete_model directory
    java -Xmx512m -cp "../lib/*" repast.simphony.batch.InstanceRunner \
        -pxml ../scenario.rs/batch_params.xml \
        -scenario ../scenario.rs \
        -id $instance \
        -pinput localParamFile.txt

where the localParamFile.txt is an unrolled parameter file specifying the combination(s) of parameters to run (see the unrolledParamFile.txt within the payload for an example) and if you're running just one instance this would just be one line.

J. Ozik
  • 1,083
  • 5
  • 6
  • 1) the batch run will still take some time to pop up a window for user to click which is no difference to the GUI. Is possible to run the model immediately by click the run button in eclipse? 2) what is the answer to question 3? it's simply too much time consuming to repetitively close and launch the GUI for testing and debugging. – Jack Oct 24 '19 at 03:15
  • If you use the Batch GUI, then yes you may not see the benefit of running individual runs from there, since the GUI will take at least some time to pop up. However, I was suggesting to look at the headless option in section 9.2, which doesn't bring up the Batch GUI. What could work for you as an option for question 3 is to look at the [REPAST MODEL TESTING GUIDE](https://repast.github.io/docs/RepastModelTesting.pdf) for how to create small unit tests for testing the logic within your code. This should be fast, with no GUI or other intermediate steps. – J. Ozik Oct 24 '19 at 03:25