From 7493c4b525820b7d15747ea4a90bbf31624f68a3 Mon Sep 17 00:00:00 2001 From: Matthew Andres Moreno Date: Wed, 14 Feb 2024 19:11:40 -0500 Subject: [PATCH 1/2] Note misleading DEATH_PROB config description --- avida-core/source/main/cAvidaConfig.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/avida-core/source/main/cAvidaConfig.h b/avida-core/source/main/cAvidaConfig.h index 7a2924bdd..60b95447c 100644 --- a/avida-core/source/main/cAvidaConfig.h +++ b/avida-core/source/main/cAvidaConfig.h @@ -369,7 +369,7 @@ class cAvidaConfig { CONFIG_ADD_VAR(PREFER_EMPTY, int, 1, "Overide BIRTH_METHOD to preferentially choose empty cells for offsping?"); CONFIG_ADD_VAR(ALLOW_PARENT, int, 1, "Should parents be considered when deciding where to place offspring?"); CONFIG_ADD_VAR(DISPERSAL_RATE, double, 0.0, "Rate of dispersal under birth method 11\n(poisson distributed random connection list hops)"); - CONFIG_ADD_VAR(DEATH_PROB, double, 0.0, "Probability of death when dividing."); + CONFIG_ADD_VAR(DEATH_PROB, double, 0.0, "Probability of death when dividing. (@MAM: actually seems to be applied per-update?)"); CONFIG_ADD_VAR(DEATH_METHOD, int, 2, "When should death by old age occur?\n0 = Never\n1 = When executed AGE_LIMIT (+deviation) total instructions\n2 = When executed genome_length * AGE_LIMIT (+dev) instructions"); CONFIG_ADD_VAR(AGE_LIMIT, int, 20, "See DEATH_METHOD"); CONFIG_ADD_VAR(AGE_DEVIATION, int, 0, "Creates a normal distribution around AGE_LIMIT for time of death"); From d9f590e3e0b97a71c7a7712cd041c6e16576ce94 Mon Sep 17 00:00:00 2001 From: Matthew Andres Moreno Date: Thu, 15 Feb 2024 01:23:33 +0000 Subject: [PATCH 2/2] Impl DEATH_PROB_PARENT --- avida-core/source/main/cAvidaConfig.h | 1 + avida-core/source/main/cPopulation.cc | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/avida-core/source/main/cAvidaConfig.h b/avida-core/source/main/cAvidaConfig.h index 60b95447c..6085ee050 100644 --- a/avida-core/source/main/cAvidaConfig.h +++ b/avida-core/source/main/cAvidaConfig.h @@ -370,6 +370,7 @@ class cAvidaConfig { CONFIG_ADD_VAR(ALLOW_PARENT, int, 1, "Should parents be considered when deciding where to place offspring?"); CONFIG_ADD_VAR(DISPERSAL_RATE, double, 0.0, "Rate of dispersal under birth method 11\n(poisson distributed random connection list hops)"); CONFIG_ADD_VAR(DEATH_PROB, double, 0.0, "Probability of death when dividing. (@MAM: actually seems to be applied per-update?)"); + CONFIG_ADD_VAR(DEATH_PROB_PARENT, double, 0.0, "Probability of death when dividing. (@MAM: proper DEATH_PROB impl)"); CONFIG_ADD_VAR(DEATH_METHOD, int, 2, "When should death by old age occur?\n0 = Never\n1 = When executed AGE_LIMIT (+deviation) total instructions\n2 = When executed genome_length * AGE_LIMIT (+dev) instructions"); CONFIG_ADD_VAR(AGE_LIMIT, int, 20, "See DEATH_METHOD"); CONFIG_ADD_VAR(AGE_DEVIATION, int, 0, "Creates a normal distribution around AGE_LIMIT for time of death"); diff --git a/avida-core/source/main/cPopulation.cc b/avida-core/source/main/cPopulation.cc index d9504b27b..4070d3840 100644 --- a/avida-core/source/main/cPopulation.cc +++ b/avida-core/source/main/cPopulation.cc @@ -705,6 +705,10 @@ bool cPopulation::ActivateOffspring(cAvidaContext& ctx, const Genome& offspring_ // Loop through choosing the later placement of each offspring in the population. bool parent_alive = true; // Will the parent live through this process? + if (m_world->GetConfig().DEATH_PROB_PARENT.Get() && ctx.GetRandom().P(m_world->GetConfig().DEATH_PROB_PARENT.Get())) { + parent_alive = false; + } + for (int i = 0; i < offspring_array.GetSize(); i++) { target_cells[i] = PositionOffspring(parent_cell, ctx, m_world->GetConfig().ALLOW_PARENT.Get()).GetID(); // Catch the corner case where birth method = 3 and there are