repast-simphony

Repast - Exchange information between batch runs


Batch runs in Repast are independent runs without interactions. However, in my model I have a need to enable such interaction. E.g. run-2 needs to get some data from run-1 in order to run completely.

Is there a way to exchange information between batch runs?


Solution

  • The order in which individual batch runs are executed is not predetermined. For example, if you distribute the runs among several resources two may run at the same time as or 2 even before 1. So, in the general case, I don't think this is possible.

    That said, I think you have three options:

    1. If possible, do all the independent runs (e.g. 1 in your example), gather the data, and then do the dependent runs. That won't work well obviously if you are actually talking about a chain of runs 1->2->3...

    2. If all the runs are running on the same resource, you could experiment a bit to find out where run 1 is running. I suspect its probably in "instance_1" and run 2 is in instance_2 etc. By experiment here, I just mean look at the file system manually to see what is where. You could then use Java's various file IO classes (note - not Repast functionality) to get run 2's location and find the location of run 1's data with that. For example, if you know run 2 runs in /x/y/z/instance_2 (maybe by doing a Paths.get("./") or something) and that run 1 is then in /x/z/y/instance_1, you should be able to get the data. I don't know what data from run 1 you want but you'll have to make sure that the data you want has been completely written.

    3. If run 2 really depends on run 1, perhaps it makes sense to update the model to run them as single run.

    Nick