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

Last change on this file since 1254 was 480, checked in by sz, 9 years ago

experiment scripts updated to match the upcoming Framsticks version (ExpParams? ==> ExpProperties?, Fields ==> NeuroProperties?, prop: ==> property)

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