Changeset 421 for experiments/frams/foraminifera/data/scripts
- Timestamp:
- 08/03/15 12:06:54 (9 years ago)
- Location:
- experiments/frams/foraminifera/data/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
experiments/frams/foraminifera/data/scripts/foraminifera.expdef
r418 r421 6 6 user1: 7 7 genes which are not encoded in Ff genotype: 8 Vamin- Minimum stored energy necessary for reproduction9 amin- minimal age for reproduction8 minenergy - Minimum stored energy necessary for reproduction 9 minage - minimal age for reproduction 10 10 11 11 user2: … … 20 20 - xxx.get(...) changed to xxx[...] 21 21 - xxx.set(...,...) changed to xxx[...]=... 22 - function placeRandomlyNotColliding(cr) explicitly called when adding a new creature, and removed collision checking from on CreaturesBorn() which is also called when "growing" (since "growing" is implemented as creating a new creature in place of the old one, so onCreaturesBorn() is also called)22 - function placeRandomlyNotColliding(cr) explicitly called when adding a new creature, and removed collision checking from onForamsBorn() which is also called when "growing" (since "growing" is implemented as creating a new creature in place of the old one, so onForamsBorn() is also called) 23 23 - use creature's center (not the bbox corner) when growing 24 24 - added "S" receptor to visualize the difference between diplo and haplo generations … … 26 26 */ 27 27 28 global foodenergywaiting;28 global nutrientenergywaiting; 29 29 global reprocounter; 30 30 … … 35 35 function onExpDefLoad() 36 36 { 37 38 37 // define genotype and creature groups 39 38 GenePools.clear(); … … 44 43 45 44 var pop = Populations[0]; 46 pop.name = " Creatures";45 pop.name = "Forams"; 47 46 pop.en_assim = 0; 48 47 pop.nnsim = 0; … … 55 54 pop.perfperiod = 25; 56 55 57 pop = Populations.addGroup(" Food");56 pop = Populations.addGroup("Nutrients"); 58 57 pop.nnsim = 0; 59 58 pop.enableperf = 0; … … 63 62 pop.othermask = 0x10000; 64 63 65 //TODO remove unused params66 67 64 //radius of the chamber 68 65 ExpParams.rads = [1.2, 0.6]; 69 //ExpParams.rads = [2, 2];70 66 //inital genotypes 71 ExpParams.genh = "//0\np:sh=1,sx=" + ExpParams.rads[0] + ",sy=" + ExpParams.rads[0] + ",sz=" + ExpParams.rads[0] + ", rz=3.14159265358979";72 ExpParams.gend = "//0\np:sh=1,sx=" + ExpParams.rads[1] + ",sy=" + ExpParams.rads[1] + ",sz=" + ExpParams.rads[1] + ", rz=3.14159265358979";73 ExpParams. gend += "\nn:p=0,d=\"S\"";67 ExpParams.genh = createForamGenotype(ExpParams.rads[0]); 68 ExpParams.gend = createForamGenotype(ExpParams.rads[1])+"\nn:p=0,d=\"S\""; 69 ExpParams.creath = -0.99; //just above the bottom 74 70 ExpParams.e_meta = 0.1; 75 71 ExpParams.feedrate = 0.5; 76 72 ExpParams.feede0 = 100; 77 73 ExpParams.feedtrans = 3; 78 ExpParams. creath = -0.99; //just above the bottom79 ExpParams. foodgen = "//0\np:sh=2,sx=0.1,sy=0.1,sz=0.1\nn:d=T,p=0"; //TODO food size as param74 ExpParams.nutrientsize = 0.1; 75 ExpParams.nutrientgen = "//0\np:sh=2,sx="+ExpParams.nutrientsize+",sy="+ExpParams.nutrientsize+",sz="+ExpParams.nutrientsize+"\nn:d=T,p=0"; 80 76 ExpParams.autorestart = 0; 81 ExpParams.p size = 10;77 ExpParams.popsize = 10; 82 78 //ExpParams.logging = 1; //uncomment to enable logging simulation parameters to log files 83 79 84 80 //number of offspring 85 ExpParams. ofnumh = 40;86 ExpParams. ofnumd = 25;81 ExpParams.energy0h = 40; 82 ExpParams.energy0d = 25; 87 83 //minial volume for reproduction 88 ExpParams.v_min_d = 300; 89 ExpParams.v_min_h = 300; 84 ExpParams.minenerg = [300, 300]; 90 85 //minimal age for reproduction 91 ExpParams.age_min_d = 100; 92 ExpParams.age_min_h = 100; 86 ExpParams.minage = [100, 100]; 93 87 //crossover probability 94 88 ExpParams.crossprob = 0.4; 95 89 //mutation probability 96 90 ExpParams.mutationprob = 0.2; 97 ExpParams.repro_time = 200; 98 ExpParams.repro_thr = 1; 99 100 //grwoth speed in time steps 101 ExpParams.growth_step = 50; //50 91 ExpParams.repro_time = 45; 92 93 //grwoth speed in simulation steps 94 ExpParams.growth_step = 50; 102 95 103 96 ExpState.totaltestedcr = 0; 104 ExpState. food= "";105 foodenergywaiting = ExpParams.feede0;97 ExpState.nutrient = ""; 98 nutrientenergywaiting = ExpParams.feede0; 106 99 reprocounter = 0; 107 100 108 ExpParams.w size = 50;101 ExpParams.worldsize = 50; 109 102 World.wrldwat = 50; 110 World.wrldsiz = ExpParams.w size;103 World.wrldsiz = ExpParams.worldsize; 111 104 World.wrldbnd = 1; 112 105 } … … 119 112 Populations[1].clear(); 120 113 121 for (var i = 0; i < ExpParams.p size; i++)114 for (var i = 0; i < ExpParams.popsize; i++) 122 115 { 123 116 var cr = Populations[0].add(ExpParams.genh); 124 117 cr.name = "Initial creature" + i; 125 118 placeCreatureRandomly(cr, 0, 0); 126 cr.energy0 = ExpParams. v_min_h - ExpParams.repro_thr;119 cr.energy0 = ExpParams.energy0h; 127 120 cr.energy = cr.energy0; 128 cr.user1 = {" vamin" : ExpParams.v_min_h, "amin": ExpParams.age_min_h};129 cr.user2 = {"Va" : ExpParams. v_min_h - ExpParams.repro_thr, "gen" : 0, "growth_step" : ExpParams.growth_step, "rsize" : ExpParams.rads[0], "vinit" : ExpParams.v_min_h - ExpParams.repro_thr};121 cr.user1 = {"minenergy" : ExpParams.minenerg[0], "minage": ExpParams.minage[0]}; 122 cr.user2 = {"Va" : ExpParams.energy0h, "gen" : 0, "growth_step" : ExpParams.growth_step, "rsize" : ExpParams.rads[0], "vinit" : ExpParams.energy0h}; 130 123 } 131 124 ExpState.totaltestedcr = 0; 132 foodenergywaiting = ExpParams.feede0;125 nutrientenergywaiting = ExpParams.feede0; 133 126 } 134 127 … … 142 135 Loader.run(); 143 136 144 Simulator.print("Loaded " + Populations[0].size + " creatures and " + Populations[1].size + " foodobjects");137 Simulator.print("Loaded " + Populations[0].size + " Forams and " + Populations[1].size + " nutrient objects"); 145 138 } 146 139 … … 186 179 tmpvec.add([cr.center_x, cr.center_y, cr.energy]); 187 180 188 ExpState. food= tmpvec;181 ExpState.nutrient = tmpvec; 189 182 File.writeObject(sim_params.*); 190 ExpState. food= null; //vectors are only created for saving and then discarded183 ExpState.nutrient = null; //vectors are only created for saving and then discarded 191 184 192 185 for (var cr in Populations[0]) … … 196 189 // -------------------------------- experiment end -------------------------------- 197 190 198 // -------------------------------- creature begin -------------------------------- 199 200 function onCreaturesBorn(cr) 191 // -------------------------------- foram begin ----------------------------------- 192 193 function createForamGenotype(radius) 194 { 195 return "//0\np:sh=1,sx=" + radius + ",sy=" + radius + ",sz=" + radius + ", rz=3.14159265358979"; 196 } 197 198 function onForamsBorn(cr) 201 199 { 202 200 cr.idleen = ExpParams.e_meta; … … 222 220 } 223 221 224 function onCreaturesStep(cr)222 function foramMove(cr) 225 223 { 226 224 //TODO moving inside sediment? 227 225 cr.moveAbs(cr.pos_x, cr.pos_y, 0); //adjustment in z axis 226 228 227 var p = cr.getMechPart(0); 229 var n = cr.signals.receiveSet(" food", ExpParams.food_range);228 var n = cr.signals.receiveSet("nutrient", ExpParams.nutrient_range); 230 229 231 230 //if signals are received find the source of the nearest … … 262 261 cr.localDrive = (0.1 * Math.rnd01, 0.1 * Math.rnd01, 0); 263 262 } 263 } 264 265 function foramGrow(cr) 266 { 267 //TODO how size is related to the energy? 268 cr.user2["rsize"] = ExpParams.rads[cr.user2["gen"]] * Math.min(Math.max(float(cr.user2["Va"] / cr.user2["vinit"]) * 0.5, 1.0), 2.5); 269 var geno = createForamGenotype(cr.user2["rsize"]); 270 if (cr.user2["gen"] == 1) 271 { 272 geno += "\nn:p=0,d=\"S\""; //TODO why initial genotypes are not used as defined in ExpParams? 273 //TODO maybe it would be nice if they rotated so the "S" would show where they are going (direction/intention) 274 } 275 var cr2 = Populations[0].add(geno); 276 cr2.energy0 = cr.energy; 277 cr2.energy = cr2.energy0; 278 setGenotype(cr2, cr.user1, cr.user2); 279 cr2.moveAbs(cr.center_x - cr2.size_x / 2, cr.center_y - cr2.size_y / 2, cr.pos_z); 280 281 Populations[0].delete(cr); 282 } 283 284 function onForamsStep(cr) 285 { 286 foramMove(cr); 264 287 265 288 //energy costs depend on size … … 270 293 } 271 294 295 //TODO lifespan should not be used, it is set to 0 with every growth_step 272 296 if (cr.lifespan >= ExpParams.max_age) 273 297 { 274 //TODO what is max age value? should there be one ?275 Populations[0].kill(cr);276 return;298 //TODO what is max age value? should there be one 299 //Populations[0].kill(cr); 300 //return; 277 301 } 278 302 … … 280 304 if (cr.lifespan == cr.user2["growth_step"]) 281 305 { 282 //TODO how size is related to the energy? 283 cr.user2["rsize"] = ExpParams.rads[cr.user2["gen"]] * Math.min(Math.max(float(cr.user2["Va"] / cr.user2["vinit"]) * 0.5, 1.0), 2.5); 284 var geno = "//0\np:sh=1,sx=" + cr.user2["rsize"] + ",sy=" + cr.user2["rsize"] + ",sz=" + cr.user2["rsize"] + ", rz=3.14159265358979"; 285 if (cr.user2["gen"] == 1) 286 { 287 geno += "\nn:p=0,d=\"S\""; //TODO why initial genotypes are not used as defined in ExpParams? 288 //TODO maybe it would be nice if they rotated so the "S" would show where they are going (direction/intention) 289 } 290 var cr2 = Populations[0].add(geno); 291 cr2.energy = cr.energy; 292 setGenotype(cr2, cr.user1, cr.user2); 293 cr2.moveAbs(cr.center_x - cr2.size_x / 2, cr.center_y - cr2.size_y / 2, cr.pos_z); 294 295 Populations[0].delete(cr); 306 foramGrow(cr); 296 307 } 297 308 else … … 301 312 if (cr.user2["gen"] == 0) 302 313 { 303 properSize = cr.user2["Va"] >= cr.user1[" vamin"];314 properSize = cr.user2["Va"] >= cr.user1["minenergy"]; 304 315 } 305 316 else 306 317 { 307 properSize = cr.user2["Va"] >= cr.user1[0][" vamin"]; //TODO gene selection318 properSize = cr.user2["Va"] >= cr.user1[0]["minenergy"]; //TODO gene selection 308 319 } 309 320 … … 324 335 } 325 336 326 function on CreaturesDied(cr)337 function onForamsDied(cr) 327 338 { 328 339 //fossilization … … 339 350 if (cr.user2["gen"] == 0) 340 351 { 341 cr.user1 = {" vamin" : new_user1["vamin"], "amin": new_user1["amin"] };352 cr.user1 = {"minenergy" : new_user1["minenergy"], "minage": new_user1["minage"] }; 342 353 } 343 354 else if (cr.user2["gen"] == 1) 344 355 { 345 cr.user1 = [ {" vamin" : new_user1[0]["vamin"], "amin": new_user1[0]["amin"] }, {"vamin" : new_user1[1]["vamin"], "amin": new_user1[1]["amin"] }];346 } 347 348 } 349 350 // -------------------------------- creature end--------------------------------351 352 // -------------------------------- foodbegin --------------------------------353 354 function on FoodStep(cr)355 { 356 cr.moveAbs(cr.pos_x % ExpParams.w size, cr.pos_y % ExpParams.wsize, 0.5);357 } 358 359 function add food()360 { 361 var cr = Populations[1].add(ExpParams. foodgen);362 363 cr.name = " Food";356 cr.user1 = [ {"minenergy" : new_user1[0]["minenergy"], "minage": new_user1[0]["minage"] }, {"minenergy" : new_user1[1]["minenergy"], "minage": new_user1[1]["minage"] }]; 357 } 358 359 } 360 361 // --------------------------------foram end ------------------------------------- 362 363 // -------------------------------- nutrient begin -------------------------------- 364 365 function onNutrientsStep(cr) 366 { 367 cr.moveAbs(cr.pos_x % ExpParams.worldsize, cr.pos_y % ExpParams.worldsize, 0.5); 368 } 369 370 function addNutrient() 371 { 372 var cr = Populations[1].add(ExpParams.nutrientgen); 373 374 cr.name = "Nutrients"; 364 375 cr.idleen = 0; 365 376 cr.energy0 = ExpParams.feede0; 366 377 cr.energy = cr.energy0; 367 cr.signals.add(" food");378 cr.signals.add("nutrient"); 368 379 369 380 cr.signals[0].value = cr.getMechPart(0); … … 372 383 } 373 384 374 function on FoodCollision()385 function onNutrientsCollision() 375 386 { 376 387 if (Collision.Creature2.user2 != null) … … 384 395 } 385 396 386 // -------------------------------- foodend --------------------------------397 // -------------------------------- nutrient end -------------------------------- 387 398 388 399 … … 410 421 name:Maximal age 411 422 type:d 100 1000 500 412 413 prop: 414 id:wsize 423 group:Foraminifera 424 425 prop: 426 id:worldsize 415 427 name:World size 416 428 type:d 10 1000 20 … … 420 432 name:Growth step 421 433 type:d -1 10000 1000 434 group:Foraminifera 435 help:You can turn off growth by setting this param to -1 422 436 423 437 prop: … … 425 439 name:Haploid and diploid radius 426 440 type:x 427 428 prop: 429 id:age_min_h 430 name:Min reproduction age of haploid forams 431 type:d 100 10000 300 432 group:Foraminifera 433 434 prop: 435 id:age_min_d 436 name:Min reproduction age of diploid forams 437 type:d 100 10000 200 438 group:Foraminifera 439 440 prop: 441 id:v_min_h 442 name:Min reproduction energy of haploid forams 443 type:f 10 10000 300 444 group:Foraminifera 445 446 prop: 447 id:v_min_d 448 name:Min reproduction energy of diploid forams 449 type:f 10 10000 150 450 group:Foraminifera 451 452 prop: 453 id:repro_thr 454 name:Energy creatures need to gather to reproduce 455 type:d 1 1000 1 456 457 prop: 458 id:food_range 459 name:Range of food smell 441 group:Foraminifera 442 443 prop: 444 id:minage 445 name:Min reproduction age of forams 446 type:x 447 group:Foraminifera 448 449 prop: 450 id:minenerg 451 name:Min reproduction energy of forams 452 type:x 453 group:Foraminifera 454 455 prop: 456 id:nutrient_range 457 name:Range of nutrient smell 460 458 type:d 0 10000 10000 461 459 … … 466 464 467 465 prop: 468 id:p size469 name:Initial population size466 id:popsize 467 name:Initial forams population size 470 468 type:d 1 1000 100 471 472 prop: 473 id:logging 474 name:Log statistics to file 475 type:d 0 1 0 476 477 prop: 478 id:ofnumh 469 group:Foraminifera 470 471 prop: 472 id:energy0h 479 473 name:Number of offspring from haploid forams 480 474 type:d … … 482 476 483 477 prop: 484 id: ofnumd478 id:energy0d 485 479 name:Number of offspring from diploid forams 486 480 type:d … … 491 485 name:Probability of reproduction 492 486 type:f 0 1 0.9 487 group:Foraminifera 493 488 494 489 prop: … … 496 491 name:Crossover probability 497 492 type:f 0 1 0 493 group:Foraminifera 498 494 499 495 prop: … … 501 497 name:Mutation probability 502 498 type:f 0 1 0 499 group:Foraminifera 503 500 504 501 prop: … … 519 516 type:f -1 50 520 517 help:~ 521 Vertical position (above the surface) where new creatures are revived.518 Vertical position (above the surface) where new Forams are revived. 522 519 Negative values are only used in the water area: 523 520 0 = at the surface … … 541 538 prop: 542 539 id:feede0 543 name: Food's energy540 name:Nutrients's energy 544 541 group:Energy 545 542 type:f 0 1000 … … 552 549 553 550 prop: 554 id: foodgen555 name: Food's genotype551 id:nutrientgen 552 name:Nutrients's genotype 556 553 group:Energy 557 554 type:s 1 555 556 prop: 557 id:nutrientsize 558 name:Nutrients's size 559 group:Energy 560 type:f 0.1 561 562 prop: 563 id:nutrientPop 564 name:Nutrients population size 565 group:Energy 566 type:d 1 1000 10 567 568 state: 569 id:nutrient 570 name:Nutrients locations 571 help:vector of vectors [x,y,energy] 572 type:x 573 flags:32 558 574 559 575 prop: … … 573 589 state: 574 590 id:totaltestedcr 575 name:Evaluated creatures576 help:Total number of the creatures evaluated in the experiment591 name:Evaluated Forams 592 help:Total number of the Forams evaluated in the experiment 577 593 type:d 578 594 flags:16 579 595 580 596 prop: 581 id:foodPop 582 name:Food size 583 type:d 1 1000 10 584 585 state: 586 id:food 587 name:Food locations 588 help:vector of vectors [x,y,energy] 589 type:x 590 flags:32 597 id:logging 598 name:Log statistics to file 599 type:d 0 1 0 -
experiments/frams/foraminifera/data/scripts/foraminifera.inc
r418 r421 6 6 function reproduce_haploid(parent, parent2) 7 7 { 8 var number = parent.user2["Va"] / ExpParams. ofnumd + parent2.user2["Va"] / ExpParams.ofnumd;8 var number = parent.user2["Va"] / ExpParams.energy0d + parent2.user2["Va"] / ExpParams.energy0d; 9 9 10 10 for (var j = 0; j < number; j++) 11 11 { 12 createOffspring(ExpParams.gend, ExpParams. ofnumd, [parent.user1, parent2.user1], {"Va" : ExpParams.ofnumd, "gen" : 1 , "growth_step" : ExpParams.growth_step, "rsize": ExpParams.rads[1], "vinit": ExpParams.ofnumd}); //TODO genes from both generations in user112 createOffspring(ExpParams.gend, ExpParams.energy0d, [parent.user1, parent2.user1], {"Va" : ExpParams.energy0d, "gen" : 1 , "growth_step" : ExpParams.growth_step, "rsize": ExpParams.rads[1], "vinit": ExpParams.energy0d}); //TODO genes from both generations in user1 13 13 } 14 14 } … … 16 16 function reproduce_diploid(parent) 17 17 { 18 var number = parent.user2["Va"] / ExpParams. ofnumh;18 var number = parent.user2["Va"] / ExpParams.energy0h; 19 19 for (var j = 0; j < number / 2; j++) 20 20 { … … 23 23 if (Math.rnd01 < ExpParams.crossprob) 24 24 { 25 crossover(parent, " vamin");25 crossover(parent, "minenergy"); 26 26 crossed = 1; 27 27 } … … 29 29 for (var k = 0; k < 2; k++) 30 30 { 31 createOffspring(ExpParams.genh, ExpParams. ofnumh, {"vamin" : ExpParams.v_min_h, "amin": ExpParams.age_min_h}, {"Va" : ExpParams.ofnumh, "gen" : 0 , "growth_step" : ExpParams.growth_step, "rsize" : ExpParams.rads[0], "vinit": ExpParams.ofnumh});31 createOffspring(ExpParams.genh, ExpParams.energy0h, {"minenergy" : ExpParams.minenerg[0], "minage": ExpParams.minage[0]}, {"Va" : ExpParams.energy0h, "gen" : 0 , "growth_step" : ExpParams.growth_step, "rsize" : ExpParams.rads[0], "vinit": ExpParams.energy0h}); //TODO different vamin and amin for haploids and diploids? 32 32 } 33 33 … … 35 35 if (crossed == 1) 36 36 { 37 crossover(parent, " vamin");37 crossover(parent, "minenergy"); 38 38 crossed = 0; 39 39 } … … 61 61 function onStep() 62 62 { 63 var haploids = 0;64 var diploids = 0;65 var e_inc_h = 0.0;66 var e_inc_d = 0.0;67 var e_nut = 0.0;68 var size_h = 0.0;69 var size_d = 0.0;70 var vmin_h = 0.0;71 var vmin_d = 0.0;72 73 for (var i = 0; i < Populations[0].size; i++)74 {75 var cr = Populations[0].get(i);76 if (cr.user2["gen"] == 0)77 {78 haploids += 1;79 e_inc_h += cr.energy;80 size_h += ExpParams.rads[0]; //TODO change of size dependent on gene81 vmin_h += cr.user1["vamin"];82 }83 else if (cr.user2["gen"] == 1)84 {85 diploids += 1;86 e_inc_d += cr.energy;87 size_d += ExpParams.rads[1]; //TODO change of size dependent on gene88 vmin_d += cr.user1[0]["vamin"];89 }90 }91 92 for (var i = 0; i < Populations[1].size; i++)93 {94 var cr = Populations[1].get(i);95 e_nut += cr.energy;96 }97 98 if (haploids < 2 && diploids == 0)99 {100 Simulator.print("no more creatures, stopped.");101 Simulator.stop();102 }103 104 var l1 = [haploids, diploids, Populations[1].size];105 var l2 = [e_inc_h, e_inc_d, e_nut];106 var dp = diploids;107 var hp = haploids;108 if (dp == 0) dp = 0.000001;109 if (hp == 0) hp = 0.000001;110 var l3 = [size_h / hp, vmin_h / hp, size_d / dp, vmin_d / dp];111 63 112 64 if (ExpParams.logging == 1) 113 65 { 114 log(l1, "log.txt"); 115 log(l2, "log2.txt"); 116 log(l3, "log3.txt"); 66 createStatistics(); 117 67 } 118 //food growth --------------------------------------------- 119 foodenergywaiting = foodenergywaiting + ExpParams.feedrate; 120 if (foodenergywaiting > ExpParams.feede0) 68 69 //nutrient growth --------------------------------------------- 70 nutrientenergywaiting = nutrientenergywaiting + ExpParams.feedrate; 71 if (nutrientenergywaiting > ExpParams.feede0) 121 72 { 122 for (var i = 0; i < ExpParams. foodPop; i++)73 for (var i = 0; i < ExpParams.nutrientPop; i++) 123 74 { 124 add food();75 addNutrient(); 125 76 } 126 77 127 foodenergywaiting = 0.0;78 nutrientenergywaiting = 0.0; 128 79 Simulator.checkpoint(); 129 80 } … … 183 134 } 184 135 136 function createStatistics() 137 { 138 var haploids = 0; 139 var diploids = 0; 140 var e_inc_h = 0.0; 141 var e_inc_d = 0.0; 142 var e_nut = 0.0; 143 var size_h = 0.0; 144 var size_d = 0.0; 145 var vmin_h = 0.0; 146 var vmin_d = 0.0; 147 148 for (var i = 0; i < Populations[0].size; i++) 149 { 150 var cr = Populations[0].get(i); 151 if (cr.user2["gen"] == 0) 152 { 153 haploids += 1; 154 e_inc_h += cr.energy; 155 size_h += ExpParams.rads[0]; //TODO change of size dependent on gene 156 vmin_h += cr.user1["minenergy"]; 157 } 158 else if (cr.user2["gen"] == 1) 159 { 160 diploids += 1; 161 e_inc_d += cr.energy; 162 size_d += ExpParams.rads[1]; //TODO change of size dependent on gene 163 vmin_d += cr.user1[0]["minenergy"]; 164 } 165 } 166 167 for (var i = 0; i < Populations[1].size; i++) 168 { 169 var cr = Populations[1].get(i); 170 e_nut += cr.energy; 171 } 172 173 var l1 = [haploids, diploids, Populations[1].size]; 174 var l2 = [e_inc_h, e_inc_d, e_nut]; 175 var dp = diploids; 176 var hp = haploids; 177 if (dp == 0) dp = 0.000001; 178 if (hp == 0) hp = 0.000001; 179 var l3 = [size_h / hp, vmin_h / hp, size_d / dp, vmin_d / dp]; 180 181 log(l1, "log_sizes.txt"); 182 log(l2, "log_energy.txt"); 183 log(l3, "log_sizes_v.txt"); 184 } 185 185 // -------------------------------- step end --------------------------------
Note: See TracChangeset
for help on using the changeset viewer.