1 | expdef:
|
---|
2 | name:Reproduction of benthic foraminifera
|
---|
3 | info:~
|
---|
4 | Genes and parameter values which control reproduction are stored in user1 and user2 fields.
|
---|
5 |
|
---|
6 | user1:
|
---|
7 | genes which are not encoded in Ff genotype:
|
---|
8 | min_repro_energy - Minimum energy necessary for reproduction
|
---|
9 | hibernation - Defines foram behavior in the case of no nutrients
|
---|
10 |
|
---|
11 | user2:
|
---|
12 | Physiological parameters of foraminifera:
|
---|
13 | max_energy_level - maximum energy level reached so far
|
---|
14 | gen - generation: 0 haploid, 1 diploid
|
---|
15 | species - species: 0 not hibernating 1 hibernating
|
---|
16 | hibernated - 0/1 foram isn't/is hibernated
|
---|
17 | reproduce - 0/1 foram isn't/is ready for reproduction
|
---|
18 | ~
|
---|
19 | code:~
|
---|
20 |
|
---|
21 | /*
|
---|
22 | changes 2015-06-24:
|
---|
23 | - xxx.get(...) changed to xxx[...]
|
---|
24 | - xxx.set(...,...) changed to xxx[...]=...
|
---|
25 | - 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)
|
---|
26 | - use creature's center (not the bbox corner) when growing
|
---|
27 | - added "S" receptor to visualize the difference between diplo and haplo generations
|
---|
28 | - signal.value is a MechPart (a reference) so it does not have to be updated after changing the object location
|
---|
29 | */
|
---|
30 |
|
---|
31 | global nutrientenergywaiting;
|
---|
32 | global reprocounter;
|
---|
33 | global colors;
|
---|
34 | global chambers;
|
---|
35 | global o;
|
---|
36 | global max_chamber_energ;
|
---|
37 |
|
---|
38 |
|
---|
39 | @include "foraminifera.inc"
|
---|
40 |
|
---|
41 | // -------------------------------- experiment begin --------------------------------
|
---|
42 |
|
---|
43 | function onExpDefLoad()
|
---|
44 | {
|
---|
45 | // define genotype and creature groups
|
---|
46 | GenePools.clear();
|
---|
47 | Populations.clear();
|
---|
48 | GenePools[0].name = "Unused";
|
---|
49 |
|
---|
50 | var pop = Populations[0];
|
---|
51 | pop.name = "Forams";
|
---|
52 | pop.en_assim = 0;
|
---|
53 | pop.nnsim = 0;
|
---|
54 | pop.enableperf = 1;
|
---|
55 | pop.death = 1;
|
---|
56 | pop.energy = 1;
|
---|
57 | pop.selfmask = 0x10001;
|
---|
58 | pop.othermask = 0x20001;
|
---|
59 | //pop.selfmask = 0x20002; pop.othermask = 0x10002;
|
---|
60 | pop.perfperiod = 25;
|
---|
61 |
|
---|
62 | pop = Populations.addGroup("Nutrients");
|
---|
63 | pop.nnsim = 0;
|
---|
64 | pop.enableperf = 0;
|
---|
65 | pop.death = 1;
|
---|
66 | pop.energy = 1;
|
---|
67 | pop.selfmask = 0x20002;
|
---|
68 | pop.othermask = 0x10000;
|
---|
69 | //pop.othermask = 0x10002;
|
---|
70 |
|
---|
71 | //world
|
---|
72 | SignalView.mode = 1;
|
---|
73 | ExpParams.world_size = 100;
|
---|
74 | World.wrldwat = ExpParams.world_size;
|
---|
75 | World.wrldsiz = ExpParams.world_size;
|
---|
76 | World.wrldbnd = 1;
|
---|
77 | ExpParams.stress = 1;
|
---|
78 | ExpParams.creath = -0.99; //just above the bottom
|
---|
79 | ExpParams.autorestart = 0;
|
---|
80 |
|
---|
81 | //ExpParams.logging = 1; //uncomment to enable logging simulation parameters to log files
|
---|
82 |
|
---|
83 | //reproduction
|
---|
84 | ExpParams.foramPop = 3;
|
---|
85 | ExpParams.crossprob = 0.4;
|
---|
86 | ExpParams.mutationprob = 0.2;
|
---|
87 | ExpParams.repro_time = 20;
|
---|
88 | reprocounter = 0;
|
---|
89 |
|
---|
90 | //morphology
|
---|
91 | init_chambers();
|
---|
92 | ExpParams.chamber_proculus_haplo = scale(60);
|
---|
93 | ExpParams.chamber_difference_haplo = 0.0;
|
---|
94 | ExpParams.chamber_proculus_diplo = scale(20);
|
---|
95 | ExpParams.chamber_difference_diplo = 0.2;
|
---|
96 | max_chamber_energ = [Vector.new(), Vector.new()];
|
---|
97 | for (var j = 0; j < 2; j++)
|
---|
98 | {
|
---|
99 | for (var i = 0; i < chambers[0].size; i++)
|
---|
100 | {
|
---|
101 | max_chamber_energ[j].add(((Math.pow(getProperty(j, "chamber_proculus"),3) + Math.pow(getProperty(j, "chamber_proculus") + (i) * getProperty(j, "chamber_difference"),3))*(i+1))/2);
|
---|
102 |
|
---|
103 | }
|
---|
104 | }
|
---|
105 | ExpParams.zone1_range = scale(250);
|
---|
106 | ExpParams.zone2_range = scale(5000);
|
---|
107 |
|
---|
108 | //energetics
|
---|
109 | ExpParams.min_repro_energ_haplo = max_chamber_energ[0][2];
|
---|
110 | ExpParams.min_repro_energ_diplo = max_chamber_energ[1][8];
|
---|
111 | ExpParams.e_meta = 0.00003 * max_chamber_energ[0][0];
|
---|
112 | ExpParams.energy_hib = 0.00003 * max_chamber_energ[0][0];
|
---|
113 | ExpParams.energy_move = 0.0003 * max_chamber_energ[0][0];
|
---|
114 | ExpParams.energies0_haplo = max_chamber_energ[0][0] - 0.1*max_chamber_energ[0][0];
|
---|
115 | ExpParams.energies0_diplo = max_chamber_energ[1][0] - 0.1*max_chamber_energ[1][0];
|
---|
116 | ExpParams.feedtrans = 0.05;
|
---|
117 | ExpParams.e_repro_cost_haplo = 0.5;
|
---|
118 | ExpParams.e_repro_cost_diplo = 0.3;
|
---|
119 |
|
---|
120 | //nutrients
|
---|
121 | ExpParams.nutrientsize = scale(10);
|
---|
122 | ExpParams.energy_nut = 100 * Math.pow(ExpParams.nutrientsize, 3);
|
---|
123 | ExpParams.nutrientPop = 10;
|
---|
124 | ExpParams.feedrate = 0.0025;
|
---|
125 | nutrientenergywaiting = ExpParams.energy_nut;
|
---|
126 | ExpState.totaltestedcr = 0;
|
---|
127 | ExpState.nutrient = "";
|
---|
128 | }
|
---|
129 |
|
---|
130 | @include "standard_placement.inc"
|
---|
131 |
|
---|
132 | function scale(x)
|
---|
133 | {
|
---|
134 | return x*0.025;
|
---|
135 | }
|
---|
136 |
|
---|
137 | function getProperty(gen, prop_id)
|
---|
138 | {
|
---|
139 | var ploid = "haplo";
|
---|
140 | if (gen == 1) ploid = "diplo";
|
---|
141 | return ExpParams.[prop_id + "_" + ploid];
|
---|
142 | }
|
---|
143 |
|
---|
144 | function addInitialForam(species, i)
|
---|
145 | {
|
---|
146 | var geno = createForamGenotype(0, species, 0);
|
---|
147 | var cr = Populations[0].add(geno);
|
---|
148 | cr.name = "Initial creature" + species + "_" + i;
|
---|
149 | placeCreatureRandomly(cr, 0, 0);
|
---|
150 | cr.energy0 = getProperty(0, "energies0");
|
---|
151 | cr.energy = cr.energy0;
|
---|
152 | setGenotype({"opt" : 0, "cr" : cr, "species" : species});
|
---|
153 | }
|
---|
154 |
|
---|
155 | function onExpInit()
|
---|
156 | {
|
---|
157 | Populations[0].clear();
|
---|
158 | Populations[1].clear();
|
---|
159 |
|
---|
160 | for (var i = 0; i < ExpParams.foramPop; i++)
|
---|
161 | {
|
---|
162 | addInitialForam(0, i);
|
---|
163 | addInitialForam(1, i);
|
---|
164 | }
|
---|
165 | o = Populations[0][0].getMechPart(0).orient.clone();
|
---|
166 | ExpState.totaltestedcr = 0;
|
---|
167 | nutrientenergywaiting = ExpParams.energy_nut;
|
---|
168 | }
|
---|
169 |
|
---|
170 | function onExpLoad()
|
---|
171 | {
|
---|
172 | for (var pop in Populations)
|
---|
173 | pop.clear();
|
---|
174 |
|
---|
175 | Loader.addClass(sim_params.*);
|
---|
176 | Loader.setBreakLabel(Loader.BeforeUnknown, "onExpLoad_Unknown");
|
---|
177 | Loader.run();
|
---|
178 |
|
---|
179 | Simulator.print("Loaded " + Populations[0].size + " Forams and " + Populations[1].size + " nutrient objects");
|
---|
180 | }
|
---|
181 |
|
---|
182 | function onExpLoad_Unknown()
|
---|
183 | {
|
---|
184 | if (Loader.objectName == "org") // saved by the old expdef
|
---|
185 | {
|
---|
186 | var g = Genotype.newFromString("");
|
---|
187 | Loader.currentObject = g;
|
---|
188 | Interface.makeFrom(g).setAllDefault();
|
---|
189 | Loader.loadObject();
|
---|
190 | var cr = Populations[0].add(g);
|
---|
191 | if (cr != null)
|
---|
192 | {
|
---|
193 | //cr.rotate(0,0,Math.rnd01*Math.twopi);
|
---|
194 | if ((typeof(g.user1) == "Vector") && (g.user1.size >= 3))
|
---|
195 | {
|
---|
196 | // [x,y,energy]
|
---|
197 | cr.move(g.user1[0] - cr.center_x, g.user1[1] - cr.center_y, 0);
|
---|
198 | cr.energy = g.user1[2];
|
---|
199 | }
|
---|
200 | else
|
---|
201 | {
|
---|
202 | cr.move(Math.rnd01 * World.wrldsiz - cr.center_x, Math.rnd01 * World.wrldsiz - cr.center_y, 0);
|
---|
203 | }
|
---|
204 | }
|
---|
205 | }
|
---|
206 | else if (Loader.objectName == "Creature")
|
---|
207 | {
|
---|
208 | Loader.currentObject = CreatureSnapshot.new();
|
---|
209 | Loader.loadObject();
|
---|
210 | Populations[0].add(Loader.currentObject);
|
---|
211 | }
|
---|
212 | }
|
---|
213 |
|
---|
214 | function onExpSave()
|
---|
215 | {
|
---|
216 | File.writeComment("saved by '%s.expdef'" % Simulator.expdef);
|
---|
217 |
|
---|
218 | var tmpvec = [], i;
|
---|
219 |
|
---|
220 | for(var cr in Populations[1])
|
---|
221 | tmpvec.add([cr.center_x, cr.center_y, cr.energy]);
|
---|
222 |
|
---|
223 | ExpState.nutrient = tmpvec;
|
---|
224 | File.writeObject(sim_params.*);
|
---|
225 | ExpState.nutrient = null; //vectors are only created for saving and then discarded
|
---|
226 |
|
---|
227 | for (var cr in Populations[0])
|
---|
228 | File.writeObject(cr);
|
---|
229 | }
|
---|
230 |
|
---|
231 | // -------------------------------- experiment end --------------------------------
|
---|
232 |
|
---|
233 | // -------------------------------- foram begin -----------------------------------
|
---|
234 |
|
---|
235 | function onForamsBorn(cr)
|
---|
236 | {
|
---|
237 | cr.idleen = ExpParams.e_meta;
|
---|
238 | }
|
---|
239 |
|
---|
240 | function placeRandomlyNotColliding(cr)
|
---|
241 | {
|
---|
242 | var retry = 100; //try 100 times
|
---|
243 | while (retry--)
|
---|
244 | {
|
---|
245 | placeCreatureRandomly(cr, 0, 0);
|
---|
246 | if (!cr.boundingBoxCollisions(0))
|
---|
247 | return cr;
|
---|
248 | }
|
---|
249 |
|
---|
250 | Populations[0].delete(cr);
|
---|
251 | }
|
---|
252 |
|
---|
253 | function foramGrow(cr, chamber_num)
|
---|
254 | {
|
---|
255 | var geno = createForamGenotype(cr.user2["gen"], cr.user2["species"], chamber_num);
|
---|
256 | var cr2 = Populations[0].add(geno);
|
---|
257 |
|
---|
258 | cr2.energy0 = cr.energy;
|
---|
259 | cr2.energy = cr2.energy0;
|
---|
260 |
|
---|
261 | setGenotype({"cr" : cr2, "parent_user1" : cr.user1, "parent_user2" : cr.user2, "opt" : 2});
|
---|
262 | cr2.moveAbs(cr.center_x - cr2.size_x / 2, cr.center_y - cr2.size_y / 2, cr.pos_z);
|
---|
263 |
|
---|
264 | Populations[0].delete(cr);
|
---|
265 | }
|
---|
266 |
|
---|
267 | function stepToNearest(cr, range)
|
---|
268 | {
|
---|
269 | var p = cr.getMechPart(0);
|
---|
270 | var n = cr.signals.receiveSet("nutrient", ExpParams.zone2_range);
|
---|
271 |
|
---|
272 | //if signals are received find the source of the nearest
|
---|
273 | if (n.size > 0)
|
---|
274 | {
|
---|
275 | var i;
|
---|
276 | var mp;
|
---|
277 | var distvec = XYZ.new(0, 0, 0);
|
---|
278 | var dist;
|
---|
279 | var mindist = 100000000000;
|
---|
280 | var mindistvec = null;
|
---|
281 |
|
---|
282 | for (i = 0; i < n.size; i++)
|
---|
283 | {
|
---|
284 | mp = n[i].value;
|
---|
285 | distvec.set(mp.pos);
|
---|
286 | distvec.sub(p.pos);
|
---|
287 | dist = distvec.length;
|
---|
288 | if (dist < mindist)
|
---|
289 | {
|
---|
290 | mindist = dist;
|
---|
291 | mindistvec = distvec.clone();
|
---|
292 | }
|
---|
293 | }
|
---|
294 |
|
---|
295 | mindistvec.normalize();
|
---|
296 | mindistvec.scale(-0.08);
|
---|
297 | cr.localDrive = mindistvec;
|
---|
298 | return 1;
|
---|
299 | }
|
---|
300 |
|
---|
301 | else
|
---|
302 | return 0;
|
---|
303 | }
|
---|
304 |
|
---|
305 | function moveEnergyDec(cr)
|
---|
306 | {
|
---|
307 | if (cr.user2["hibernated"] == 1)
|
---|
308 | {
|
---|
309 | cr.energy_m += ExpParams.energy_hib;
|
---|
310 | }
|
---|
311 | else
|
---|
312 | {
|
---|
313 | cr.energy_m += ExpParams.energy_move;
|
---|
314 | }
|
---|
315 | }
|
---|
316 |
|
---|
317 | function foramMove(cr)
|
---|
318 | {
|
---|
319 | //TODO moving inside sediment?
|
---|
320 |
|
---|
321 | //adjustment in z axis
|
---|
322 | cr.moveAbs(cr.pos_x, cr.pos_y, 0.5);
|
---|
323 |
|
---|
324 | //are there any nutrients in zone 1?
|
---|
325 | if (cr.boundingBoxCollisions() == 2)
|
---|
326 | {
|
---|
327 | if (cr.user2["hibernated"] == 1)
|
---|
328 | cr.user2["hibernated"] = 0;
|
---|
329 | return;
|
---|
330 | }
|
---|
331 |
|
---|
332 | else if (cr.user2["hibernated"] == 1)
|
---|
333 | {
|
---|
334 | moveEnergyDec(cr);
|
---|
335 | return;
|
---|
336 | }
|
---|
337 |
|
---|
338 | //are there any nutrients in zone 2?
|
---|
339 | else
|
---|
340 | {
|
---|
341 | var moved = stepToNearest(ExpParams.zone2_range); //TODO weighted sum of distance and energy
|
---|
342 | if (moved==1)
|
---|
343 | {
|
---|
344 | moveEnergyDec(cr);
|
---|
345 | return;
|
---|
346 | }
|
---|
347 | }
|
---|
348 |
|
---|
349 | //no nutrients in zone 2
|
---|
350 |
|
---|
351 | var hibernation = 0;
|
---|
352 | if (cr.user2["gen"] == 0) hibernation = cr.user1["hibernation"];
|
---|
353 | else hibernation = cr.user1[0]["hibernation"];
|
---|
354 | //hibernation
|
---|
355 | if (hibernation == 1)
|
---|
356 | {
|
---|
357 | moveEnergyDec(cr);
|
---|
358 | cr.user2["hibernated"] = 1;
|
---|
359 | cr.localDrive = XYZ.new(0,0,0);
|
---|
360 | }
|
---|
361 | //random move
|
---|
362 | else
|
---|
363 | {
|
---|
364 | cr.localDrive = (0.1 * Math.rnd01, 0.1 * Math.rnd01, 0);
|
---|
365 | moveEnergyDec(cr);
|
---|
366 | }
|
---|
367 | }
|
---|
368 |
|
---|
369 | function onForamsCollision()
|
---|
370 | {
|
---|
371 | if (Collision.Creature1.user2 != null)
|
---|
372 | {
|
---|
373 | Collision.Creature1.localDrive = XYZ.new(0,0,0);
|
---|
374 | var e = Collision.Part2.ing * ExpParams.feedtrans; //TODO efficiency dependent on age
|
---|
375 | //Simulator.print("transferring "+e+" to "+Collision.Creature1.name+" from "+Collision.Creature2.name+" ("+Collision.Creature2.energy+")");
|
---|
376 | Collision.Creature2.energy_m = Collision.Creature2.energy_m + e;
|
---|
377 | Collision.Creature1.energy_p = Collision.Creature1.energy_p + e;
|
---|
378 | Collision.Creature1.user2["hibernated"] = 0;
|
---|
379 | }
|
---|
380 | }
|
---|
381 |
|
---|
382 | function onForamsStep(cr)
|
---|
383 | {
|
---|
384 | cr.getMechPart(0).orient.set(o);
|
---|
385 |
|
---|
386 | if (deathConditions(cr) == 1)
|
---|
387 | {
|
---|
388 | Populations[0].kill(cr);
|
---|
389 | return;
|
---|
390 | }
|
---|
391 |
|
---|
392 | foramMove(cr);
|
---|
393 |
|
---|
394 | cr.user2["max_energy_level"] = Math.max(cr.energy, cr.user2["max_energy_level"]);
|
---|
395 | if (cr.numparts <= chambers[0].size)
|
---|
396 | {
|
---|
397 | if ((cr.user2["max_energy_level"] >= max_chamber_energ[cr.user2["gen"]][cr.numparts-1]))
|
---|
398 | {
|
---|
399 | foramGrow(cr, cr.numparts);
|
---|
400 | return;
|
---|
401 | }
|
---|
402 | }
|
---|
403 |
|
---|
404 | foramReproduce(cr);
|
---|
405 | }
|
---|
406 |
|
---|
407 | function deathConditions(cr)
|
---|
408 | {
|
---|
409 | if ((cr.energy <= ExpParams.e_death_level) || (Math.rnd01 < ExpParams.hunted_prob))
|
---|
410 | return 1;
|
---|
411 | else
|
---|
412 | return 0;
|
---|
413 | }
|
---|
414 |
|
---|
415 | function onForamsDied(cr)
|
---|
416 | {
|
---|
417 | //fossilization
|
---|
418 | var geno = GenePools[0].add(cr.genotype);
|
---|
419 | geno.user1 = cr.user1;
|
---|
420 | geno.user2 = cr.user2;
|
---|
421 | if (ExpParams.logging == 1) Simulator.print("\"" + cr.name + "\" died...");
|
---|
422 | ExpState.totaltestedcr++;
|
---|
423 | }
|
---|
424 |
|
---|
425 | // --------------------------------foram end -------------------------------------
|
---|
426 |
|
---|
427 | // -------------------------------- nutrient begin --------------------------------
|
---|
428 |
|
---|
429 | function createNutrientGenotype(nutrientsize, zone1_range)
|
---|
430 | {
|
---|
431 | return "//0\np:sh=3,sx="+nutrientsize+",sy="+(zone1_range + nutrientsize)+",sz="+(zone1_range+nutrientsize)+",ry=1.5,vr=0.0,1.0,0.0";
|
---|
432 | }
|
---|
433 |
|
---|
434 | function onNutrientsStep(cr)
|
---|
435 | {
|
---|
436 | cr.moveAbs(cr.pos_x % ExpParams.world_size, cr.pos_y % ExpParams.world_size, -ExpParams.zone1_range+0.5);
|
---|
437 | }
|
---|
438 |
|
---|
439 | function addNutrient()
|
---|
440 | {
|
---|
441 | var cr = Populations[1].add(createNutrientGenotype(ExpParams.nutrientsize, ExpParams.zone1_range));
|
---|
442 |
|
---|
443 | cr.name = "Nutrients";
|
---|
444 | cr.idleen = 0;
|
---|
445 | cr.energy0 = ExpParams.energy_nut;
|
---|
446 | cr.energy = cr.energy0;
|
---|
447 | cr.signals.add("nutrient");
|
---|
448 |
|
---|
449 | cr.signals[0].value = cr.getMechPart(0);
|
---|
450 |
|
---|
451 | placeCreatureRandomly(cr, 0, 0);
|
---|
452 | }
|
---|
453 |
|
---|
454 | function nutrientGrowth()
|
---|
455 | {
|
---|
456 | nutrientenergywaiting = nutrientenergywaiting + ExpParams.feedrate;
|
---|
457 | if (nutrientenergywaiting > ExpParams.energy_nut)
|
---|
458 | {
|
---|
459 | for (var i = 0; i < ExpParams.nutrientPop; i++)
|
---|
460 | {
|
---|
461 | addNutrient();
|
---|
462 | }
|
---|
463 |
|
---|
464 | nutrientenergywaiting = 0.0;
|
---|
465 | Simulator.checkpoint();
|
---|
466 | }
|
---|
467 | }
|
---|
468 |
|
---|
469 | // -------------------------------- nutrient end --------------------------------
|
---|
470 |
|
---|
471 | // -------------------------------- step begin --------------------------------
|
---|
472 |
|
---|
473 | function onStep()
|
---|
474 | {
|
---|
475 | if (ExpParams.logging == 1)
|
---|
476 | {
|
---|
477 | createStatistics();
|
---|
478 | }
|
---|
479 |
|
---|
480 | nutrientGrowth();
|
---|
481 |
|
---|
482 | //reproduction --------------------------------------------
|
---|
483 | reprocounter += 1;
|
---|
484 | if (reprocounter > ExpParams.repro_time)
|
---|
485 | {
|
---|
486 | reprocounter = 0;
|
---|
487 | reproduce_parents(0);
|
---|
488 | reproduce_parents(1);
|
---|
489 | }
|
---|
490 |
|
---|
491 | //check for extinction -----------------------------------------------
|
---|
492 | if (Populations[0].size == 0)
|
---|
493 | {
|
---|
494 | if (ExpParams.autorestart)
|
---|
495 | {
|
---|
496 | Simulator.print("no more creatures, restarting...");
|
---|
497 | onExpInit();
|
---|
498 | }
|
---|
499 | else
|
---|
500 | {
|
---|
501 | Simulator.print("no more creatures, stopped.");
|
---|
502 | Simulator.stop();
|
---|
503 | }
|
---|
504 | }
|
---|
505 | }
|
---|
506 |
|
---|
507 | function createStatistics()
|
---|
508 | {
|
---|
509 | var number_ploidy = [0, 0];
|
---|
510 | var number_species = [0, 0];
|
---|
511 | var e_inc = [0.0, 0.0];
|
---|
512 | var e_nut = 0.0;
|
---|
513 |
|
---|
514 | for (var i = 0; i < Populations[0].size; i++)
|
---|
515 | {
|
---|
516 | var cr = Populations[0].get(i);
|
---|
517 | var gen = cr.user2["gen"];
|
---|
518 | number_ploidy[gen] = number_ploidy[gen] + 1;
|
---|
519 | var species = cr.user2["species"];
|
---|
520 | number_species[species] = number_species[species] + 1;
|
---|
521 | e_inc[gen] = e_inc[gen] + cr.energy;
|
---|
522 | }
|
---|
523 |
|
---|
524 | for (var i = 0; i < Populations[1].size; i++)
|
---|
525 | {
|
---|
526 | var cr = Populations[1].get(i);
|
---|
527 | e_nut += cr.energy;
|
---|
528 | }
|
---|
529 |
|
---|
530 | var log_numbers = [number_ploidy[0], number_ploidy[1], Populations[1].size];
|
---|
531 | var log_species = [number_species[0], number_species[1]];
|
---|
532 | var log_energy = [e_inc[0], e_inc[1], e_nut];
|
---|
533 |
|
---|
534 | log(log_numbers, "log_sizes.txt");
|
---|
535 | log(log_species, "log_species.txt");
|
---|
536 | log(log_energy, "log_energy.txt");
|
---|
537 | }
|
---|
538 |
|
---|
539 | function log(tolog, fname)
|
---|
540 | {
|
---|
541 | var f = File.appendDirect(fname, "forams data");
|
---|
542 | f.writeString("" + Simulator.stepNumber);
|
---|
543 | for (var i = 0; i < tolog.size; i++)
|
---|
544 | {
|
---|
545 | f.writeString(";" + tolog[i]);
|
---|
546 | }
|
---|
547 | f.writeString("\n");
|
---|
548 | f.close();
|
---|
549 | }
|
---|
550 |
|
---|
551 | // -------------------------------- step end --------------------------------
|
---|
552 |
|
---|
553 | @include "standard_events.inc"
|
---|
554 |
|
---|
555 | ~
|
---|
556 |
|
---|
557 | prop:
|
---|
558 | id:e_repro_cost_haplo
|
---|
559 | name:Cost of reproduction
|
---|
560 | type:f 0.1 0.9 0.5
|
---|
561 | group:Foraminifera
|
---|
562 |
|
---|
563 | prop:
|
---|
564 | id:e_repro_cost_diplo
|
---|
565 | name:Cost of reproduction
|
---|
566 | type:f 0.1 0.9 0.3
|
---|
567 | group:Foraminifera
|
---|
568 |
|
---|
569 | prop:
|
---|
570 | id:chamber_proculus_haplo
|
---|
571 | name:Size of proculus
|
---|
572 | type:f
|
---|
573 | group:Foraminifera
|
---|
574 |
|
---|
575 | prop:
|
---|
576 | id:chamber_proculus_diplo
|
---|
577 | name:Size of proculus
|
---|
578 | type:f
|
---|
579 | group:Foraminifera
|
---|
580 |
|
---|
581 | prop:
|
---|
582 | id:chamber_difference_haplo
|
---|
583 | name:Difference in size between subsequent chambers
|
---|
584 | type:f
|
---|
585 | group:Foraminifera
|
---|
586 |
|
---|
587 | prop:
|
---|
588 | id:chamber_difference_diplo
|
---|
589 | name:Difference in size between subsequent chambers
|
---|
590 | type:f
|
---|
591 | group:Foraminifera
|
---|
592 |
|
---|
593 | prop:
|
---|
594 | id:hunted_prob
|
---|
595 | name:Probability of being hunted
|
---|
596 | type:f 0 1 0
|
---|
597 | group:Forminifera
|
---|
598 |
|
---|
599 | prop:
|
---|
600 | id:zone1_range
|
---|
601 | name:Zone 1 range
|
---|
602 | type:f 0 200
|
---|
603 | group:Foraminifera
|
---|
604 |
|
---|
605 | prop:
|
---|
606 | id:zone2_range
|
---|
607 | name:Zone 2 range
|
---|
608 | type:f 0 3000
|
---|
609 | group:Foraminifera
|
---|
610 |
|
---|
611 | prop:
|
---|
612 | id:colors
|
---|
613 | name:Haploid and diploid colors
|
---|
614 | type:x
|
---|
615 | group:Foraminifera
|
---|
616 |
|
---|
617 | prop:
|
---|
618 | id:min_repro_energ_haplo
|
---|
619 | name:Min reproduction energy of forams
|
---|
620 | type:f
|
---|
621 | group:Foraminifera
|
---|
622 |
|
---|
623 | prop:
|
---|
624 | id:min_repro_energ_diplo
|
---|
625 | name:Min reproduction energy of forams
|
---|
626 | type:f
|
---|
627 | group:Foraminifera
|
---|
628 |
|
---|
629 | prop:
|
---|
630 | id:repro_prob
|
---|
631 | name:Probability of reproduction
|
---|
632 | type:f 0 1 0.8
|
---|
633 | group:Foraminifera
|
---|
634 |
|
---|
635 | prop:
|
---|
636 | id:energies0_haplo
|
---|
637 | name:Energy of offspring from diploid forams
|
---|
638 | type:f
|
---|
639 | group:Foraminifera
|
---|
640 |
|
---|
641 | prop:
|
---|
642 | id:energies0_diplo
|
---|
643 | name:Energy of offspring from diploid forams
|
---|
644 | type:f
|
---|
645 | group:Foraminifera
|
---|
646 |
|
---|
647 | prop:
|
---|
648 | id:energy_hib
|
---|
649 | name:Energy used for hibernation during one step
|
---|
650 | type:f 0 1 0.001
|
---|
651 | group:Foraminifera
|
---|
652 |
|
---|
653 | prop:
|
---|
654 | id:energy_move
|
---|
655 | name:Energy used for movement during one step
|
---|
656 | type:f 0 20 0.001
|
---|
657 | group:Foraminifera
|
---|
658 |
|
---|
659 | prop:
|
---|
660 | id:min_vol
|
---|
661 | name:Minimal volume for reproduction
|
---|
662 | type:f 100 900 100
|
---|
663 | group:Foraminifera
|
---|
664 |
|
---|
665 | prop:
|
---|
666 | id:max_size
|
---|
667 | name:Maximal size
|
---|
668 | type:d 1 10 5
|
---|
669 | group:Foraminifera
|
---|
670 |
|
---|
671 | prop:
|
---|
672 | id:foramPop
|
---|
673 | name:Initial forams population size
|
---|
674 | type:d 1 1000 100
|
---|
675 | group:Foraminifera
|
---|
676 |
|
---|
677 | prop:
|
---|
678 | id:crossprob
|
---|
679 | name:Crossover probability
|
---|
680 | type:f 0 1 0
|
---|
681 | group:Foraminifera
|
---|
682 |
|
---|
683 | prop:
|
---|
684 | id:mutationprob
|
---|
685 | name:Mutation probability
|
---|
686 | type:f 0 1 0
|
---|
687 | group:Foraminifera
|
---|
688 |
|
---|
689 | prop:
|
---|
690 | id:e_death_level
|
---|
691 | name:Minimal level of energy to sustain life
|
---|
692 | type:f 0 20 0
|
---|
693 | group:Foraminifera
|
---|
694 |
|
---|
695 |
|
---|
696 | prop:
|
---|
697 | id:e_meta
|
---|
698 | name:Idle metabolism
|
---|
699 | type:f 0 1
|
---|
700 | group:Energy
|
---|
701 | help:Each stick consumes this amount of energy in one time step
|
---|
702 |
|
---|
703 | prop:
|
---|
704 | id:feedrate
|
---|
705 | name:Feeding rate
|
---|
706 | type:f 0 100
|
---|
707 | group:Energy
|
---|
708 | help:How fast energy is created in the world
|
---|
709 |
|
---|
710 | prop:
|
---|
711 | id:energy_nut
|
---|
712 | name:Nutrients's energy
|
---|
713 | type:f 0 1000
|
---|
714 | group:Energy
|
---|
715 |
|
---|
716 | prop:
|
---|
717 | id:feedtrans
|
---|
718 | name:Ingestion multiplier
|
---|
719 | type:f 0 100
|
---|
720 | group:Energy
|
---|
721 |
|
---|
722 | prop:
|
---|
723 | id:nutrientsize
|
---|
724 | name:Nutrients's size
|
---|
725 | type:f 0.1 0.9 0.1
|
---|
726 | group:Energy
|
---|
727 |
|
---|
728 | prop:
|
---|
729 | id:e_meta
|
---|
730 | name:Idle metabolism
|
---|
731 | type:f 0 1
|
---|
732 | group:Energy
|
---|
733 | help:Each stick consumes this amount of energy in one time step
|
---|
734 |
|
---|
735 | prop:
|
---|
736 | id:feedrate
|
---|
737 | name:Feeding rate
|
---|
738 | type:f 0 100
|
---|
739 | group:Energy
|
---|
740 | help:How fast energy is created in the world
|
---|
741 |
|
---|
742 | prop:
|
---|
743 | id:feedtrans
|
---|
744 | name:Ingestion multiplier
|
---|
745 | group:Energy
|
---|
746 | type:f 0 100
|
---|
747 |
|
---|
748 | prop:
|
---|
749 | id:nutrientsize
|
---|
750 | name:Nutrients's size
|
---|
751 | group:Energy
|
---|
752 | type:f 0.1
|
---|
753 |
|
---|
754 | prop:
|
---|
755 | id:nutrientPop
|
---|
756 | name:Nutrients population size
|
---|
757 | group:Energy
|
---|
758 | type:d 1 1000 10
|
---|
759 |
|
---|
760 |
|
---|
761 | prop:
|
---|
762 | id:world_size
|
---|
763 | name:World size
|
---|
764 | type:d 10 1000 20
|
---|
765 | group:World
|
---|
766 |
|
---|
767 | prop:
|
---|
768 | id:stress
|
---|
769 | name:Environmental stress
|
---|
770 | type:d 0 1 1
|
---|
771 | group:World
|
---|
772 |
|
---|
773 | prop:
|
---|
774 | id:repro_trigger
|
---|
775 | name:Reproduction trigger
|
---|
776 | type:d 0 1 1
|
---|
777 | group:World
|
---|
778 |
|
---|
779 |
|
---|
780 | prop:
|
---|
781 | id:repro_time
|
---|
782 | name:Time before reproduction
|
---|
783 | type:d 0 1000
|
---|
784 |
|
---|
785 | prop:
|
---|
786 | id:creath
|
---|
787 | name:Creation height
|
---|
788 | type:f -1 50
|
---|
789 | help:~
|
---|
790 | Vertical position (above the surface) where new Forams are revived.
|
---|
791 | Negative values are only used in the water area:
|
---|
792 | 0 = at the surface
|
---|
793 | -0.5 = half depth
|
---|
794 | -1 = just above the bottom~
|
---|
795 |
|
---|
796 | state:
|
---|
797 | id:nutrient
|
---|
798 | name:Nutrients locations
|
---|
799 | help:vector of vectors [x,y,energy]
|
---|
800 | type:x
|
---|
801 | flags:32
|
---|
802 |
|
---|
803 | prop:
|
---|
804 | id:autorestart
|
---|
805 | name:Restart after extinction
|
---|
806 | help:Restart automatically this experiment after the last creature has died?
|
---|
807 | type:d 0 1
|
---|
808 |
|
---|
809 | state:
|
---|
810 | id:notes
|
---|
811 | name:Notes
|
---|
812 | type:s 1
|
---|
813 | help:~
|
---|
814 | You can write anything here
|
---|
815 | (it will be saved to the experiment file)~
|
---|
816 |
|
---|
817 | state:
|
---|
818 | id:totaltestedcr
|
---|
819 | name:Evaluated Forams
|
---|
820 | help:Total number of the Forams evaluated in the experiment
|
---|
821 | type:d
|
---|
822 | flags:16
|
---|
823 |
|
---|
824 | prop:
|
---|
825 | id:logging
|
---|
826 | name:Log statistics to file
|
---|
827 | type:d 0 1 0
|
---|