[Avida-cvs] [Avida2-svn] r295 - in branches/brysonda: Avida2.xcodeproj source/main source/tools
brysonda@myxo.css.msu.edu
brysonda at myxo.css.msu.edu
Fri Aug 26 12:15:09 PDT 2005
Author: brysonda
Date: 2005-08-26 15:15:08 -0400 (Fri, 26 Aug 2005)
New Revision: 295
Added:
branches/brysonda/source/tools/tHashTable.hh
Modified:
branches/brysonda/Avida2.xcodeproj/project.pbxproj
branches/brysonda/source/main/analyze.cc
Log:
Merge in r294 from trunk
Modified: branches/brysonda/Avida2.xcodeproj/project.pbxproj
===================================================================
--- branches/brysonda/Avida2.xcodeproj/project.pbxproj 2005-08-25 21:51:51 UTC (rev 294)
+++ branches/brysonda/Avida2.xcodeproj/project.pbxproj 2005-08-26 19:15:08 UTC (rev 295)
@@ -181,6 +181,8 @@
70D46934085F61DA004C8409 /* trio.c in Sources */ = {isa = PBXBuildFile; fileRef = DCC3146D076253A1008F7A48 /* trio.c */; };
70D46935085F61DD004C8409 /* trionan.c in Sources */ = {isa = PBXBuildFile; fileRef = DCC31471076253A1008F7A48 /* trionan.c */; };
70D46936085F61DF004C8409 /* triostr.c in Sources */ = {isa = PBXBuildFile; fileRef = DCC31474076253A1008F7A48 /* triostr.c */; };
+ 70FB868708BFA02D00BDF589 /* tHashTable.hh in CopyFiles */ = {isa = PBXBuildFile; fileRef = 70FB868608BFA02D00BDF589 /* tHashTable.hh */; };
+ 70FB868808BFA02D00BDF589 /* tHashTable.hh in CopyFiles */ = {isa = PBXBuildFile; fileRef = 70FB868608BFA02D00BDF589 /* tHashTable.hh */; };
DCC3165F0762852D008F7A48 /* analyze_genotype.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC310980762539E008F7A48 /* analyze_genotype.cc */; };
DCC316600762852F008F7A48 /* analyze_util.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3109A0762539E008F7A48 /* analyze_util.cc */; };
DCC3166107628531008F7A48 /* avida.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3109C0762539E008F7A48 /* avida.cc */; };
@@ -346,6 +348,7 @@
700E2B7B085DE50C00CF158A /* organism.smt in CopyFiles */,
700E2B7C085DE50C00CF158A /* genesis.smt in CopyFiles */,
700E2B7D085DE50C00CF158A /* inst_set.smt in CopyFiles */,
+ 70FB868808BFA02D00BDF589 /* tHashTable.hh in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -371,6 +374,7 @@
706D330F0854A7B900D7DC8F /* organism.smt in CopyFiles */,
706D33110854A7D700D7DC8F /* genesis.smt in CopyFiles */,
706D33280854A90D00D7DC8F /* inst_set.smt in CopyFiles */,
+ 70FB868708BFA02D00BDF589 /* tHashTable.hh in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -599,6 +603,7 @@
70CD47EF089692AE0070D2DF /* tVector_instantiations.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = tVector_instantiations.hh; sourceTree = "<group>"; };
70CD47F0089692AE0070D2DF /* tVector.pyste */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = tVector.pyste; sourceTree = "<group>"; };
70CD482C089702880070D2DF /* Avida-ED-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Avida-ED-Info.plist"; sourceTree = "<group>"; };
+ 70FB868608BFA02D00BDF589 /* tHashTable.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = tHashTable.hh; sourceTree = "<group>"; };
DCC30D300762539B008F7A48 /* 4stack_head.pyste */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = 4stack_head.pyste; sourceTree = "<group>"; };
DCC30D310762539B008F7A48 /* A.hh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = A.hh; sourceTree = "<group>"; };
DCC30D320762539B008F7A48 /* A.pyste */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = A.pyste; sourceTree = "<group>"; };
@@ -2724,6 +2729,7 @@
DCC314D8076253A2008F7A48 /* tools */ = {
isa = PBXGroup;
children = (
+ 70FB868608BFA02D00BDF589 /* tHashTable.hh */,
70CBFCEF0815E8370078D8CC /* change_list.cc */,
70CBFCF00815E8370078D8CC /* change_list.hh */,
DCC31545076253A4008F7A48 /* block_struct.cc */,
Modified: branches/brysonda/source/main/analyze.cc
===================================================================
--- branches/brysonda/source/main/analyze.cc 2005-08-25 21:51:51 UTC (rev 294)
+++ branches/brysonda/source/main/analyze.cc 2005-08-26 19:15:08 UTC (rev 295)
@@ -43,6 +43,7 @@
#include "cpu_test_info.hh"
#include "test_util.hh"
#include "resource.hh"
+#include "tHashTable.hh"
#ifdef WIN32
# include "win32_mkdir_hack.hh"
#endif
@@ -2980,13 +2981,25 @@
// abundance, so they will have one entry in the array per organism. Note
// that we only consider viable genotypes.
- // Start by counting the total number of organisms.
+ // Start by counting the total number of organisms (and do other such
+ // data collection... @CAO CONTINUE
+ tHashTable<int, int> mate_id_counts;
+
int org_count = 0;
+ int gen_count = 0;
cAnalyzeGenotype * genotype = NULL;
tListIterator<cAnalyzeGenotype> list_it(batch[cur_batch].List());
while ((genotype = list_it.Next()) != NULL) {
if (genotype->GetViable() == false) continue;
+ gen_count++;
org_count += genotype->GetNumCPUs();
+
+ // Keep track of how many organisms have each mate id...
+ int mate_id = genotype->GetMateID();
+ int count = 0;
+ mate_id_counts.Find(mate_id, count);
+ count += genotype->GetNumCPUs();
+ mate_id_counts.SetValue(mate_id, count);
}
// Create an array of the correct size.
@@ -3069,6 +3082,24 @@
}
}
+ // Do some calculations on the sizes of the mate groups...
+ const int num_mate_groups = mate_id_counts.GetSize();
+
+ // Collect lists on all of the mate groups for the calculations...
+ tList<int> key_list;
+ tList<int> count_list;
+ mate_id_counts.AsLists(key_list, count_list);
+ tListIterator<int> count_it(count_list);
+
+ int max_group_size = 0;
+ double mate_id_entropy = 0.0;
+ while (count_it.Next() != NULL) {
+ int cur_count = *(count_it.Get());
+ double cur_frac = ((double) cur_count) / ((double) org_count);
+ if (cur_count > max_group_size) max_group_size = cur_count;
+ mate_id_entropy -= cur_frac * log(cur_frac);
+ }
+
// Calculate the final answer
double fail_frac = (double) fail_count / (double) sample_size;
double match_fail_frac =
@@ -3086,6 +3117,13 @@
df.Write(fail_frac, "Average fraction failed");
df.Write(match_fail_frac, "Average fraction of mate matches failed");
+ df.Write(sample_size, "Total number of crossovers tested");
+ df.Write(total_matches_tested, "Number of crossovers with matching mate IDs");
+ df.Write(gen_count, "Number of genotypes in test batch");
+ df.Write(org_count, "Number of organisms in test batch");
+ df.Write(num_mate_groups, "Number of distinct mate IDs");
+ df.Write(max_group_size, "Size of the largest distinct mate ID group");
+ df.Write(mate_id_entropy, "Diversity of mate IDs (entropy)");
df.Endl();
}
Copied: branches/brysonda/source/tools/tHashTable.hh (from rev 294, trunk/source/tools/tHashTable.hh)
More information about the Avida-cvs
mailing list