source: experiments/frams/multi-threading/data/scripts/test-mt.script @ 309

Last change on this file since 309 was 116, checked in by Maciej Komosinski, 11 years ago

scripts useful to evaluate efficiency of parallel simulation/evolution and to analyze influence of parallelization parameters

File size: 1.2 KB
Line 
1script:
2name:Multithreading efficiency test
3help:Multithreading efficiency test
4code:~
5function main(complexify_geno,timeinterval,intervals)
6{
7        // ExpParams.mix_period (percentage of the gene pool capacity) is kept at the default value (1000%)
8
9        Math.randomize();
10        //Simulator.expdef="standard-mt"; //set multithreaded experiment; this is done by the shell script
11       
12        ExpParams.initialgen="XX[|,1:1][N,1:1,2:1][T][G]";
13        for(var i=0;i<complexify_geno;i++) //make a big genotype by doubling the simple one above. Note: exponential!
14                ExpParams.initialgen=ExpParams.initialgen+ExpParams.initialgen;
15       
16        Simulator.init();
17        //Simulator.print(GenePools[0][0].genotype); //ensure that the initialgen is in the gene pool - init() does this
18               
19        Simulator.start();
20        for(var iter=0;iter<intervals;iter++)
21        {
22                var t0=Math.time;
23                while (Math.time-t0<timeinterval && Simulator.running) Simulator.step();
24                Simulator.print("iter=%d, simsteps=%d, evals=%d, migrations=%d, gen_count=%d, avg_numparts=%g, fit_avg=%g, fit_max=%g" % iter % Simulator.time % ExpState.totaltests % ExpState.migrations % stats.gen_count % stats.st_avg_numparts % stats.st_avg_fit % stats.st_max_fit);
25                Simulator.print(GenePools[0].best().genotype);
26        }
27        Simulator.stop();
28}
29~
30
Note: See TracBrowser for help on using the repository browser.