[avida-cvs] avida CVS commits: /current/source/main analyze.cc inst_set.cc
huangw10
avida-cvs at alife.org
Tue Oct 14 18:49:24 PDT 2003
huangw10 Tue Oct 14 10:49:24 2003 EDT
Modified files:
/avida/current/source/main analyze.cc inst_set.cc
Log:
Fix the problem with analyze.cc. Add in new function "AnalyzeComplexity" and "AnalyzePopComplexity".
Index: avida/current/source/main/analyze.cc
diff -u avida/current/source/main/analyze.cc:1.77 avida/current/source/main/analyze.cc:1.78
--- avida/current/source/main/analyze.cc:1.77 Mon Oct 13 10:34:25 2003
+++ avida/current/source/main/analyze.cc Tue Oct 14 10:49:23 2003
@@ -3353,7 +3353,7 @@
// Calculate complexity
double entropy = 0;
for (int i = 0; i < num_insts; i ++) {
- entropy += prob[i] * log(1/prob[i]) / log (num_insts);
+ entropy += prob[i] * log((double) 1.0/prob[i]) / log ((double) num_insts);
}
double complexity = 1 - entropy;
fp << complexity << endl;
@@ -3425,7 +3425,7 @@
for (int inst_num = 0; inst_num < num_insts; inst_num ++) {
if (inst_stat[line_num][inst_num] == 0) continue;
float prob = (float) (inst_stat[line_num][inst_num]) / (float) (pop_size);
- entropy += prob * log(1/prob) / log(num_insts);
+ entropy += prob * log((double) 1.0/prob) / log((double) num_insts);
}
double complexity = 1 - entropy;
fp << complexity << " ";
@@ -4441,41 +4441,3 @@
return lib_it.Get();
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: avida/current/source/main/inst_set.cc
diff -u avida/current/source/main/inst_set.cc:1.4 avida/current/source/main/inst_set.cc:1.5
--- avida/current/source/main/inst_set.cc:1.4 Fri Jun 13 14:49:59 2003
+++ avida/current/source/main/inst_set.cc Tue Oct 14 10:49:23 2003
@@ -18,6 +18,7 @@
//////////////////////
// Initialize static variables
+const cInstruction cInstSet::inst_default( 0 );
cInstruction cInstSet::inst_default2( 0 );
cInstruction cInstSet::inst_error2 ( 255 );
More information about the Avida-cvs
mailing list