[avida-cvs] avida(kaben) CVS commits: /current configure.in /current/source defs.hh /current/source/cpu hardware_4stack.cc hardware_4stack.hh hardware_cpu.cc hardware_cpu.hh /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 birth_chamber.cc genome.hh genotype.hh inject_genebank.cc inject_genotype.cc inject_genotype.hh phenotype.cc phenotype.hh population.cc population.hh primitive.pch stats.cc stats.hh /current/source/qt-viewer n_orig_instruction_cpu_widget.cc qt-viewer.pch /current/source/support genesis genesis.4stack /current/source/third-party/pdcurses README.txt curses.h pdcurses.lib /current/source/viewers ncurses-viewer.pch text_screen.cc text_screen.hh
kaben
avida-cvs at alife.org
Fri Oct 3 01:04:57 PDT 2003
kaben Thu Oct 2 17:04:57 2003 EDT
Added files: (Branch: kaben)
/avida/current/source/third-party/pdcurses README.txt curses.h
pdcurses.lib
Modified files:
/avida/current configure.in
/avida/current/source defs.hh
/avida/current/source/cpu hardware_4stack.cc hardware_4stack.hh
hardware_cpu.cc hardware_cpu.hh
/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 primitive.pch birth_chamber.cc genome.hh
genotype.hh inject_genebank.cc
inject_genotype.cc inject_genotype.hh
phenotype.cc phenotype.hh population.cc
population.hh stats.cc stats.hh
/avida/current/source/qt-viewer qt-viewer.pch
n_orig_instruction_cpu_widget.cc
/avida/current/source/support genesis genesis.4stack
/avida/current/source/viewers ncurses-viewer.pch text_screen.cc
text_screen.hh
Log:
Merging recent changes from branch HEAD into branch kaben.
-------------- next part --------------
Index: avida/current/configure.in
diff -u avida/current/configure.in:1.22.2.9 avida/current/configure.in:1.22.2.10
--- avida/current/configure.in:1.22.2.9 Tue Sep 23 20:57:42 2003
+++ avida/current/configure.in Thu Oct 2 17:04:36 2003
@@ -8,7 +8,7 @@
dnl ****************************************
dnl Package name and version
dnl ****************************************
-AM_INIT_AUTOMAKE(avida, 2.0b5)
+AM_INIT_AUTOMAKE(avida, 2.0b6)
dnl ****************************************
Index: avida/current/source/defs.hh
diff -u avida/current/source/defs.hh:1.25.2.7 avida/current/source/defs.hh:1.25.2.8
--- avida/current/source/defs.hh:1.25.2.7 Tue Sep 23 20:57:42 2003
+++ avida/current/source/defs.hh Thu Oct 2 17:04:37 2003
@@ -75,7 +75,7 @@
// the macro VERSION is defined by automake (in the file 'configure.in' in
// the top-level directory).
#ifndef VERSION
- #define VERSION "2.0b5"
+ #define VERSION "2.0b6"
#endif
#define AVIDA_VERSION VERSION
@@ -162,6 +162,8 @@
#define MIN_CREATURE_SIZE 8
#define MAX_CREATURE_SIZE 2048
+
+#define MIN_INJECT_SIZE 8
// Number of distinct input and outputs stored in the IOBufs (to test tasks)
#define INPUT_BUF_SIZE 3
Index: avida/current/source/cpu/hardware_4stack.cc
diff -u avida/current/source/cpu/hardware_4stack.cc:1.2.2.6 avida/current/source/cpu/hardware_4stack.cc:1.2.2.7
--- avida/current/source/cpu/hardware_4stack.cc:1.2.2.6 Mon Aug 25 23:30:20 2003
+++ avida/current/source/cpu/hardware_4stack.cc Thu Oct 2 17:04:37 2003
@@ -964,19 +964,22 @@
{
const int end_pos = GetHead(HEAD_WRITE).GetPosition();
const int mem_space_used = GetHead(HEAD_WRITE).GetMemSpace();
-
+
// Make sure the creature will still be above the minimum size,
+ // TEMPORARY! INJECTED CODE CAN
if (end_pos <= 0) {
Fault(FAULT_LOC_INJECT, FAULT_TYPE_ERROR, "inject: no code to inject");
return false; // (inject fails)
}
- if (end_pos < MIN_CREATURE_SIZE) {
+ if (end_pos < MIN_INJECT_SIZE) {
+ GetMemory(mem_space_used)=cGenome(ConvertToInstruction(mem_space_used));
Fault(FAULT_LOC_INJECT, FAULT_TYPE_ERROR, "inject: new size too small");
return false; // (inject fails)
}
GetMemory(mem_space_used).Resize(end_pos);
+
cCPUMemory injected_code = GetMemory(mem_space_used);
Inject_DoMutations(mut_multiplier, injected_code);
Index: avida/current/source/cpu/hardware_4stack.hh
diff -u avida/current/source/cpu/hardware_4stack.hh:1.2.2.3 avida/current/source/cpu/hardware_4stack.hh:1.2.2.4
--- avida/current/source/cpu/hardware_4stack.hh:1.2.2.3 Mon Aug 25 23:30:20 2003
+++ avida/current/source/cpu/hardware_4stack.hh Thu Oct 2 17:04:37 2003
@@ -62,7 +62,7 @@
cCodeLabel next_label;
// If this thread was spawned by Inject, this will point to the genotype
// of the parasite running the thread. Otherwise, it will be NULL.
- cInjectGenotype * owner;
+ cInjectGenotype* owner;
public:
cHardware4Stack_Thread(cHardwareBase * in_hardware=NULL, int _id=-1);
cHardware4Stack_Thread(const cHardware4Stack_Thread & in_thread, int _id=-1);
@@ -229,7 +229,8 @@
inline void PrevThread(); // Shift the current thread in use.
inline void NextThread();
inline void SetThread(int value);
- inline cInjectGenotype * GetThreadOwner();
+ inline cInjectGenotype * GetCurThreadOwner();
+ inline cInjectGenotype * GetThreadOwner(int in_thread);
inline void SetThreadOwner(cInjectGenotype * in_genotype);
// -------- Tests --------
@@ -436,9 +437,14 @@
cur_thread=value;
}
-inline cInjectGenotype * cHardware4Stack::GetThreadOwner()
+inline cInjectGenotype * cHardware4Stack::GetCurThreadOwner()
{
return threads[cur_thread].owner;
+}
+
+inline cInjectGenotype * cHardware4Stack::GetThreadOwner(int thread)
+{
+ return threads[thread].owner;
}
inline void cHardware4Stack::SetThreadOwner(cInjectGenotype * in_genotype)
Index: avida/current/source/cpu/hardware_cpu.cc
diff -u avida/current/source/cpu/hardware_cpu.cc:1.34.2.9 avida/current/source/cpu/hardware_cpu.cc:1.34.2.10
--- avida/current/source/cpu/hardware_cpu.cc:1.34.2.9 Mon Aug 25 23:30:20 2003
+++ avida/current/source/cpu/hardware_cpu.cc Thu Oct 2 17:04:37 2003
@@ -431,7 +431,11 @@
cInstEntryCPU("h-copy10", &cHardwareCPU::Inst_HeadCopy10),
cInstEntryCPU("divide-sex", &cHardwareCPU::Inst_HeadDivideSex),
- cInstEntryCPU("divide-asex", &cHardwareCPU::Inst_HeadDivide1),
+ cInstEntryCPU("divide-asex", &cHardwareCPU::Inst_HeadDivideAsex),
+
+ cInstEntryCPU("div-sex", &cHardwareCPU::Inst_HeadDivideSex),
+ cInstEntryCPU("div-asex", &cHardwareCPU::Inst_HeadDivideAsex),
+ cInstEntryCPU("div-asex-w", &cHardwareCPU::Inst_HeadDivideAsexWait),
cInstEntryCPU("h-divide1", &cHardwareCPU::Inst_HeadDivide1),
cInstEntryCPU("h-divide2", &cHardwareCPU::Inst_HeadDivide2),
@@ -3108,12 +3112,21 @@
bool cHardwareCPU::Inst_HeadDivideSex()
{
organism->GetPhenotype().SetDivideSex(true);
+ organism->GetPhenotype().SetCrossNum(1);
return Inst_HeadDivide();
}
bool cHardwareCPU::Inst_HeadDivideAsex()
{
organism->GetPhenotype().SetDivideSex(false);
+ organism->GetPhenotype().SetCrossNum(0);
+ return Inst_HeadDivide();
+}
+
+bool cHardwareCPU::Inst_HeadDivideAsexWait()
+{
+ organism->GetPhenotype().SetDivideSex(false);
+ organism->GetPhenotype().SetCrossNum(0);
return Inst_HeadDivide();
}
Index: avida/current/source/cpu/hardware_cpu.hh
diff -u avida/current/source/cpu/hardware_cpu.hh:1.19.2.5 avida/current/source/cpu/hardware_cpu.hh:1.19.2.6
--- avida/current/source/cpu/hardware_cpu.hh:1.19.2.5 Mon Aug 25 23:30:21 2003
+++ avida/current/source/cpu/hardware_cpu.hh Thu Oct 2 17:04:37 2003
@@ -418,6 +418,7 @@
bool Inst_HeadDivideSex();
bool Inst_HeadDivideAsex();
+ bool Inst_HeadDivideAsexWait();
bool Inst_HeadDivide1();
bool Inst_HeadDivide2();
Index: avida/current/source/event/cPopulation.events
diff -u avida/current/source/event/cPopulation.events:1.36.2.6 avida/current/source/event/cPopulation.events:1.36.2.7
--- avida/current/source/event/cPopulation.events:1.36.2.6 Tue Sep 23 20:57:42 2003
+++ avida/current/source/event/cPopulation.events Thu Oct 2 17:04:38 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.4.2.2 avida/current/source/event/cPopulation_construct_event_auto.ci:1.4.2.3
--- avida/current/source/event/cPopulation_construct_event_auto.ci:1.4.2.2 Tue Sep 23 20:57:43 2003
+++ avida/current/source/event/cPopulation_construct_event_auto.ci Thu Oct 2 17:04:38 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.4.2.2 avida/current/source/event/cPopulation_descr.ci:1.4.2.3
--- avida/current/source/event/cPopulation_descr.ci:1.4.2.2 Tue Sep 23 20:57:43 2003
+++ avida/current/source/event/cPopulation_descr.ci Thu Oct 2 17:04:38 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.4.2.2 avida/current/source/event/cPopulation_enums_auto.ci:1.4.2.3
--- avida/current/source/event/cPopulation_enums_auto.ci:1.4.2.2 Tue Sep 23 20:57:43 2003
+++ avida/current/source/event/cPopulation_enums_auto.ci Thu Oct 2 17:04:38 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.4.2.2 avida/current/source/event/cPopulation_event_list:1.4.2.3
--- avida/current/source/event/cPopulation_event_list:1.4.2.2 Tue Sep 23 20:57:43 2003
+++ avida/current/source/event/cPopulation_event_list Thu Oct 2 17:04:38 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.4.2.2 avida/current/source/event/cPopulation_name2enum_auto.ci:1.4.2.3
--- avida/current/source/event/cPopulation_name2enum_auto.ci:1.4.2.2 Tue Sep 23 20:57:43 2003
+++ avida/current/source/event/cPopulation_name2enum_auto.ci Thu Oct 2 17:04:38 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.4.2.2 avida/current/source/event/cPopulation_process_auto.ci:1.4.2.3
--- avida/current/source/event/cPopulation_process_auto.ci:1.4.2.2 Tue Sep 23 20:57:43 2003
+++ avida/current/source/event/cPopulation_process_auto.ci Thu Oct 2 17:04:38 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/primitive.pch
Index: avida/current/source/main/birth_chamber.cc
diff -u avida/current/source/main/birth_chamber.cc:1.2.2.3 avida/current/source/main/birth_chamber.cc:1.2.2.4
--- avida/current/source/main/birth_chamber.cc:1.2.2.3 Fri May 16 15:15:54 2003
+++ avida/current/source/main/birth_chamber.cc Thu Oct 2 17:04:39 2003
@@ -35,14 +35,16 @@
parent.GetPhenotype().GetEnvironment();
if (parent.GetPhenotype().DivideSex() == false) {
- // This is asexual -- just build the child and return.
+ // This is asexual who doesn't need to wait in the birth chamber
+ // just build the child and return.
child_array.Resize(1);
child_array[0] = new cOrganism(child_genome, pop_interface, environment);
return true;
}
- // If we make it this far, it must be a sexual divide. See if there is
- // anything for it to mate with.
+ // If we make it this far, it must be a sexual or a waiting,
+ // non-recombining asexual
+ // See if there is anything for it to mate with.
if (genome_waiting == false) {
// There is nothing waiting!
wait_genome = child_genome;
@@ -50,7 +52,8 @@
return false;
}
- // We must now do a crossover.
+ // There is already someone in the birth chamber
+ // We must now do a crossover between the two
cCPUMemory genome0 = wait_genome;
cCPUMemory genome1 = child_genome;
@@ -64,48 +67,57 @@
int start1 = genome1.GetSize() * start0 / genome0.GetSize();
int end1 = genome1.GetSize() * end0 / genome0.GetSize();
- assert( start0 >= 0 && start0 < genome0.GetSize() );
- assert( end0 >= 0 && end0 < genome0.GetSize() );
- assert( start1 >= 0 && start1 < genome1.GetSize() );
- assert( end1 >= 0 && end1 < genome1.GetSize() );
+ // How many crossovers should be do? For now, 0 or 1
+ if (parent.GetPhenotype().CrossNum() ==0) {
+ child_array.Resize(2);
+ child_array[0] = new cOrganism(genome0, pop_interface, environment);
+ child_array[1] = new cOrganism(genome1, pop_interface, environment);
+ return true;
+ }
+ else {
+ assert( start0 >= 0 && start0 < genome0.GetSize() );
+ assert( end0 >= 0 && end0 < genome0.GetSize() );
+ assert( start1 >= 0 && start1 < genome1.GetSize() );
+ assert( end1 >= 0 && end1 < genome1.GetSize() );
- // @CAO for the moment, force start to be less than end.
- if (start0 > end0) Swap(start0, end0);
- if (start1 > end1) Swap(start1, end1);
+ // @CAO for the moment, force start to be less than end.
+ if (start0 > end0) Swap(start0, end0);
+ if (start1 > end1) Swap(start1, end1);
- // Calculate size of sections crossing over...
- int size0 = end0 - start0;
- int size1 = end1 - start1;
+ // Calculate size of sections crossing over...
+ int size0 = end0 - start0;
+ int size1 = end1 - start1;
- int new_size0 = genome0.GetSize() - size0 + size1;
- int new_size1 = genome1.GetSize() - size1 + size0;
+ int new_size0 = genome0.GetSize() - size0 + size1;
+ int new_size1 = genome1.GetSize() - size1 + size0;
- // Don't Crossover if offspring will be illegal!!!
- if( new_size0 < MIN_CREATURE_SIZE || new_size0 > MAX_CREATURE_SIZE ||
- new_size1 < MIN_CREATURE_SIZE || new_size1 > MAX_CREATURE_SIZE ){
- return false;
- }
+ // Don't Crossover if offspring will be illegal!!!
+ if( new_size0 < MIN_CREATURE_SIZE || new_size0 > MAX_CREATURE_SIZE ||
+ new_size1 < MIN_CREATURE_SIZE || new_size1 > MAX_CREATURE_SIZE ){
+ return false;
+ }
+
+ if (size0 > 0 && size1 > 0) {
+ cGenome cross0 = cGenomeUtil::Crop(genome0, start0, end0);
+ cGenome cross1 = cGenomeUtil::Crop(genome1, start1, end1);
+ genome0.Replace(start0, size0, cross1);
+ genome1.Replace(start1, size1, cross0);
+ }
+ else if (size0 > 0) {
+ cGenome cross0 = cGenomeUtil::Crop(genome0, start0, end0);
+ genome1.Replace(start1, size1, cross0);
+ }
+ else if (size1 > 0) {
+ cGenome cross1 = cGenomeUtil::Crop(genome1, start1, end1);
+ genome0.Replace(start0, size0, cross1);
+ }
+
+ // Build the two organisms.
+ child_array.Resize(2);
+ child_array[0] = new cOrganism(genome0, pop_interface, environment);
+ child_array[1] = new cOrganism(genome1, pop_interface, environment);
- if (size0 > 0 && size1 > 0) {
- cGenome cross0 = cGenomeUtil::Crop(genome0, start0, end0);
- cGenome cross1 = cGenomeUtil::Crop(genome1, start1, end1);
- genome0.Replace(start0, size0, cross1);
- genome1.Replace(start1, size1, cross0);
- }
- else if (size0 > 0) {
- cGenome cross0 = cGenomeUtil::Crop(genome0, start0, end0);
- genome1.Replace(start1, size1, cross0);
- }
- else if (size1 > 0) {
- cGenome cross1 = cGenomeUtil::Crop(genome1, start1, end1);
- genome0.Replace(start0, size0, cross1);
+ return true;
}
-
- // Build the two organisms.
- child_array.Resize(2);
- child_array[0] = new cOrganism(genome0, pop_interface, environment);
- child_array[1] = new cOrganism(genome1, pop_interface, environment);
-
- return true;
}
Index: avida/current/source/main/genome.hh
diff -u avida/current/source/main/genome.hh:1.3.2.1 avida/current/source/main/genome.hh:1.3.2.2
--- avida/current/source/main/genome.hh:1.3.2.1 Mon Aug 25 23:30:22 2003
+++ avida/current/source/main/genome.hh Thu Oct 2 17:04:39 2003
@@ -32,6 +32,8 @@
virtual void operator=(const cGenome & other_genome);
virtual bool operator==(const cGenome & other_genome) const;
+ virtual bool operator!=(const cGenome & other_genome) const
+ { return !(this->operator==(other_genome)); }
virtual bool operator<(const cGenome & other_genome) const
{ return AsString() < other_genome.AsString(); }
Index: avida/current/source/main/genotype.hh
diff -u avida/current/source/main/genotype.hh:1.22.2.2 avida/current/source/main/genotype.hh:1.22.2.3
--- avida/current/source/main/genotype.hh:1.22.2.2 Thu May 15 05:35:13 2003
+++ avida/current/source/main/genotype.hh Thu Oct 2 17:04:39 2003
@@ -219,6 +219,7 @@
void Deactivate(int update);
+
int GetUpdateBorn() { return birth_data.update_born; }
int GetParentID() { return birth_data.parent_id; }
int GetParentDistance() { return birth_data.parent_distance; }
Index: avida/current/source/main/inject_genebank.cc
diff -u avida/current/source/main/inject_genebank.cc:1.2.6.1 avida/current/source/main/inject_genebank.cc:1.2.6.2
--- avida/current/source/main/inject_genebank.cc:1.2.6.1 Mon Aug 25 23:30:22 2003
+++ avida/current/source/main/inject_genebank.cc Thu Oct 2 17:04:39 2003
@@ -455,13 +455,15 @@
found_genotype = active_inject_genotypes[list_num].Find(in_genome);
if (!found_genotype) {
- found_genotype = new cInjectGenotype();
+ found_genotype = new cInjectGenotype(stats.GetUpdate());
found_genotype->SetGenome(in_genome);
found_genotype->SetParent(parent_genotype);
-
+ if(parent_genotype!=NULL)
+ {
+ parent_genotype->SetCanReproduce();
+ }
AddInjectGenotype( found_genotype, list_num );
}
-
return found_genotype;
}
@@ -625,38 +627,24 @@
void cInjectGenebank::DumpDetailedEntry(cInjectGenotype * genotype, const cString & filename, int update)
{
- /*fp << genotype->GetID() << " " // 1
- << genotype->GetParentID() << " " // 2
- // << genotype->GetParentDistance() << " " // 3
- << genotype->GetNumInjected() << " " // 4
- << genotype->GetTotalInjected() << " " // 5
- << genotype->GetLength() << " " // 6
- // << genotype->GetMerit() << " " // 7
- // << genotype->GetGestationTime() << " " // 8
- // << genotype->GetFitness() << " " // 9
- << genotype->GetUpdateBorn() << " " // 10
- << genotype->GetUpdateDeactivated() << " " // 11
- << genotype->GetDepth() << " " // 12
- << genotype->GetGenome().AsString() << " " // 13
- << endl;*/
-
- cDataFile & df = stats.GetDataFile(filename);
-
- df.WriteComment( "Avida parasite dump data" );
- df.WriteTimeStamp();
-
- //df.Write( update, "update");
- df.Write( genotype->GetID(), "parasite genotype ID");
- df.Write( genotype->GetName(), "parasite genotype name");
- df.Write( genotype->GetParentID(), "parasite parent ID");
- df.Write( genotype->GetNumInjected(), "current number of injected creatures with this genotype");
- df.Write( genotype->GetTotalInjected(), "total number of injected creatures with this genotype");
- df.Write( genotype->GetLength(), "genotype length");
- df.Write( genotype->GetUpdateBorn(), "update this genotype was born");
- df.Write( genotype->GetUpdateDeactivated(), "update this genotype was deactivated");
- df.Write( genotype->GetDepth(), "genotype depth");
- df.Write( genotype->GetGenome().AsString(), "genome of this genotype");
- df.Endl();
+ //if(genotype->CanReproduce())
+ // {
+ cDataFile & df = stats.GetDataFile(filename);
+
+ df.WriteComment( "Avida parasite dump data" );
+ df.WriteTimeStamp();
+
+ df.Write( genotype->GetID(), "parasite genotype ID");
+ df.Write( genotype->GetName(), "parasite genotype name");
+ df.Write( genotype->GetParentID(), "parasite parent ID");
+ df.Write( genotype->GetNumInjected(), "current number of injected creatures with this genotype");
+ df.Write( genotype->GetTotalInjected(), "total number of injected creatures with this genotype");
+ df.Write( genotype->GetLength(), "genotype length");
+ df.Write( genotype->GetUpdateBorn(), "update this genotype was born");
+ df.Write( genotype->CanReproduce(), "has this genotype reproduced?");
+ df.Write( genotype->GetGenome().AsString(), "genome of this genotype");
+ df.Endl();
+ //}
}
bool cInjectGenebank::OK()
Index: avida/current/source/main/inject_genotype.cc
diff -u avida/current/source/main/inject_genotype.cc:1.1.6.1 avida/current/source/main/inject_genotype.cc:1.1.6.2
--- avida/current/source/main/inject_genotype.cc:1.1.6.1 Mon Aug 25 23:30:22 2003
+++ avida/current/source/main/inject_genotype.cc Thu Oct 2 17:04:39 2003
@@ -52,6 +52,7 @@
, name("p001-no_name")
, flag_threshold(false)
, is_active(true)
+ , can_reproduce(false)
, defer_adjust(0)
, symbol(0)
, birth_data(in_update_born)
Index: avida/current/source/main/inject_genotype.hh
diff -u avida/current/source/main/inject_genotype.hh:1.1.6.1 avida/current/source/main/inject_genotype.hh:1.1.6.2
--- avida/current/source/main/inject_genotype.hh:1.1.6.1 Mon Aug 25 23:30:22 2003
+++ avida/current/source/main/inject_genotype.hh Thu Oct 2 17:04:39 2003
@@ -65,6 +65,7 @@
cString name;
bool flag_threshold;
bool is_active; // Is this genotype still alive?
+ bool can_reproduce; // Can this genotype reproduce?
int defer_adjust; // Don't adjust in the genebank until all are cleared.
int id_num;
@@ -143,10 +144,12 @@
//int GetTestGenerations() const;
void SetParent(cInjectGenotype * parent);
+ void SetUpdateBorn (int update) { birth_data.update_born = update; }
void SetName(cString in_name) { name = in_name; }
void SetNext(cInjectGenotype * in_next) { next = in_next; }
void SetPrev(cInjectGenotype * in_prev) { prev = in_prev; }
void SetSymbol(char in_symbol) { symbol = in_symbol; }
+ void SetCanReproduce() { can_reproduce = true; }
inline void SetThreshold();
void IncDeferAdjust() { defer_adjust++; }
void DecDeferAdjust() { defer_adjust--; assert(defer_adjust >= 0); }
@@ -156,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
@@ -214,13 +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; }
@@ -231,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/phenotype.cc
diff -u avida/current/source/main/phenotype.cc:1.27.2.4 avida/current/source/main/phenotype.cc:1.27.2.5
--- avida/current/source/main/phenotype.cc:1.27.2.4 Mon Aug 25 23:30:23 2003
+++ avida/current/source/main/phenotype.cc Thu Oct 2 17:04:39 2003
@@ -124,11 +124,13 @@
is_multi_thread = parent_phenotype.is_multi_thread;
parent_true = parent_phenotype.copy_true;
parent_sex = parent_phenotype.divide_sex;
+ parent_cross_num = parent_phenotype.cross_num;
to_die = false;
// Setup child info...
copy_true = false;
divide_sex = false;
+ cross_num = 0;
last_child_fertile = is_fertile;
child_fertile = true;
child_copied_size = 0;
@@ -192,11 +194,13 @@
is_multi_thread = false;
parent_true = true;
parent_sex = false;
+ parent_cross_num = 0;
to_die = false;
// Setup child info...
copy_true = false;
divide_sex = false;
+ cross_num = 0;
child_fertile = true;
last_child_fertile = true;
child_copied_size = 0;
@@ -259,10 +263,12 @@
(void) is_multi_thread;
(void) parent_true;
(void) parent_sex;
+ (void) parent_cross_num;
// Reset child info...
(void) copy_true;
(void) divide_sex;
+ (void) cross_num;
last_child_fertile = child_fertile;
child_fertile = true;
(void) child_copied_size;;
@@ -335,10 +341,12 @@
(void) is_multi_thread;
(void) parent_true;
(void) parent_sex;
+ (void) parent_cross_num;
// Reset child info...
(void) copy_true;
(void) divide_sex;
+ (void) cross_num;
(void) child_fertile;
(void) last_child_fertile;
(void) child_copied_size;
@@ -463,9 +471,11 @@
fp << is_mutated << " ";
fp << parent_true << " ";
fp << parent_sex << " ";
+ fp << parent_cross_num << " ";
fp << copy_true << " ";
fp << divide_sex << " ";
+ fp << cross_num << " ";
fp << child_fertile << " ";
fp << last_child_fertile << " ";
@@ -528,9 +538,11 @@
fp >> is_mutated;
fp >> parent_true;
fp >> parent_sex;
+ fp >> parent_cross_num;
fp >> copy_true;
fp >> divide_sex;
+ fp >> cross_num;
fp >> child_fertile;
fp >> last_child_fertile;
Index: avida/current/source/main/phenotype.hh
diff -u avida/current/source/main/phenotype.hh:1.29.2.4 avida/current/source/main/phenotype.hh:1.29.2.5
--- avida/current/source/main/phenotype.hh:1.29.2.4 Mon Aug 25 23:30:23 2003
+++ avida/current/source/main/phenotype.hh Thu Oct 2 17:04:39 2003
@@ -92,10 +92,12 @@
bool is_multi_thread; // Does this organism have 2 or more threads?
bool parent_true; // Is this genome an exact copy of its parent's?
bool parent_sex; // Did the parent divide with sex?
+ int parent_cross_num; // How many corssovers did the parent do?
// 6. Child information...
bool copy_true; // Can this genome produce an exact copy of itself?
bool divide_sex; // Was this child created with a sexual divide?
+ int cross_num ; // How many crossovers should this child do?
bool child_fertile; // Will this organism's next child be fertile?
bool last_child_fertile; // Was the child being born to be fertile?
int child_copied_size; // Instruction copied into child.
@@ -206,10 +208,12 @@
bool IsMultiThread() const { assert(initialized == true); return is_multi_thread; }
bool ParentTrue() const { assert(initialized == true); return parent_true; }
bool ParentSex() const { assert(initialized == true); return parent_sex; }
+ int ParentCrossNum() const { assert(initialized == true); return parent_cross_num; }
bool CopyTrue() const { assert(initialized == true); return copy_true; }
bool DivideSex() const { assert(initialized == true); return divide_sex; }
- bool ChildFertile() const
+ int CrossNum() const { assert(initialized == true); return cross_num; }
+ bool ChildFertile() const
{ assert(initialized == true); return child_fertile;}
int GetChildCopiedSize() const
{ assert(initialized == true); return child_copied_size; }
@@ -224,6 +228,7 @@
void SetLinesCopied(int _copied_size) { child_copied_size = _copied_size; }
void SetDivType(double _div_type) { div_type = _div_type; }
void SetDivideSex(bool _divide_sex) { divide_sex = _divide_sex; }
+ void SetCrossNum(int _cross_num) { cross_num = _cross_num; }
void IncCurInstCount(int _inst_num) { assert(initialized == true); cur_inst_count[_inst_num]++; }
void DecCurInstCount(int _inst_num) { assert(initialized == true); cur_inst_count[_inst_num]--; }
@@ -240,8 +245,10 @@
bool & IsMutated() { assert(initialized == true); return is_mutated; }
bool & ParentTrue() { assert(initialized == true); return parent_true; }
bool & ParentSex() { assert(initialized == true); return parent_sex; }
+ int & ParentCrossNum() { assert(initialized == true); return parent_cross_num; }
bool & CopyTrue() { assert(initialized == true); return copy_true; }
bool & DivideSex() { assert(initialized == true); return divide_sex; }
+ int & CrossNum() { assert(initialized == true); return cross_num; }
bool & ChildFertile() { assert(initialized == true); return child_fertile; }
bool & IsMultiThread() { assert(initialized == true); return is_multi_thread; }
};
Index: avida/current/source/main/population.cc
diff -u avida/current/source/main/population.cc:1.94.2.6 avida/current/source/main/population.cc:1.94.2.7
--- avida/current/source/main/population.cc:1.94.2.6 Tue Sep 23 20:57:43 2003
+++ avida/current/source/main/population.cc Thu Oct 2 17:04:39 2003
@@ -355,7 +355,7 @@
return false;
cHardware4Stack & parent_cpu = (cHardware4Stack &) parent.GetHardware();
- cInjectGenotype * parent_genotype = parent_cpu.GetThreadOwner();
+ cInjectGenotype * parent_genotype = parent_cpu.GetCurThreadOwner();
const int parent_id = parent.PopInterface().GetCellID();
assert(parent_id >= 0 && parent_id < cell_array.GetSize());
@@ -377,12 +377,13 @@
if(target_organism->InjectHost(parent_cpu.GetLabel(), injected_code)) {
// If the parent genotype is not correct for the child, adjust it.
- if (parent_genotype == NULL || !(parent_genotype->GetGenome() == injected_code)) {
+ if (parent_genotype == NULL || parent_genotype->GetGenome() != injected_code) {
child_genotype = inject_genebank->AddInjectGenotype(injected_code, parent_genotype);
}
target_organism->AddParasite(child_genotype);
child_genotype->AddParasite();
+ child_cpu.SetThreadOwner(child_genotype);
//if(parent_genotype!=NULL)
// parent_genotype->RemoveParasite();
inject_genebank->AdjustInjectGenotype(*child_genotype);
@@ -429,11 +430,12 @@
bool cPopulation::ActivateInject(const int cell_id, const cGenome & injected_code)
{
cInjectGenotype * child_genotype = inject_genebank->AddInjectGenotype(injected_code);
-
+ cHardware4Stack & child_cpu = (cHardware4Stack &) cell_array[cell_id].GetOrganism()->GetHardware();
if(cell_array[cell_id].GetOrganism()->InjectHost(cCodeLabel(), injected_code))
{
cell_array[cell_id].GetOrganism()->AddParasite(child_genotype);
child_genotype->AddParasite();
+ child_cpu.SetThreadOwner(child_genotype);
inject_genebank->AdjustInjectGenotype(*child_genotype);
}
else
@@ -888,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.
@@ -897,6 +924,7 @@
UpdateGenotypeStats();
UpdateSpeciesStats();
UpdateDominantStats();
+ UpdateDominantParaStats();
// Do any final calculations...
stats.SetNumCreatures(GetNumOrganisms());
@@ -1463,6 +1491,7 @@
outfile.open("debug.out", ofstream::app);
outfile << stats.GetUpdate() << endl;
int total=0;
+ cInjectGenotype * temp;
for(int x=0; x<cell_array.GetSize(); x++)
{
if(cell_array[x].GetOrganism()!=NULL)
@@ -1471,10 +1500,17 @@
cell_array[x].GetOrganism()->GetNumParasites()<=1);
total+=cell_array[x].GetOrganism()->GetNumParasites();
if(cell_array[x].GetOrganism()->GetNumParasites())
- outfile << x << " ";
+ {
+ cHardware4Stack & cpu = (cHardware4Stack &) cell_array[x].GetOrganism()->GetHardware();
+ outfile << x << " ";
+ outfile << cell_array[x].GetOrganism()->GetGenotype()->GetID() << " ";
+ temp = cpu.GetThreadOwner(1);
+ assert(temp!=NULL);
+ outfile << temp->GetID() << endl;
+ }
}
}
- outfile << endl << total << endl;
+ outfile << total << endl;
outfile.close();
}
@@ -1501,4 +1537,4 @@
outfile.open(filename, ofstream::app);
outfile << stats.GetUpdate() << "\t" << ids.size() << endl;
outfile.close();
-}
\ No newline at end of file
+}
Index: avida/current/source/main/population.hh
diff -u avida/current/source/main/population.hh:1.48.2.5 avida/current/source/main/population.hh:1.48.2.6
--- avida/current/source/main/population.hh:1.48.2.5 Tue Sep 23 20:57:43 2003
+++ avida/current/source/main/population.hh Thu Oct 2 17:04:39 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.49.2.4 avida/current/source/main/stats.cc:1.49.2.5
--- avida/current/source/main/stats.cc:1.49.2.4 Tue May 20 19:14:36 2003
+++ avida/current/source/main/stats.cc Thu Oct 2 17:04:49 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.44.2.4 avida/current/source/main/stats.hh:1.44.2.5
--- avida/current/source/main/stats.hh:1.44.2.4 Tue May 20 19:14:36 2003
+++ avida/current/source/main/stats.hh Thu Oct 2 17:04:49 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);
Index: avida/current/source/qt-viewer/qt-viewer.pch
Index: avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.cc
diff -u avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.cc:1.13.2.6 avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.cc:1.13.2.7
--- avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.cc:1.13.2.6 Tue Sep 23 23:56:47 2003
+++ avida/current/source/qt-viewer/n_orig_instruction_cpu_widget.cc Thu Oct 2 17:04:49 2003
@@ -11,9 +11,6 @@
#ifndef QDESKTOPWIDGET_H
#include <qdesktopwidget.h>
#endif
-#ifndef QFONT_H
-#include <qfont.h>
-#endif
#ifndef QHBUTTONGROUP_H
#include <qhbuttongroup.h>
#endif
@@ -86,7 +83,6 @@
{
GenDebug("entered.");
-
m_hboxlayout = new QHBoxLayout(this);
m_title_label = new QLabel(this);
QFont new_font(m_title_label->font());
@@ -102,7 +98,6 @@
m_hboxlayout->addWidget(m_data1_label);
m_data2_label = new QLabel(this);
- m_data2_label->setFont(new_font);
m_data2_label->setAlignment((m_data2_label->alignment() & !(Qt::AlignRight)) | Qt::AlignRight);
m_data2_label->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));
m_hboxlayout->addWidget(m_data2_label);
Index: avida/current/source/support/genesis
diff -u avida/current/source/support/genesis:1.34.2.4 avida/current/source/support/genesis:1.34.2.5
--- avida/current/source/support/genesis:1.34.2.4 Mon Aug 25 23:30:24 2003
+++ avida/current/source/support/genesis Thu Oct 2 17:04:50 2003
@@ -3,7 +3,7 @@
# For more information, see doc/genesis.html
#############################################################################
-VERSION_ID 2.0b4 # Do not change this value!
+VERSION_ID 2.0b6 # Do not change this value!
### Architecture Variables ###
MAX_UPDATES -1 # Maximum updates to run simulation (-1 = no limit)
Index: avida/current/source/support/genesis.4stack
diff -u avida/current/source/support/genesis.4stack:1.2.6.1 avida/current/source/support/genesis.4stack:1.2.6.2
--- avida/current/source/support/genesis.4stack:1.2.6.1 Mon Aug 25 23:30:25 2003
+++ avida/current/source/support/genesis.4stack Thu Oct 2 17:04:51 2003
@@ -3,7 +3,7 @@
# For more information, see doc/genesis.html
#############################################################################
-VERSION_ID 2.0b1 # Do not change this value!
+VERSION_ID 2.0b6 # Do not change this value!
### Architecture Variables ###
MAX_UPDATES -1 # Maximum updates to run simulation (-1 = no limit)
Index: avida/current/source/viewers/ncurses-viewer.pch
Index: avida/current/source/viewers/text_screen.cc
diff -u avida/current/source/viewers/text_screen.cc:1.10.2.3 avida/current/source/viewers/text_screen.cc:1.10.2.4
--- avida/current/source/viewers/text_screen.cc:1.10.2.3 Mon Aug 25 23:30:26 2003
+++ avida/current/source/viewers/text_screen.cc Thu Oct 2 17:04:54 2003
@@ -10,6 +10,8 @@
#include "../main/species.hh"
#include "../main/genotype.hh"
#include "../main/genebank.hh"
+#include "../main/inject_genotype.hh"
+#include "../main/inject_genebank.hh"
#include "../main/population.hh"
#include "../main/population_cell.hh"
#include "../main/organism.hh"
@@ -61,6 +63,16 @@
}
}
+void cViewInfo::AddInjectGenChart(cInjectGenotype * in_gen)
+{
+ for (int i = 0; i < NUM_SYMBOLS; i++) {
+ if (inject_genotype_chart[i] == NULL) {
+ inject_genotype_chart[i] = in_gen;
+ in_gen->SetSymbol(symbol_chart[i]);
+ break;
+ }
+ }
+}
void cViewInfo::SetupSymbolMaps(int map_mode, bool use_color)
{
Index: avida/current/source/viewers/text_screen.hh
diff -u avida/current/source/viewers/text_screen.hh:1.8.2.2 avida/current/source/viewers/text_screen.hh:1.8.2.3
--- avida/current/source/viewers/text_screen.hh:1.8.2.2 Mon Aug 25 23:30:26 2003
+++ avida/current/source/viewers/text_screen.hh Thu Oct 2 17:04:54 2003
@@ -23,6 +23,8 @@
class cPopulationCell;
class cOrganism;
class cGenebank;
+class cInjectGenotype;
+class cInjectGenebank;
#define NUM_SYMBOLS 12
#define SYMBOL_THRESHOLD 10
@@ -68,6 +70,7 @@
// Symbol information
cGenotype * genotype_chart[NUM_SYMBOLS];
cSpecies * species_chart[NUM_SYMBOLS];
+ cInjectGenotype * inject_genotype_chart[NUM_SYMBOLS];
char symbol_chart[NUM_SYMBOLS];
tArray<char> map;
@@ -75,8 +78,10 @@
inline bool InGenChart(cGenotype * in_gen);
inline bool InSpeciesChart(cSpecies * in_species);
+ inline bool InInjectGenChart(cInjectGenotype * in_gen);
void AddGenChart(cGenotype * in_gen);
void AddSpeciesChart(cSpecies * in_species);
+ void AddInjectGenChart(cInjectGenotype * in_gen);
public:
cViewInfo(cPopulation & in_population);
~cViewInfo() { ; }
@@ -100,6 +105,7 @@
int GetNumSymbols() { return NUM_SYMBOLS; }
cGenotype * GetGenotype(int index) { return genotype_chart[index]; }
cSpecies * GetSpecies(int index) { return species_chart[index]; }
+ cInjectGenotype * GetInjectGenotype(int index) { return inject_genotype_chart[index]; }
cPopulationCell * GetActiveCell() { return active_cell; }
@@ -167,6 +173,14 @@
{
for (int i = 0; i < NUM_SYMBOLS; i++) {
if (species_chart[i] == in_species) return true;
+ }
+ return false;
+}
+
+inline bool cViewInfo::InInjectGenChart(cInjectGenotype * in_gen)
+{
+ for (int i = 0; i < NUM_SYMBOLS; i++) {
+ if (inject_genotype_chart[i] == in_gen) return true;
}
return false;
}
Index: avida/current/source/third-party/pdcurses/README.txt
+++ avida/current/source/third-party/pdcurses/README.txt
Index: avida/current/source/third-party/pdcurses/curses.h
+++ avida/current/source/third-party/pdcurses/curses.h
Index: avida/current/source/third-party/pdcurses/pdcurses.lib
+++ avida/current/source/third-party/pdcurses/pdcurses.lib
More information about the Avida-cvs
mailing list