[Avida-SVN] r2702 - development/source/main
connel42 at myxo.css.msu.edu
connel42 at myxo.css.msu.edu
Wed Jul 2 13:16:33 PDT 2008
Author: connel42
Date: 2008-07-02 16:16:33 -0400 (Wed, 02 Jul 2008)
New Revision: 2702
Modified:
development/source/main/cAvidaConfig.h
development/source/main/cDeme.cc
development/source/main/cPopulation.cc
Log:
Added logging of deme replication
Modified: development/source/main/cAvidaConfig.h
===================================================================
--- development/source/main/cAvidaConfig.h 2008-07-02 15:09:51 UTC (rev 2701)
+++ development/source/main/cAvidaConfig.h 2008-07-02 20:16:33 UTC (rev 2702)
@@ -301,6 +301,8 @@
CONFIG_ADD_VAR(DEMES_PREVENT_STERILE, int, 0, "Whether to prevent sterile demes from\nreplicating (default=0 or no).");
CONFIG_ADD_VAR(DEMES_RESET_RESOURCES, int, 0, "Reset resources in demes on replication. \n0 = reset both demes \n1 = reset target deme \n2 = deme resources remain unchanged\n");
CONFIG_ADD_VAR(DEMES_REPLICATE_SIZE, int, 1, "Number of identical organisms to create or copy from the\nsource deme to the target deme (default=1).");
+ CONFIG_ADD_VAR(LOG_DEMES_REPLICATE, bool, 0, "Log deme replications. 0/1 (off/on)");
+ CONFIG_ADD_VAR(DEMES_REPLICATE_LOG_START, int, 0, "Update at which to start logging deme replications");
CONFIG_ADD_VAR(DEMES_PROB_ORG_TRANSFER, double, 0.0, "Probablity of an organism being transferred from the\nsource deme to the target deme (default=0.0).");
CONFIG_ADD_VAR(DEMES_ORGANISM_SELECTION, int, 0, "How organisms are selected for transfer from\nsource to target during deme replication.\n0=random with replacement (default).\n1=sequential.");
CONFIG_ADD_VAR(DEMES_ORGANISM_PLACEMENT, int, 0, "How organisms are placed during deme replication.\n0=cell-array middle (default).\n1=deme center.\n2=random placement.\n3=sequential.");
Modified: development/source/main/cDeme.cc
===================================================================
--- development/source/main/cDeme.cc 2008-07-02 15:09:51 UTC (rev 2701)
+++ development/source/main/cDeme.cc 2008-07-02 20:16:33 UTC (rev 2702)
@@ -136,7 +136,6 @@
if(event.IsActive() && event.GetDelay() < _age && _age <= event.GetDelay()+event.GetDuration()) {
//remove energy from cells (should be done with outflow, but this will work for now)
int eventCell = event.GetNextEventCellID();
- cResource* res = m_world->GetEnvironment().GetResourceLib().GetResource("CELL_ENERGY");
while(eventCell != -1) {
cPopulationCell& cell = m_world->GetPopulation().GetCell(GetCellID(eventCell));
@@ -148,7 +147,6 @@
}
//remove energy from cell... organism might not takeup all of a cell's energy
tArray<double> cell_resources = deme_resource_count.GetCellResources(eventCell); // uses global cell_id; is this a problem
- cell_resources[res->GetID()] *= m_world->GetConfig().ATTACK_DECAY_RATE.Get();
deme_resource_count.ModifyCell(cell_resources, eventCell);
}
eventCell = event.GetNextEventCellID();
Modified: development/source/main/cPopulation.cc
===================================================================
--- development/source/main/cPopulation.cc 2008-07-02 15:09:51 UTC (rev 2701)
+++ development/source/main/cPopulation.cc 2008-07-02 20:16:33 UTC (rev 2702)
@@ -1335,6 +1335,19 @@
target_id = m_world->GetRandom().GetUInt(num_demes);
}
}
+
+ // Write some logging information if LOG_DEMES_REPLICATE is set.
+ if( (m_world->GetConfig().LOG_DEMES_REPLICATE.Get() == 1) &&
+ (m_world->GetStats().GetUpdate() >= m_world->GetConfig().DEMES_REPLICATE_LOG_START.Get()) ) {
+ cString tmpfilename = cStringUtil::Stringf("deme_replication.dat");
+ cDataFile& df = m_world->GetDataFile(tmpfilename);
+
+ cString UpdateStr = cStringUtil::Stringf("%d,%d,%d",
+ m_world->GetStats().GetUpdate(),
+ source_deme.GetDemeID(), target_id);
+ df.WriteRaw(UpdateStr);
+ }
+
ReplaceDeme(source_deme, deme_array[target_id]);
}
More information about the Avida-cvs
mailing list