MCPcopy Create free account
hub / github.com/devosoft/avida / Inst_ApplyPointMutationsGroupRandom

Method Inst_ApplyPointMutationsGroupRandom

avida-core/source/cpu/cHardwareCPU.cc:10817–10841  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10815}
10816
10817bool cHardwareCPU::Inst_ApplyPointMutationsGroupRandom(cAvidaContext& ctx)
10818{
10819 double point_mut_prob = m_world->GetConfig().INST_POINT_MUT_PROB.Get();
10820
10821 // Check for test CPU
10822 if (m_organism->GetOrgInterface().GetDeme() == NULL) return false;
10823
10824 // Grab a random member of the deme.
10825 // Pick a random starting location...
10826
10827 int deme_size = m_organism->GetDeme()->GetSize();
10828 int start_pos = ctx.GetRandom().GetInt(0,deme_size);
10829
10830 for (int i=0; i<deme_size; ++i) {
10831 int pos = (i + start_pos) % deme_size;
10832 cPopulationCell& cell = m_organism->GetDeme()->GetCell(pos);
10833 if (cell.IsOccupied()) {
10834 cOrganism* sl = cell.GetOrganism();
10835 int num_mut = sl->GetHardware().PointMutate(ctx, point_mut_prob);
10836 sl->IncPointMutations(num_mut);
10837 return true;
10838 }
10839 }
10840 return true;
10841}
10842
10843bool cHardwareCPU::Inst_ApplyPointMutationsGroupGS(cAvidaContext& ctx)
10844{

Callers

nothing calls this directly

Calls 11

GetConfigMethod · 0.80
GetIntMethod · 0.80
IsOccupiedMethod · 0.80
PointMutateMethod · 0.80
GetHardwareMethod · 0.80
IncPointMutationsMethod · 0.80
GetMethod · 0.45
GetDemeMethod · 0.45
GetSizeMethod · 0.45
GetCellMethod · 0.45
GetOrganismMethod · 0.45

Tested by

no test coverage detected