[avida-cvs] avida CVS commits: /current/source/main analyze.cc
goingssh
avida-cvs at alife.org
Fri Aug 1 19:08:17 PDT 2003
goingssh Fri Aug 1 11:08:17 2003 EDT
Modified files:
/avida/current/source/main analyze.cc
Log:
fixed some problems in map_mutations
Index: avida/current/source/main/analyze.cc
diff -u avida/current/source/main/analyze.cc:1.74 avida/current/source/main/analyze.cc:1.75
--- avida/current/source/main/analyze.cc:1.74 Fri Jun 13 14:49:59 2003
+++ avida/current/source/main/analyze.cc Fri Aug 1 11:08:17 2003
@@ -2043,77 +2043,86 @@
}
// Columns 2 to D+1 (the possible mutations)
- for (int mod_inst = 0; mod_inst < num_insts; mod_inst++) {
- mod_genome[line_num].SetOp(mod_inst);
- cAnalyzeGenotype test_genotype(mod_genome, inst_set);
- test_genotype.Recalculate();
- const double test_fitness = test_genotype.GetFitness() / base_fitness;
- row_fitness += test_fitness;
- total_fitness += test_fitness;
- col_fitness[mod_inst] += test_fitness;
-
- // Categorize this mutation...
- if (test_fitness == 1.0) { // Neutral Mutation...
- row_neut++;
- total_neut++;
- if (file_type == FILE_TYPE_HTML) color_string = "#FFFFFF";
- } else if (test_fitness == 0.0) { // Lethal Mutation...
- row_dead++;
- total_dead++;
- if (file_type == FILE_TYPE_HTML) color_string = "#FF0000";
- } else if (test_fitness < 1.0) { // Detrimental Mutation...
- row_neg++;
- total_neg++;
- if (file_type == FILE_TYPE_HTML) color_string = "#FFFF00";
- } else { // Beneficial Mutation...
- row_pos++;
- total_pos++;
- if (file_type == FILE_TYPE_HTML) color_string = "#00FF00";
- }
-
- // Write out this cell...
- if (file_type == FILE_TYPE_HTML) {
- fp << "<th bgcolor=\"" << color_string << "\">";
- }
- fp << test_fitness << " ";
+ for (int mod_inst = 0; mod_inst < num_insts; mod_inst++)
+ {
+ if (mod_inst == cur_inst) {
+ if (file_type == FILE_TYPE_HTML) {
+ color_string = "#FFFFFF";
+ fp << "<th bgcolor=\"" << color_string << "\">";
+ }
+ }
+ else {
+ mod_genome[line_num].SetOp(mod_inst);
+ cAnalyzeGenotype test_genotype(mod_genome, inst_set);
+ test_genotype.Recalculate();
+ const double test_fitness = test_genotype.GetFitness() / base_fitness;
+ row_fitness += test_fitness;
+ total_fitness += test_fitness;
+ col_fitness[mod_inst] += test_fitness;
+
+ // Categorize this mutation...
+ if (test_fitness == 1.0) { // Neutral Mutation...
+ row_neut++;
+ total_neut++;
+ if (file_type == FILE_TYPE_HTML) color_string = "#FFFFFF";
+ } else if (test_fitness == 0.0) { // Lethal Mutation...
+ row_dead++;
+ total_dead++;
+ if (file_type == FILE_TYPE_HTML) color_string = "#FF0000";
+ } else if (test_fitness < 1.0) { // Detrimental Mutation...
+ row_neg++;
+ total_neg++;
+ if (file_type == FILE_TYPE_HTML) color_string = "#FFFF00";
+ } else { // Beneficial Mutation...
+ row_pos++;
+ total_pos++;
+ if (file_type == FILE_TYPE_HTML) color_string = "#00FF00";
+ }
+
+ // Write out this cell...
+ if (file_type == FILE_TYPE_HTML) {
+ fp << "<th bgcolor=\"" << color_string << "\">";
+ }
+ fp << test_fitness << " ";
+ }
}
// Column: Knockout
mod_genome[line_num] = null_inst;
cAnalyzeGenotype test_genotype(mod_genome, map_inst_set);
test_genotype.Recalculate();
- const double test_fitness = test_genotype.GetFitness();
+ const double test_fitness = test_genotype.GetFitness() / base_fitness;
col_fitness[num_insts] += test_fitness;
// Categorize this mutation if its in HTML mode (color only)...
if (file_type == FILE_TYPE_HTML) {
- if (test_fitness == base_fitness) color_string = "#FFFFFF";
- else if (test_fitness == 0.0) color_string = "#FF0000";
- else if (test_fitness < base_fitness) color_string = "#FFFF00";
- else color_string = "#00FF00";
+ if (test_fitness == 1.0) color_string = "#FFFFFF";
+ else if (test_fitness == 0.0) color_string = "#FF0000";
+ else if (test_fitness < 1.0) color_string = "#FFFF00";
+ else color_string = "#00FF00";
- fp << "<th bgcolor=\"" << color_string << "\">";
+ fp << "<th bgcolor=\"" << color_string << "\">";
}
-
+
fp << test_fitness << " ";
// Fraction Columns...
if (file_type == FILE_TYPE_HTML) fp << "<th bgcolor=\"#FF0000\">";
- fp << (double) row_dead / (double) num_insts << " ";
+ fp << (double) row_dead / (double) (num_insts-1) << " ";
if (file_type == FILE_TYPE_HTML) fp << "<th bgcolor=\"#FFFF00\">";
- fp << (double) row_neg / (double) num_insts << " ";
+ fp << (double) row_neg / (double) (num_insts-1) << " ";
if (file_type == FILE_TYPE_HTML) fp << "<th bgcolor=\"#FFFFFF\">";
- fp << (double) row_neut / (double) num_insts << " ";
+ fp << (double) row_neut / (double) (num_insts-1) << " ";
if (file_type == FILE_TYPE_HTML) fp << "<th bgcolor=\"#00FF00\">";
- fp << (double) row_pos / (double) num_insts << " ";
+ fp << (double) row_pos / (double) (num_insts-1) << " ";
// Column: Average Fitness
if (file_type == FILE_TYPE_HTML) fp << "<th>";
- fp << row_fitness / (double) num_insts << " ";
+ fp << row_fitness / (double) (num_insts-1) << " ";
// Column: Expected Entropy @CAO Implement!
if (file_type == FILE_TYPE_HTML) fp << "<th>";
@@ -2137,7 +2146,7 @@
fp << "<th>" << col_fitness[i] / max_line << " ";
}
- int total_tests = max_line * num_insts;
+ int total_tests = max_line * (num_insts-1);
fp << "<th>" << (double) total_dead / (double) total_tests << " ";
fp << "<th>" << (double) total_neg / (double) total_tests << " ";
fp << "<th>" << (double) total_neut / (double) total_tests << " ";
More information about the Avida-cvs
mailing list