[Avida-SVN] r2342 - development/source/main
barrick at myxo.css.msu.edu
barrick at myxo.css.msu.edu
Mon Feb 18 15:51:27 PST 2008
Author: barrick
Date: 2008-02-18 18:51:26 -0500 (Mon, 18 Feb 2008)
New Revision: 2342
Modified:
development/source/main/cPopulation.cc
development/source/main/cPopulation.h
development/source/main/cPopulationInterface.cc
Log:
Fix for spatial deme resources -- they weren't being consumed, but could be produced. Fix for deme germ-line mutation config options.
Modified: development/source/main/cPopulation.cc
===================================================================
--- development/source/main/cPopulation.cc 2008-02-18 22:01:49 UTC (rev 2341)
+++ development/source/main/cPopulation.cc 2008-02-18 23:51:26 UTC (rev 2342)
@@ -1177,13 +1177,13 @@
}
if((m_world->GetConfig().GERMLINE_INS_MUT.Get() > 0.0)
- && m_world->GetRandom().P(m_world->GetConfig().DIVIDE_INS_PROB.Get())) {
+ && m_world->GetRandom().P(m_world->GetConfig().GERMLINE_INS_MUT.Get())) {
const unsigned int mut_line = ctx.GetRandom().GetUInt(next_germ.GetSize() + 1);
next_germ.Insert(mut_line, instset.GetRandomInst(ctx));
}
if((m_world->GetConfig().GERMLINE_DEL_MUT.Get() > 0.0)
- && m_world->GetRandom().P(m_world->GetConfig().DIVIDE_DEL_PROB.Get())) {
+ && m_world->GetRandom().P(m_world->GetConfig().GERMLINE_DEL_MUT.Get())) {
const unsigned int mut_line = ctx.GetRandom().GetUInt(next_germ.GetSize());
next_germ.Remove(mut_line);
}
@@ -3460,13 +3460,12 @@
cPopulationCell& cell = GetCell(i);
// Correct gestation time for speculative execution
- cPhenotype & p = GetCell(i).GetOrganism()->GetPhenotype();
- p.SetTrialTimeUsed(p.GetTrialTimeUsed() - GetCell(i).GetSpeculativeState());
- p.SetTimeUsed(p.GetTimeUsed() - GetCell(i).GetSpeculativeState());
+ cPhenotype & p = cell.GetOrganism()->GetPhenotype();
+ p.SetTrialTimeUsed(p.GetTrialTimeUsed() - cell.GetSpeculativeState());
+ p.SetTimeUsed(p.GetTimeUsed() - cell.GetSpeculativeState());
-
- GetCell(i).GetOrganism()->NewTrial();
- GetCell(i).GetOrganism()->GetHardware().Reset();
+ cell.GetOrganism()->NewTrial();
+ cell.GetOrganism()->GetHardware().Reset();
}
}
Modified: development/source/main/cPopulation.h
===================================================================
--- development/source/main/cPopulation.h 2008-02-18 22:01:49 UTC (rev 2341)
+++ development/source/main/cPopulation.h 2008-02-18 23:51:26 UTC (rev 2342)
@@ -254,6 +254,8 @@
const tArray<double>& GetResources() const { return resource_count.GetResources(); }
const tArray<double>& GetCellResources(int cell_id) const { return resource_count.GetCellResources(cell_id); }
const tArray<double>& GetDemeResources(int deme_id) { return GetDeme(deme_id).GetDemeResourceCount().GetResources(); }
+ const tArray<double>& GetDemeCellResources(int deme_id, int cell_id) { return GetDeme(deme_id).GetDemeResourceCount().GetCellResources( GetDeme(deme_id).GetRelativeCellID(cell_id) ); }
+
cBirthChamber& GetBirthChamber(int id) { (void) id; return birth_chamber; }
void UpdateResources(const tArray<double>& res_change);
Modified: development/source/main/cPopulationInterface.cc
===================================================================
--- development/source/main/cPopulationInterface.cc 2008-02-18 22:01:49 UTC (rev 2341)
+++ development/source/main/cPopulationInterface.cc 2008-02-18 23:51:26 UTC (rev 2342)
@@ -112,7 +112,7 @@
const tArray<double> & cPopulationInterface::GetDemeResources(int deme_id)
{
- return m_world->GetPopulation().GetDemeResources(deme_id);
+ return m_world->GetPopulation().GetDemeCellResources(deme_id, m_cell_id);
}
void cPopulationInterface::UpdateResources(const tArray<double> & res_change)
More information about the Avida-cvs
mailing list