[avida-cvs] avida CVS commits: /current/source/event cPopulation.events cPopulation_construct_event_auto.ci cPopulation_descr.ci cPopulation_enums_auto.ci cPopulation_event_list cPopulation_name2enum_auto.ci cPopulation_process_auto.ci /current/source/main inject_genotype.hh population.cc population.hh stats.cc stats.hh
wisnelaw
avida-cvs at alife.org
Wed Sep 24 23:58:37 PDT 2003
wisnelaw Wed Sep 24 15:58:37 2003 EDT
Modified files:
/avida/current/source/event cPopulation.events
cPopulation_construct_event_auto.ci
cPopulation_descr.ci
cPopulation_enums_auto.ci
cPopulation_event_list
cPopulation_name2enum_auto.ci
cPopulation_process_auto.ci
/avida/current/source/main inject_genotype.hh population.cc
population.hh stats.cc stats.hh
Log:
created new event print_dom_parasite_data which creates the file "parasite.dat" and tracks info on the dominant parasite in the population.
-------------- next part --------------
Index: avida/current/source/event/cPopulation.events
diff -u avida/current/source/event/cPopulation.events:1.43 avida/current/source/event/cPopulation.events:1.44
--- avida/current/source/event/cPopulation.events:1.43 Wed Sep 10 13:07:25 2003
+++ avida/current/source/event/cPopulation.events Wed Sep 24 15:58:36 2003
@@ -291,6 +291,20 @@
:body:
population->GetStats().PrintDivideMutData(fname);
+print_dom_parasite_data
+:descr:
+/**
+* Output various quantities related to the dominant parasite.
+*
+* Parameters:
+* filename (string) default: parasite.dat
+* The name of the data file.
+**/
+:args:
+cString fname "parasite.dat"
+:body:
+population->GetStats().PrintDominantParaData(fname);
+
######### Instruction Data Output ##############
print_instruction_data
:descr:
Index: avida/current/source/event/cPopulation_construct_event_auto.ci
diff -u avida/current/source/event/cPopulation_construct_event_auto.ci:1.5 avida/current/source/event/cPopulation_construct_event_auto.ci:1.6
--- avida/current/source/event/cPopulation_construct_event_auto.ci:1.5 Wed Sep 10 13:07:25 2003
+++ avida/current/source/event/cPopulation_construct_event_auto.ci Wed Sep 24 15:58:36 2003
@@ -61,6 +61,9 @@
case cPopulationEventFactory::EVENT_print_divide_mut_data :
event = new cPopulationEventprint_divide_mut_data(arg_list);
break;
+ case cPopulationEventFactory::EVENT_print_dom_parasite_data :
+ event = new cPopulationEventprint_dom_parasite_data(arg_list);
+ break;
case cPopulationEventFactory::EVENT_print_instruction_data :
event = new cPopulationEventprint_instruction_data(arg_list);
break;
Index: avida/current/source/event/cPopulation_descr.ci
diff -u avida/current/source/event/cPopulation_descr.ci:1.5 avida/current/source/event/cPopulation_descr.ci:1.6
--- avida/current/source/event/cPopulation_descr.ci:1.5 Wed Sep 10 13:07:25 2003
+++ avida/current/source/event/cPopulation_descr.ci Wed Sep 24 15:58:36 2003
@@ -20,6 +20,7 @@
cEventEntry( "print_mutation_data", "\n" ),
cEventEntry( "print_mutation_rate_data", "(regular and log) statistics about individual copy\nrates (aver, stdev, skew, cur).\nonly when mutation rate is set per organism.\n" ),
cEventEntry( "print_divide_mut_data", "(regular and log) statistics about individual, per site,\ndivide mutation rates (aver, stdev, skew, cur).\nwith multiple divide instuction set.\n" ),
+ cEventEntry( "print_dom_parasite_data", "Output various quantities related to the dominant parasite.\n\nParameters:\nfilename (string) default: parasite.dat\n The name of the data file.\n" ),
cEventEntry( "print_instruction_data", "of the by-organisms counts of what instructions they _successfully_\nbeteween birth and divide. Prior to their first divide, organisms\nvalues for their parents.\n" ),
cEventEntry( "print_instruction_abundance_histogram", "Appends a line containing the bulk count (abundance) of\neach instruction in the population onto a file.\n\nParameters:\nfilename (string) default: \"instruction_histogram.dat\"\n\n" ),
cEventEntry( "print_depth_histogram", "\n" ),
@@ -86,5 +87,5 @@
cEventEntry( "inject_resource", "Inject (add) a specified amount of a specified resource.\n" ),
cEventEntry( "set_resource", "Set the resource amount to a specific level\n" ) };
-const int cEventDescrs::num_of_events = 86;
+const int cEventDescrs::num_of_events = 87;
Index: avida/current/source/event/cPopulation_enums_auto.ci
diff -u avida/current/source/event/cPopulation_enums_auto.ci:1.5 avida/current/source/event/cPopulation_enums_auto.ci:1.6
--- avida/current/source/event/cPopulation_enums_auto.ci:1.5 Wed Sep 10 13:07:25 2003
+++ avida/current/source/event/cPopulation_enums_auto.ci Wed Sep 24 15:58:36 2003
@@ -20,6 +20,7 @@
EVENT_print_mutation_data,
EVENT_print_mutation_rate_data,
EVENT_print_divide_mut_data,
+ EVENT_print_dom_parasite_data,
EVENT_print_instruction_data,
EVENT_print_instruction_abundance_histogram,
EVENT_print_depth_histogram,
Index: avida/current/source/event/cPopulation_event_list
diff -u avida/current/source/event/cPopulation_event_list:1.5 avida/current/source/event/cPopulation_event_list:1.6
--- avida/current/source/event/cPopulation_event_list:1.5 Wed Sep 10 13:07:25 2003
+++ avida/current/source/event/cPopulation_event_list Wed Sep 24 15:58:36 2003
@@ -21,6 +21,7 @@
print_mutation_data [cString fname="mutation.dat"]
print_mutation_rate_data [cString fname="mutation_rates.dat"]
print_divide_mut_data [cString fname="divide_mut.dat"]
+print_dom_parasite_data [cString fname="parasite.dat"]
print_instruction_data [cString fname="instruction.dat"]
print_instruction_abundance_histogram [cString filename="instruction_histogram.dat"]
print_depth_histogram [cString filename="depth_histogram.dat"]
Index: avida/current/source/event/cPopulation_name2enum_auto.ci
diff -u avida/current/source/event/cPopulation_name2enum_auto.ci:1.5 avida/current/source/event/cPopulation_name2enum_auto.ci:1.6
--- avida/current/source/event/cPopulation_name2enum_auto.ci:1.5 Wed Sep 10 13:07:25 2003
+++ avida/current/source/event/cPopulation_name2enum_auto.ci Wed Sep 24 15:58:36 2003
@@ -43,6 +43,8 @@
return cPopulationEventFactory::EVENT_print_mutation_rate_data;
}else if (name == "print_divide_mut_data") {
return cPopulationEventFactory::EVENT_print_divide_mut_data;
+ }else if (name == "print_dom_parasite_data") {
+ return cPopulationEventFactory::EVENT_print_dom_parasite_data;
}else if (name == "print_instruction_data") {
return cPopulationEventFactory::EVENT_print_instruction_data;
}else if (name == "print_instruction_abundance_histogram") {
Index: avida/current/source/event/cPopulation_process_auto.ci
diff -u avida/current/source/event/cPopulation_process_auto.ci:1.5 avida/current/source/event/cPopulation_process_auto.ci:1.6
--- avida/current/source/event/cPopulation_process_auto.ci:1.5 Wed Sep 10 13:07:25 2003
+++ avida/current/source/event/cPopulation_process_auto.ci Wed Sep 24 15:58:36 2003
@@ -559,6 +559,33 @@
}
};
+///// print_dom_parasite_data /////
+
+/**
+* Output various quantities related to the dominant parasite.
+*
+* Parameters:
+* filename (string) default: parasite.dat
+* The name of the data file.
+**/
+
+
+class cPopulationEventprint_dom_parasite_data : public cPopulationEvent {
+private:
+ cString fname;
+public:
+ cPopulationEventprint_dom_parasite_data(const cString & in_args):
+ cPopulationEvent("print_dom_parasite_data", in_args) {
+
+ cString args(in_args);
+ if (args == "") fname="parasite.dat"; else fname=args.PopWord();
+ }
+///// print_dom_parasite_data /////
+ void Process(){
+ population->GetStats().PrintDominantParaData(fname);
+ }
+};
+
///// print_instruction_data /////
/**
Index: avida/current/source/main/inject_genotype.hh
diff -u avida/current/source/main/inject_genotype.hh:1.2 avida/current/source/main/inject_genotype.hh:1.3
--- avida/current/source/main/inject_genotype.hh:1.2 Tue Sep 23 16:01:14 2003
+++ avida/current/source/main/inject_genotype.hh Wed Sep 24 15:58:37 2003
@@ -159,57 +159,57 @@
//void AddExecutedSize (int in) { sum_exe_size.Add(in); }
//void AddGestationTime (int in) { sum_gestation_time.Add(in);
// sum_repro_rate.Add(1/(double)in); }
-//void AddMerit (const cMerit & in);
-//void RemoveMerit (const cMerit & in);
-//void AddFitness (double in){
-// assert(in >= 0.0);
-// sum_fitness.Add(in);
-//}
-//void RemoveFitness (double in){
-// assert(in >= 0.0);
-// sum_fitness.Subtract(in);
-//}
-
+ //void AddMerit (const cMerit & in);
+ //void RemoveMerit (const cMerit & in);
+ //void AddFitness (double in){
+ // assert(in >= 0.0);
+ // sum_fitness.Add(in);
+ //}
+ //void RemoveFitness (double in){
+ // assert(in >= 0.0);
+ // sum_fitness.Subtract(in);
+ //}
+
//// Properties Native to Genotype ////
cGenome & GetGenome() { return genome; }
const cGenome & GetGenome() const { return genome; }
int GetLength() const { return genome.GetSize(); }
-
-//int GetBirths() const { return birth_data.birth_track.GetTotal(); }
-//int GetBreedOut() const { return birth_data.breed_out_track.GetTotal(); }
-//int GetBreedTrue() const { return birth_data.breed_true_track.GetTotal(); }
-//int GetBreedIn() const { return birth_data.breed_in_track.GetTotal(); }
-
-//int GetThisBirths() const { return birth_data.birth_track.GetCur(); }
-//int GetThisBreedOut() const { return birth_data.breed_out_track.GetCur(); }
-//int GetThisBreedTrue() const { return birth_data.breed_true_track.GetCur(); }
-//int GetThisBreedIn() const { return birth_data.breed_in_track.GetCur(); }
-
-//int GetThisDeaths() const { return birth_data.death_track.GetCur(); }
-
-//int GetLastNumOrganisms() const { return last_num_organisms; }
-//int GetLastBirths() const { return birth_data.birth_track.GetLast(); }
-//int GetLastBreedOut() const { return birth_data.breed_out_track.GetLast(); }
-//int GetLastBreedTrue() const { return birth_data.breed_true_track.GetLast();}
-//int GetLastBreedIn() const { return birth_data.breed_in_track.GetLast(); }
-
-//inline void SetBreedStats(cGenotype & daughter); // called by ActivateChild
-
+
+ //int GetBirths() const { return birth_data.birth_track.GetTotal(); }
+ //int GetBreedOut() const { return birth_data.breed_out_track.GetTotal(); }
+ //int GetBreedTrue() const { return birth_data.breed_true_track.GetTotal(); }
+ //int GetBreedIn() const { return birth_data.breed_in_track.GetTotal(); }
+
+ //int GetThisBirths() const { return birth_data.birth_track.GetCur(); }
+ //int GetThisBreedOut() const { return birth_data.breed_out_track.GetCur(); }
+ //int GetThisBreedTrue() const { return birth_data.breed_true_track.GetCur(); }
+ //int GetThisBreedIn() const { return birth_data.breed_in_track.GetCur(); }
+
+ //int GetThisDeaths() const { return birth_data.death_track.GetCur(); }
+
+ //int GetLastNumOrganisms() const { return last_num_organisms; }
+ //int GetLastBirths() const { return birth_data.birth_track.GetLast(); }
+ //int GetLastBreedOut() const { return birth_data.breed_out_track.GetLast(); }
+ //int GetLastBreedTrue() const { return birth_data.breed_true_track.GetLast();}
+ //int GetLastBreedIn() const { return birth_data.breed_in_track.GetLast(); }
+
+ //inline void SetBreedStats(cGenotype & daughter); // called by ActivateChild
+
//// Properties Averaged Over Creatues ////
//double GetCopiedSize() const { return (sum_copied_size.Count()>0) ?
-// sum_copied_size.Average() : tmp_sum_copied_size.Average(); }
-//double GetExecutedSize() const { return (sum_exe_size.Count()>0) ?
-// sum_exe_size.Average() : tmp_sum_exe_size.Average(); }
-//double GetGestationTime() const { return (sum_gestation_time.Count()>0) ?
-// sum_gestation_time.Average() : tmp_sum_gestation_time.Average(); }
-//double GetReproRate() const { return (sum_repro_rate.Count()>0) ?
-// sum_repro_rate.Average() : tmp_sum_repro_rate.Average(); }
-//double GetMerit() const { return (sum_merit.Count()>0) ?
-// sum_merit.Average() : tmp_sum_merit.Average(); }
-//double GetFitness() const { return (sum_fitness.Count()>0) ?
-// sum_fitness.Average() : tmp_sum_fitness.Average(); }
-
-
+ // sum_copied_size.Average() : tmp_sum_copied_size.Average(); }
+ //double GetExecutedSize() const { return (sum_exe_size.Count()>0) ?
+ // sum_exe_size.Average() : tmp_sum_exe_size.Average(); }
+ //double GetGestationTime() const { return (sum_gestation_time.Count()>0) ?
+ // sum_gestation_time.Average() : tmp_sum_gestation_time.Average(); }
+ //double GetReproRate() const { return (sum_repro_rate.Count()>0) ?
+ // sum_repro_rate.Average() : tmp_sum_repro_rate.Average(); }
+ //double GetMerit() const { return (sum_merit.Count()>0) ?
+ // sum_merit.Average() : tmp_sum_merit.Average(); }
+ //double GetFitness() const { return (sum_fitness.Count()>0) ?
+ // sum_fitness.Average() : tmp_sum_fitness.Average(); }
+
+
// For tracking the genotype line back to the ancestor...
cInjectGenotype * GetParentGenotype() { return birth_data.parent_genotype; }
int GetNumOffspringGenotypes() const
@@ -217,14 +217,14 @@
void AddOffspringGenotype() { birth_data.num_offspring_genotypes++; }
void RemoveOffspringGenotype() { birth_data.num_offspring_genotypes--; }
bool GetActive() const { return is_active; }
-// bool GetDeferAdjust() const { return defer_adjust > 0; }
+ // bool GetDeferAdjust() const { return defer_adjust > 0; }
int GetUpdateDeactivated() { return birth_data.update_deactivated; }
void Deactivate(int update);
bool CanReproduce() { return can_reproduce; }
int GetUpdateBorn() { return birth_data.update_born; }
int GetParentID() { return birth_data.parent_id; }
-//int GetParentDistance() { return birth_data.parent_distance; }
+ //int GetParentDistance() { return birth_data.parent_distance; }
int GetDepth() { return birth_data.gene_depth; }
cString & GetName() { return name; }
cInjectGenotype * GetNext() { return next; }
@@ -235,11 +235,11 @@
int AddParasite();
int RemoveParasite();
-//int AddParasite() { return ++total_parasites; }
-//void SwapOrganism() { total_organisms++; }
+ //int AddParasite() { return ++total_parasites; }
+ //void SwapOrganism() { total_organisms++; }
int GetNumInjected() { return num_injected; }
int GetTotalInjected() { return total_injected; }
-//int GetTotalParasites() { return total_parasites; }
+ //int GetTotalParasites() { return total_parasites; }
};
// The genotype pointer template...
Index: avida/current/source/main/population.cc
diff -u avida/current/source/main/population.cc:1.116 avida/current/source/main/population.cc:1.117
--- avida/current/source/main/population.cc:1.116 Wed Sep 24 01:12:00 2003
+++ avida/current/source/main/population.cc Wed Sep 24 15:58:37 2003
@@ -890,6 +890,31 @@
stats.SetDomSequence(dom_genotype->GetGenome().AsString());
}
+void cPopulation::UpdateDominantParaStats()
+{
+ cInjectGenotype * dom_inj_genotype = inject_genebank->GetBestInjectGenotype();
+ if (dom_inj_genotype == NULL) return;
+
+ stats.SetDomInjGenotype(dom_inj_genotype);
+ //stats.SetDomMerit(dom_genotype->GetMerit());
+ //stats.SetDomGestation(dom_genotype->GetGestationTime());
+ //stats.SetDomReproRate(dom_genotype->GetReproRate());
+ //stats.SetDomFitness(dom_genotype->GetFitness());
+ //stats.SetDomCopiedSize(dom_genotype->GetCopiedSize());
+ //stats.SetDomExeSize(dom_genotype->GetExecutedSize());
+
+ stats.SetDomInjSize(dom_inj_genotype->GetLength());
+ stats.SetDomInjID(dom_inj_genotype->GetID());
+ stats.SetDomInjName(dom_inj_genotype->GetName());
+ //stats.SetDomInjBirths(dom_inj_genotype->GetThisBirths());
+ //stats.SetDomBreedTrue(dom_genotype->GetThisBreedTrue());
+ //stats.SetDomBreedIn(dom_genotype->GetThisBreedIn());
+ //stats.SetDomBreedOut(dom_genotype->GetThisBreedOut());
+ stats.SetDomInjAbundance(dom_inj_genotype->GetNumInjected());
+ //stats.SetDomInjGeneDepth(dom_inj_genotype->GetDepth());
+ stats.SetDomInjSequence(dom_inj_genotype->GetGenome().AsString());
+}
+
void cPopulation::CalcUpdateStats()
{
// Reset the Genebank to prepare it for stat collection.
@@ -899,6 +924,7 @@
UpdateGenotypeStats();
UpdateSpeciesStats();
UpdateDominantStats();
+ UpdateDominantParaStats();
// Do any final calculations...
stats.SetNumCreatures(GetNumOrganisms());
Index: avida/current/source/main/population.hh
diff -u avida/current/source/main/population.hh:1.58 avida/current/source/main/population.hh:1.59
--- avida/current/source/main/population.hh:1.58 Wed Sep 10 13:07:26 2003
+++ avida/current/source/main/population.hh Wed Sep 24 15:58:37 2003
@@ -79,6 +79,7 @@
void UpdateGenotypeStats();
void UpdateSpeciesStats();
void UpdateDominantStats();
+ void UpdateDominantParaStats();
/**
* Attention: InjectGenotype does *not* add the genotype to the genebank.
Index: avida/current/source/main/stats.cc
diff -u avida/current/source/main/stats.cc:1.54 avida/current/source/main/stats.cc:1.55
--- avida/current/source/main/stats.cc:1.54 Tue May 20 14:07:00 2003
+++ avida/current/source/main/stats.cc Wed Sep 24 15:58:37 2003
@@ -157,6 +157,14 @@
data_manager.Add("dom_depth", "Tree Depth of Dominant Genotype", &cStats::GetDomGeneDepth);
data_manager.Add("dom_sequence", "Sequence of Dominant Genotype", &cStats::GetDomSequence);
+ // Dominant Inject Genotype Stats
+ data_manager.Add("dom_inj_size", "Genome Length of Dominant Parasite", &cStats::GetDomInjSize);
+ data_manager.Add("dom_inj_ID", "ID of Dominant Parasite", &cStats::GetDomInjID);
+ data_manager.Add("dom_inj_name", "Nameof Dominant Parasite", &cStats::GetDomInjName);
+ data_manager.Add("dom_inj_births", "Birth Count of Dominant Parasite", &cStats::GetDomInjBirths);
+ data_manager.Add("dom_inj_abundance", "Abundance of Dominant Parasite", &cStats::GetDomInjAbundance);
+ data_manager.Add("dom_inj_sequence", "Sequence of Dominant Parasite", &cStats::GetDomInjSequence);
+
// Current Counts...
data_manager.Add("num_births", "Count of Births in Population", &cStats::GetNumBirths);
data_manager.Add("num_deaths", "Count of Deaths in Population", &cStats::GetNumDeaths);
@@ -547,6 +555,20 @@
df.Endl();
}
+void cStats::PrintDominantParaData(const cString & filename)
+{
+ cDataFile & df = GetDataFile(filename);
+
+ df.WriteComment( "Avida dominant parasite data" );
+ df.WriteTimeStamp();
+
+ df.Write( GetUpdate(), "update" );
+ df.Write( dom_inj_size, "size of dominant genotype" );
+ df.Write( dom_inj_abundance, "abundance of dominant genotype" );
+ df.Write( dom_inj_genotype_id, "genotype ID of dominant genotype" );
+ df.Write( dom_inj_name, "name of dominant genotype" );
+ df.Endl();
+}
void cStats::PrintStatsData(const cString & filename)
{
Index: avida/current/source/main/stats.hh
diff -u avida/current/source/main/stats.hh:1.48 avida/current/source/main/stats.hh:1.49
--- avida/current/source/main/stats.hh:1.48 Tue May 20 14:07:01 2003
+++ avida/current/source/main/stats.hh Wed Sep 24 15:58:37 2003
@@ -34,6 +34,7 @@
class cGenotype;
class sCPUStats;
class cGenome;
+class cInjectGenotype;
class cStats {
private:
@@ -158,6 +159,15 @@
cString dom_sequence;
int coal_depth;
+ // Dominant Parasite
+ cInjectGenotype * dom_inj_genotype;
+ int dom_inj_size;
+ int dom_inj_genotype_id;
+ cString dom_inj_name;
+ int dom_inj_births;
+ int dom_inj_abundance;
+ cString dom_inj_sequence;
+
int num_births;
int num_deaths;
int num_breed_in;
@@ -253,6 +263,13 @@
int GetDomGeneDepth() const { return dom_gene_depth; }
const cString & GetDomSequence() const { return dom_sequence; }
+ cInjectGenotype * GetDomInjGenotype() const { return dom_inj_genotype; }
+ int GetDomInjSize() const { return dom_inj_size; }
+ int GetDomInjID() const { return dom_inj_genotype_id; }
+ const cString & GetDomInjName() const { return dom_inj_name; }
+ int GetDomInjBirths() const { return dom_inj_births; }
+ int GetDomInjAbundance() const { return dom_inj_abundance; }
+ const cString & GetDomInjSequence() const { return dom_inj_sequence; }
// Settings...
void SetDomGenotype(cGenotype * in_gen) { dom_genotype = in_gen; }
@@ -274,6 +291,21 @@
void SetDomGeneDepth(int in_depth) { dom_gene_depth = in_depth; }
void SetDomSequence(const cString & in_seq) { dom_sequence = in_seq; }
+ void SetDomInjGenotype(cInjectGenotype * in_inj_genotype)
+ {dom_inj_genotype = in_inj_genotype;}
+ void SetDomInjSize(int in_inj_size)
+ {dom_inj_size = in_inj_size;}
+ void SetDomInjID(int in_inj_ID)
+ {dom_inj_genotype_id = in_inj_ID;}
+ void SetDomInjName(const cString & in_name)
+ {dom_inj_name = in_name;}
+ void SetDomInjBirths(int in_births)
+ {dom_inj_births=in_births;}
+ void SetDomInjAbundance(int in_inj_abundance)
+ {dom_inj_abundance=in_inj_abundance;}
+ void SetDomInjSequence(const cString & in_inj_sequence)
+ {dom_inj_sequence = in_inj_sequence;}
+
void SetGenoMapElement(int i, int in_geno) { genotype_map[i] = in_geno; }
// Generic data
void SetCoalescentGenotypeDepth(int in_depth) {coal_depth = in_depth;}
@@ -483,6 +515,7 @@
void PrintErrorData(const cString & filename);
void PrintVarianceData(const cString & filename);
void PrintDominantData(const cString & filename);
+ void PrintDominantParaData(const cString & filename);
void PrintStatsData(const cString & filename);
void PrintCountData(const cString & filename);
void PrintTotalsData(const cString & filename);
More information about the Avida-cvs
mailing list