Last change
on this file since 470 was
462,
checked in by Maciej Komosinski, 9 years ago
|
- Updated for a new official way of calling scripts with arguments
- Prints more comprehensive statistics
|
File size:
1.5 KB
|
Rev | Line | |
---|
[116] | 1 | script:
|
---|
| 2 | name:Multithreading efficiency test
|
---|
| 3 | help:Multithreading efficiency test
|
---|
| 4 | code:~
|
---|
[462] | 5 | function main_args(complexify_geno,timeinterval,intervals)
|
---|
[116] | 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 |
|
---|
[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();
|
---|
| 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 % ExpParams.threads % ExpParams.capacity);
|
---|
[116] | 29 | Simulator.print(GenePools[0].best().genotype);
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 | ~
|
---|
| 33 |
|
---|
Note: See
TracBrowser
for help on using the repository browser.