[Avida-SVN] r3401 - development/source/classification
brysonda at myxo.css.msu.edu
brysonda at myxo.css.msu.edu
Tue Sep 15 11:54:15 PDT 2009
Author: brysonda
Date: 2009-09-15 14:54:15 -0400 (Tue, 15 Sep 2009)
New Revision: 3401
Modified:
development/source/classification/cClassificationManager.cc
development/source/classification/cGenotype.h
Log:
Correct an error in the classification manager such that threshold genotype counts are incorrectly reported when track main lineage is active (the default). The classification manager now handles and clears a genotype's threshold status prior to track main lineage handling.
THIS WILL BREAK CONSISTENCY
- Column 5 of count.dat reports the number of threshold genotypes. This value will now report the intended value of currently existing threshold genotypes.
Modified: development/source/classification/cClassificationManager.cc
===================================================================
--- development/source/classification/cClassificationManager.cc 2009-09-11 17:25:15 UTC (rev 3400)
+++ development/source/classification/cClassificationManager.cc 2009-09-15 18:54:15 UTC (rev 3401)
@@ -259,6 +259,29 @@
}
}
+
+ cSpecies* cur_species = in_genotype.GetSpecies();
+
+ // If this is a threshold genotype we must clean up some threshold stats
+ // right now, since the actual genotype may persist under track main lineage
+ if (in_genotype.GetThreshold()) {
+ m_world->GetStats().RemoveThreshold();
+ in_genotype.ClearThreshold();
+
+ if (cur_species) {
+ cur_species->RemoveThreshold(in_genotype);
+
+ // If we are out of thresholds, move this species to the inactive
+ // list for now. Otherwise, just adjust it.
+ if (cur_species->GetNumThreshold() == 0) {
+ m_species_ctl->SetInactive(*cur_species);
+ } else {
+ m_species_ctl->Adjust(*cur_species);
+ }
+ }
+ }
+
+
// If we are tracking the main lineage, we only want to delete a
// genotype when all of its decendents have also died out.
@@ -318,29 +341,12 @@
// threshold genotype, then the species will only be effected if this was
// the last genotype of that species.
- cSpecies * cur_species = in_genotype.GetSpecies();
if (cur_species) {
// First, re-adjust the species.
cur_species->RemoveGenotype();
- // Then, check to see how this species changes if it is a threshold.
-
- if (in_genotype.GetThreshold()) {
- cur_species->RemoveThreshold(in_genotype);
-
- // If we are out of thresholds, move this species to the inactive
- // list for now. Otherwise, just adjust it.
-
- if (cur_species->GetNumThreshold() == 0) {
- m_species_ctl->SetInactive(*cur_species);
- }
- else {
- m_species_ctl->Adjust(*cur_species);
- }
- }
-
// Finally, remove the species completely if it has no genotypes left.
if (!cur_species->GetNumGenotypes()) {
Modified: development/source/classification/cGenotype.h
===================================================================
--- development/source/classification/cGenotype.h 2009-09-11 17:25:15 UTC (rev 3400)
+++ development/source/classification/cGenotype.h 2009-09-15 18:54:15 UTC (rev 3401)
@@ -168,6 +168,7 @@
void SetSymbol(char in_symbol) { symbol = in_symbol; }
void SetMapColor(int in_id) { map_color_id = in_id; }
inline void SetThreshold();
+ inline void ClearThreshold();
void IncDeferAdjust() { defer_adjust++; }
void DecDeferAdjust() { defer_adjust--; assert(defer_adjust >= 0); }
void SetLineageLabel(int in_label) { birth_data.lineage_label = in_label; }
@@ -303,6 +304,14 @@
if (map_color_id == -2) map_color_id = -1;
}
+inline void cGenotype::ClearThreshold()
+{
+ m_flag_threshold = false;
+ if (symbol == '+') symbol = ',';
+ if (map_color_id == -1) map_color_id = -2;
+}
+
+
inline void cGenotype::SetBreedStats(cGenotype & daughter)
{
birth_data.birth_track.Inc();
More information about the Avida-cvs
mailing list