[Avida-SVN] r2316 - in development: Avida.xcodeproj source/actions source/main
beckma24 at myxo.css.msu.edu
beckma24 at myxo.css.msu.edu
Fri Feb 8 11:37:08 PST 2008
Author: beckma24
Date: 2008-02-08 14:37:08 -0500 (Fri, 08 Feb 2008)
New Revision: 2316
Modified:
development/Avida.xcodeproj/project.pbxproj
development/source/actions/PrintActions.cc
development/source/main/cPopulation.cc
development/source/main/cPopulation.h
development/source/main/cStats.cc
development/source/main/cStats.h
Log:
Added print action PrintDemeAverageData
Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj 2008-02-08 18:49:36 UTC (rev 2315)
+++ development/Avida.xcodeproj/project.pbxproj 2008-02-08 19:37:08 UTC (rev 2316)
@@ -213,6 +213,23 @@
};
/* End PBXBuildRule section */
+/* Begin PBXBuildStyle section */
+ B500C57F0D5CCA6600E31219 /* Development */ = {
+ isa = PBXBuildStyle;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ };
+ name = Development;
+ };
+ B500C5800D5CCA6600E31219 /* Deployment */ = {
+ isa = PBXBuildStyle;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ };
+ name = Deployment;
+ };
+/* End PBXBuildStyle section */
+
/* Begin PBXContainerItemProxy section */
56F555DA0C3B36FC00E2E929 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
@@ -1784,12 +1801,16 @@
DCC30C4D0762532C008F7A48 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 702442D70859E0B00059BD9B /* Build configuration list for PBXProject "Avida" */;
- compatibilityVersion = "Xcode 2.4";
+ buildSettings = {
+ };
+ buildStyles = (
+ B500C57F0D5CCA6600E31219 /* Development */,
+ B500C5800D5CCA6600E31219 /* Deployment */,
+ );
hasScannedForEncodings = 0;
mainGroup = DCC30C490762532C008F7A48;
productRefGroup = DCC3164E07626CF3008F7A48 /* Products */;
projectDirPath = "";
- projectRoot = "";
targets = (
7023ED520C0A590200362B9C /* full-suite */,
DCC3164C07626CF3008F7A48 /* avida */,
Modified: development/source/actions/PrintActions.cc
===================================================================
--- development/source/actions/PrintActions.cc 2008-02-08 18:49:36 UTC (rev 2315)
+++ development/source/actions/PrintActions.cc 2008-02-08 19:37:08 UTC (rev 2316)
@@ -69,6 +69,7 @@
} /* 13 */ \
STATS_OUT_FILE(PrintAverageData, average.dat );
+STATS_OUT_FILE(PrintDemeAverageData, deme_average.dat );
STATS_OUT_FILE(PrintErrorData, error.dat );
STATS_OUT_FILE(PrintVarianceData, variance.dat );
STATS_OUT_FILE(PrintDominantData, dominant.dat );
@@ -2607,6 +2608,7 @@
{
// Stats Out Files
action_lib->Register<cActionPrintAverageData>("PrintAverageData");
+ action_lib->Register<cActionPrintDemeAverageData>("PrintDemeAverageData");
action_lib->Register<cActionPrintErrorData>("PrintErrorData");
action_lib->Register<cActionPrintVarianceData>("PrintVarianceData");
action_lib->Register<cActionPrintDominantData>("PrintDominantData");
Modified: development/source/main/cPopulation.cc
===================================================================
--- development/source/main/cPopulation.cc 2008-02-08 18:49:36 UTC (rev 2315)
+++ development/source/main/cPopulation.cc 2008-02-08 19:37:08 UTC (rev 2316)
@@ -2211,7 +2211,26 @@
for(int i = 0; i < GetNumDemes(); i++) GetDeme(i).Update(step_size);
}
+// Loop through all the demes getting stats and doing calculations
+// which must be done on a deme by deme basis.
+void cPopulation::UpdateDemeStats() {
+ cStats& stats = m_world->GetStats();
+ stats.SumDemeAge().Clear();
+ stats.SumDemeBirthCount().Clear();
+ stats.SumDemeOrgCount().Clear();
+
+ for(int i = 0; i < GetNumDemes(); i++) {
+ cDeme& deme = GetDeme(i);
+ if(deme.IsEmpty()) // ignore empty demes
+ continue;
+ stats.SumDemeAge().Add(deme.GetAge());
+ stats.SumDemeBirthCount().Add(deme.GetBirthCount());
+ stats.SumDemeOrgCount().Add(deme.GetOrgCount());
+ }
+}
+
+
void cPopulation::UpdateOrganismStats()
{
// Carrying capacity @WRE 04-20-07
@@ -2536,6 +2555,7 @@
// Reset the Genebank to prepare it for stat collection.
m_world->GetClassificationManager().UpdateReset();
+ UpdateDemeStats();
UpdateOrganismStats();
UpdateGenotypeStats();
UpdateSpeciesStats();
Modified: development/source/main/cPopulation.h
===================================================================
--- development/source/main/cPopulation.h 2008-02-08 18:49:36 UTC (rev 2315)
+++ development/source/main/cPopulation.h 2008-02-08 19:37:08 UTC (rev 2316)
@@ -122,6 +122,7 @@
void FindEmptyCell(tList<cPopulationCell>& cell_list, tList<cPopulationCell>& found_list);
// Update statistics collecting...
+ void UpdateDemeStats();
void UpdateOrganismStats();
void UpdateGenotypeStats();
void UpdateSpeciesStats();
Modified: development/source/main/cStats.cc
===================================================================
--- development/source/main/cStats.cc 2008-02-08 18:49:36 UTC (rev 2315)
+++ development/source/main/cStats.cc 2008-02-08 19:37:08 UTC (rev 2316)
@@ -562,7 +562,20 @@
df.Endl();
}
+void cStats::PrintDemeAverageData(const cString& filename)
+{
+ cDataFile& df = m_world->GetDataFile(filename);
+ df.WriteComment("Avida Average Deme Data");
+ df.WriteTimeStamp();
+
+ df.Write(m_update, "Update");
+ df.Write(sum_deme_age.Average(), "Age");
+ df.Write(sum_deme_birth_count.Average(), "Births");
+ df.Write(sum_deme_org_count.Average(), "Organisms");
+ df.Endl();
+}
+
void cStats::PrintErrorData(const cString& filename)
{
cDataFile& df = m_world->GetDataFile(filename);
Modified: development/source/main/cStats.h
===================================================================
--- development/source/main/cStats.h 2008-02-08 18:49:36 UTC (rev 2315)
+++ development/source/main/cStats.h 2008-02-08 19:37:08 UTC (rev 2316)
@@ -260,6 +260,11 @@
tArray<int> numAsleep;
+ // simple deme stats
+ cIntSum sum_deme_age;
+ cIntSum sum_deme_birth_count;
+ cIntSum sum_deme_org_count;
+
// Speculative Execution Stats
int m_spec_total;
int m_spec_num;
@@ -395,6 +400,11 @@
cDoubleSum& SumExeSize() { return sum_exe_size; }
cDoubleSum& SumMemSize() { return sum_mem_size; }
+ //deme
+ cIntSum& SumDemeAge() { return sum_deme_age; }
+ cIntSum& SumDemeBirthCount() { return sum_deme_birth_count; }
+ cIntSum& SumDemeOrgCount() { return sum_deme_org_count; }
+
#if INSTRUCTION_COUNT
void ZeroInst();
#endif
@@ -426,7 +436,11 @@
const cDoubleSum& SumExeSize() const { return sum_exe_size; }
const cDoubleSum& SumMemSize() const { return sum_mem_size; }
-
+ //deme
+ const cIntSum& SumDemeAge() const { return sum_deme_age; }
+ const cIntSum& SumDemeBirthCount() const { return sum_deme_birth_count; }
+ const cIntSum& SumDemeOrgCount() const { return sum_deme_org_count; }
+
void IncResamplings() { ++num_resamplings; } // @AWC 06/29/06
void IncFailedResamplings() { ++num_failedResamplings; } // @AWC 06/29/06
@@ -615,6 +629,7 @@
// Public calls to output data files (for events)
void PrintAverageData(const cString& filename);
+ void PrintDemeAverageData(const cString& filename);
void PrintErrorData(const cString& filename);
void PrintVarianceData(const cString& filename);
void PrintDominantData(const cString& filename);
More information about the Avida-cvs
mailing list