[Avida-SVN] r2742 - branches/interrupt/source/analyze
beckma24 at myxo.css.msu.edu
beckma24 at myxo.css.msu.edu
Tue Aug 5 09:18:59 PDT 2008
Author: beckma24
Date: 2008-08-05 12:18:59 -0400 (Tue, 05 Aug 2008)
New Revision: 2742
Modified:
branches/interrupt/source/analyze/cAnalyze.cc
branches/interrupt/source/analyze/cAnalyzeGenotype.cc
Log:
part 2 of code to protect sites in genome
Modified: branches/interrupt/source/analyze/cAnalyze.cc
===================================================================
--- branches/interrupt/source/analyze/cAnalyze.cc 2008-08-05 15:38:07 UTC (rev 2741)
+++ branches/interrupt/source/analyze/cAnalyze.cc 2008-08-05 16:18:59 UTC (rev 2742)
@@ -4215,7 +4215,7 @@
if (copy_mut_prob > 0.0) {
for (int i = 0; i < mod_genome.GetSize(); i++) {
if (m_world->GetRandom().P(copy_mut_prob)) {
- mod_genome[i] = inst_set.GetRandomInst(m_ctx);
+ mod_genome.SetInst(i, inst_set.GetRandomInst(m_ctx), false);
num_mutations++;
}
}
@@ -4446,7 +4446,7 @@
for (int line_num = 0; line_num < max_line; line_num++) {
// Save a copy of the current instruction and replace it with "NULL"
int cur_inst = base_genome[line_num].GetOp();
- mod_genome[line_num] = null_inst;
+ mod_genome.SetInst(line_num, null_inst, false);
cAnalyzeGenotype ko_genotype(m_world, mod_genome, ko_inst_set);
ko_genotype.Recalculate(m_ctx);
@@ -4477,8 +4477,8 @@
for (int line2 = line1+1; line2 < max_line; line2++) {
int cur_inst1 = base_genome[line1].GetOp();
int cur_inst2 = base_genome[line2].GetOp();
- mod_genome[line1] = null_inst;
- mod_genome[line2] = null_inst;
+ mod_genome.SetInst(line1, null_inst, false);
+ mod_genome.SetInst(line2, null_inst, false);
cAnalyzeGenotype ko_genotype(m_world, mod_genome, ko_inst_set);
ko_genotype.Recalculate(m_ctx);
@@ -4816,7 +4816,7 @@
int cur_inst = base_genome[line_num].GetOp();
char cur_symbol = base_genome[line_num].GetSymbol();
- mod_genome[line_num] = null_inst;
+ mod_genome.SetInst(line_num, null_inst, false);
cAnalyzeGenotype test_genotype(m_world, mod_genome, map_inst_set);
test_genotype.Recalculate(m_ctx, &test_info);
@@ -5065,7 +5065,7 @@
for (int line_num = 0; line_num < max_line; line_num++) {
int cur_inst = base_genome[line_num].GetOp();
- mod_genome[line_num] = null_inst;
+ mod_genome.SetInst(line_num, null_inst, false);
cAnalyzeGenotype test_genotype(m_world, mod_genome, map_inst_set);
test_genotype.Recalculate(m_ctx);
@@ -5290,7 +5290,7 @@
int cur_inst = base_genome[line_num].GetOp();
// Determine what happens to this genotype when this line is knocked out
- mod_genome[line_num] = null_inst;
+ mod_genome.SetInst(line_num, null_inst, false);
cAnalyzeGenotype test_genotype(m_world, mod_genome, map_inst_set);
test_genotype.Recalculate(m_ctx);
@@ -5574,7 +5574,7 @@
}
// Column: Knockout
- mod_genome[line_num] = null_inst;
+ mod_genome.SetInst(line_num, null_inst, false);
cAnalyzeGenotype test_genotype(m_world, mod_genome, map_inst_set);
test_genotype.Recalculate(m_ctx);
const double test_fitness = test_genotype.GetFitness() / base_fitness;
@@ -6899,7 +6899,7 @@
if (cur_fitness > base_fitness) num_detrimental++;
else if (cur_fitness < base_fitness) num_beneficial++;
else num_neutral++;
- test_genome[i] = genotype->GetGenome()[i];
+ test_genome.SetInst(i, genotype->GetGenome()[i], genotype->GetGenome().IsProtected(i));
}
}
@@ -8522,7 +8522,7 @@
if (copy_mut_prob > 0.0) {
for (int n = 0; n < child_genome.GetSize(); n++) {
if (m_world->GetRandom().P(copy_mut_prob)) {
- child_genome[n] = inst_set.GetRandomInst(m_ctx);
+ child_genome.SetInst(n, inst_set.GetRandomInst(m_ctx), false);
}
}
}
Modified: branches/interrupt/source/analyze/cAnalyzeGenotype.cc
===================================================================
--- branches/interrupt/source/analyze/cAnalyzeGenotype.cc 2008-08-05 15:38:07 UTC (rev 2741)
+++ branches/interrupt/source/analyze/cAnalyzeGenotype.cc 2008-08-05 16:18:59 UTC (rev 2742)
@@ -243,7 +243,7 @@
for (int line_num = 0; line_num < length; line_num++) {
// Save a copy of the current instruction and replace it with "NULL"
int cur_inst = mod_genome[line_num].GetOp();
- mod_genome[line_num] = null_inst;
+ mod_genome.SetInst(line_num, null_inst, false);
cAnalyzeGenotype ko_genotype(m_world, mod_genome, ko_inst_set);
ko_genotype.Recalculate(ctx);
if (check_chart == true) {
@@ -302,8 +302,8 @@
int cur_inst1 = mod_genome[line1].GetOp();
int cur_inst2 = mod_genome[line2].GetOp();
- mod_genome[line1] = null_inst;
- mod_genome[line2] = null_inst;
+ mod_genome.SetInst(line1, null_inst, false);
+ mod_genome.SetInst(line2, null_inst, false);
cAnalyzeGenotype ko_genotype(m_world, mod_genome, ko_inst_set);
ko_genotype.Recalculate(ctx);
More information about the Avida-cvs
mailing list