You are not logged in.
Hello,
I am simulating a society of agents which perform several tasks in a space.
My idea potentially is to generate a lot of different scenarios at the same time and extract statistical information about how these agents behave in these scenarios.
As I am not an expert in java, and I have been working with TurtleKit for less than two months, I do not know if it is possible to build several simulations in parallel and how to do it in MadKit/turtleKit.
Furthermore, how could I do to run one simulation after another without having to rerun again everytime the simulation finishes?
Thank you very much,
XG.
Offline
Hello,
I do not know if it is possible to build several simulations in parallel and how to do it in MadKit/turtleKit.
It is, that is to say that you can, within a regular main method of a dedicated class, launch several instances of TurtleKit with different options (no overlap normally). Still it could be easier and probably as fast to launch them in sequentially.
Furthermore, how could I do to run one simulation after another without having to rerun again everytime the simulation finishes?
I personally use shell script (which could be easily adapted to windows). Here is one example:
rm $1
touch $1
date >> $1
echo "phero nb = $3 ..... Simulation duration = $2"
echo "envSize;totalTime;agentsComputationTime;envComputationTime;percentage;nbAgents" >> $1
for i in 30 70 100 120
do
echo "" >> $1
echo "---------$i%" >> $1
echo $i
for size in 600
do
for nbIteration in $(seq 3)
do
java -Xmx12G -Xms4G -cp bin:lib/turtlekit-3.0.0.4.jar bench.phero.RandBenchTurtle $size $i --csv.file $1 $2
sleep 4
done
echo "" >> $1
done
done
date >> $1
$1 is the name of the current csv file.
This name is known at runtime using
String csvFile = getMadkitProperty("cvs.file");
Other $ are arguments which are passed to main method of a Turtle :
public static void main(String[] args) {
float percentage = Float.parseFloat(args[1])/100;
int size = Integer.parseInt(args[0]);
int nbAgents = (int) ((float) size * size * percentage);
executeThisTurtle(nbAgents
,Option.envDimension.toString(),args[0]+","+size
,args[2]
,"--cvs.file",args[4]
,Option.startSimu.toString()
,Option.endTime.toString(),args[5]
,Option.scheduler.toString(),BenchScheduler.class.getName()
,Option.viewers.toString(),"null"
);
There are many other ways (using @Test series witgh Junit, using a Java program instead of a script, etc.).
Hope this help.
Fabien
Offline
Thank you very much Fabien, it was really useful.
Offline