[Avida-SVN] r1332 - in trunk: source/analyze source/utils/task_events support/config
covertar at myxo.css.msu.edu
covertar at myxo.css.msu.edu
Mon Feb 19 09:32:11 PST 2007
Author: covertar
Date: 2007-02-19 12:32:11 -0500 (Mon, 19 Feb 2007)
New Revision: 1332
Modified:
trunk/source/analyze/cAnalyze.cc
trunk/source/utils/task_events/Makefile
trunk/support/config/analyze.cfg
Log:
Corrections to analyze epistatsis
Modified: trunk/source/analyze/cAnalyze.cc
===================================================================
--- trunk/source/analyze/cAnalyze.cc 2007-02-18 17:14:21 UTC (rev 1331)
+++ trunk/source/analyze/cAnalyze.cc 2007-02-19 17:32:11 UTC (rev 1332)
@@ -6569,94 +6569,122 @@
double base_fitness = genotype->GetFitness();
cGenome mod_genome(base_genome);
- // Mutation rates
- const double mut_elitist = (1-mut_rate)*(1-mut_rate);
- const double mut_single_in = (mut_rate - mut_rate*mut_rate);
+ // Mutation rates
+ const double mut_elitist = (1-mut_rate)*(1-mut_rate);
+ const double mut_single_in = (mut_rate - mut_rate*mut_rate);
const double mut_double_in = (mut_rate * mut_rate);
// Loop through all the lines of code, testing all mutations...
tArray< tArray<double> > test_fitness(num_insts);
tArray< tArray<double> > prob(num_insts);
- for (int x = 0; x < max_line; x++){
- if (x == 0){
- test_fitness[x].Resize(num_insts);
- prob[x].Resize(num_insts);
- }
- for (int y = x+1; y < max_line; y++) {
+ for(int i = 0; i < num_insts; i++){
+ test_fitness[i].Resize(num_insts, 0.0);
+ prob[i].Resize(num_insts, 0.0);
+ }
+
+ for (int x = 0; x < max_line; x++){
+ // if (x == 0){
+ // test_fitness[x].Resize(num_insts, 0.0);
+ // prob[x].Resize(num_insts, 0.0);
+ // }
+
+ for (int y = x+1; y < max_line; y++) {
int cur_inst_X = base_genome[x].GetOp();
- int cur_inst_Y = base_genome[y].GetOp();
+ int cur_inst_Y = base_genome[y].GetOp();
// Column 1 & 2 ... the original instructions in the genome.
fp << cur_inst_X << " " << cur_inst_Y << " ";
// Test fitness of each mutant.
for (int mod_A = 0; mod_A < num_insts; mod_A++) {
- for (int mod_B = 0; mod_B < num_insts; mod_B++){
+ for (int mod_B = 0; mod_B < num_insts; mod_B++){
mod_genome[x].SetOp(mod_A);
- mod_genome[y].SetOp(mod_B);
+ mod_genome[y].SetOp(mod_B);
+ // cerr << "Size: " << test_fitness[mod_A].GetSize() << endl;
+ // cerr << "[" << mod_A << ", " << mod_B << "]: " << test_fitness[mod_A][mod_B] << endl;
cAnalyzeGenotype test_genotype(m_world, mod_genome, inst_set);
test_genotype.Recalculate(m_ctx, testcpu);
test_fitness[mod_A][mod_B] = test_genotype.GetFitness();
- }
- }
+ //cerr << test_fitness[mod_A][mod_B] << endl;
+ }
+ }
+ //cin.ignore();
- // Adjust fitness, normalizing & removing beneficials
- double cur_inst_fitness = test_fitness[x][y];
- for (int mod_A = 0; mod_A < num_insts; mod_A++) {
- for (int mod_B = 0; mod_B < num_insts; mod_B++){
+ // Adjust fitness, normalizing & removing beneficials
+ cerr << cur_inst_X << " " << cur_inst_Y << endl;
+ double cur_inst_fitness = test_fitness[cur_inst_X][cur_inst_Y];
+ cerr << cur_inst_fitness << endl; cin.ignore();
+ for (int mod_A = 0; mod_A < num_insts; mod_A++) {
+ for (int mod_B = 0; mod_B < num_insts; mod_B++){
if (test_fitness[mod_A][mod_B] > cur_inst_fitness)
test_fitness[mod_A][mod_B] = cur_inst_fitness;
test_fitness[mod_A][mod_B] = test_fitness[mod_A][mod_B] / cur_inst_fitness;
- }
- }
+ }
+ }
- // Calculate probabilities at mut-sel balance
- double w_bar = 1;
+ // Calculate probabilities at mut-sel balance
+ double w_bar = 1;
+ int count = 0;
+ while(1) {
+ double sum = 0.0;
+ //Collect our Pa & Pb data before we modify it
+ double Pa = 0.0;
+ double Pb = 0.0;
+
+ //for (int j = 0; j < num_insts; j++){
+ // for (int k = 0; k < num_insts; k++){
+ // Pb += prob[j][k] * test_fitness[j][k];
+ // Pa += prob[k][j] * test_fitness[k][j];
+ // }
+ //}
+
+ for (int k = 0; k < num_insts; k++){
+ Pa += prob[cur_inst_X][k] * test_fitness[cur_inst_X][k];
+ Pb += prob[cur_inst_Y][k] * test_fitness[cur_inst_Y][k];
+ }
- while(1) {
- double sum = 0.0;
- double Pa = 0.0;
- double Pb = 0.0;
+ for (int mod_A = 0; mod_A < num_insts; mod_A++) {
+ for (int mod_B = 0; mod_B < num_insts; mod_B++){
+
+ prob[mod_A][mod_B] = ( (prob[mod_A][mod_B] * test_fitness[mod_A][mod_B] * mut_elitist)
+ + Pa * mut_single_in / num_insts + Pb * mut_single_in / num_insts ) / w_bar
+ + mut_double_in / (num_insts*num_insts);
+ sum = sum + prob[mod_A][mod_B];
+ //cerr << Pab << endl;
+
+ }
+ }
+ if ((sum-1.0)*(sum-1.0) <= 0.0001)
+ break;
+ else
+ w_bar = w_bar - 0.000001;
+
+ if(count % 10000 == 0){
+ cerr << "Pa: " << Pa << "Pb: " << Pb << "Pab: " << sum << endl;
+ cerr << "iteration: " << count << " w_bar: " << w_bar << " ssquared error: " << (sum-1.0)*(sum-1.0) << endl;
+ //cin.ignore();
+ }
- //Collect our Pa & Pb data before we modify it
- for (int j = 0; j < num_insts; j++){
- for (int k = 0; k < num_insts; k++){
- Pa += prob[k][j] * test_fitness[k][j];
- Pb += prob[j][k] * test_fitness[j][k];
- }
- }
+ count++;
+ }
+ cerr << "iteration: " << count << " w_bar: " << w_bar << endl;
+ cin.ignore();
- for (int mod_A = 0; mod_A < num_insts; mod_A++) {
- for (int mod_B = 0; mod_B < num_insts; mod_B++){
-
- double Pab = ( (prob[mod_A][mod_B] * test_fitness[mod_A][mod_B] * mut_elitist)
- + Pa * mut_single_in / num_insts + Pb * mut_single_in / num_insts ) / w_bar
- + mut_double_in / (num_insts*num_insts);
- sum = sum + Pab;
- }
- }
- if ((sum-1.0)*(sum-1.0) <= 0.0001)
- break;
- else
- w_bar = w_bar - 0.000001;
+ // Write probability
+ for (int mod_A = 0; mod_A < num_insts; mod_A++) {
+ for (int mod_B = 0; mod_B < num_insts; mod_B++){
+ fp << prob[mod_A][mod_B] << " ";
+ }
+ }
+
+ mod_genome[x].SetOp(cur_inst_X);
+ mod_genome[y].SetOp(cur_inst_Y);
}
-
-
- // Write probability
- for (int mod_A = 0; mod_A < num_insts; mod_A++) {
- for (int mod_B = 0; mod_B < num_insts; mod_B++){
- fp << prob[mod_A][mod_B] << " ";
- }
- }
-
- mod_genome[x].SetOp(cur_inst_X);
- mod_genome[y].SetOp(cur_inst_Y);
- }
- }
+ }
m_world->GetDataFileManager().Remove(filename);
lineage_fp << endl;
Modified: trunk/source/utils/task_events/Makefile
===================================================================
--- trunk/source/utils/task_events/Makefile 2007-02-18 17:14:21 UTC (rev 1331)
+++ trunk/source/utils/task_events/Makefile 2007-02-19 17:32:11 UTC (rev 1332)
@@ -20,10 +20,10 @@
CMAKE_EDIT_COMMAND = /usr/local/bin/ccmake
# The top-level source directory on which CMake was run.
-CMAKE_SOURCE_DIR = /home/covertar/source/development_72806/development
+CMAKE_SOURCE_DIR = /home/covertar/source/trunk_2012007
# The top-level build directory on which CMake was run.
-CMAKE_BINARY_DIR = /home/covertar/source/development_72806/development
+CMAKE_BINARY_DIR = /home/covertar/source/trunk_2012007
# Default target executed when no arguments are given to make.
default_target: all
@@ -31,7 +31,7 @@
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
- cd /home/covertar/source/development_72806/development/source/utils/task_events && /usr/local/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
+ cd /home/covertar/source/trunk_2012007/source/utils/task_events && /usr/local/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
@@ -39,35 +39,24 @@
# Special rule for the target install
install: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
- cd /home/covertar/source/development_72806/development/source/utils/task_events && /usr/local/bin/cmake -P cmake_install.cmake
+ cd /home/covertar/source/trunk_2012007/source/utils/task_events && /usr/local/bin/cmake -P cmake_install.cmake
# Special rule for the target install
install/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
- cd /home/covertar/source/development_72806/development/source/utils/task_events && /usr/local/bin/cmake -P cmake_install.cmake
+ cd /home/covertar/source/trunk_2012007/source/utils/task_events && /usr/local/bin/cmake -P cmake_install.cmake
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
- cd /home/covertar/source/development_72806/development/source/utils/task_events && /usr/local/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
+ cd /home/covertar/source/trunk_2012007/source/utils/task_events && /usr/local/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
-# Special rule for the target test
-test:
- @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running tests..."
- cd /home/covertar/source/development_72806/development/source/utils/task_events && /usr/local/bin/ctest --force-new-ctest-process
-
-# Special rule for the target test
-test/fast: test
-
#=============================================================================
# Special targets provided by cmake.
-# Produce verbose output by default.
-VERBOSE = 1
-
# Suppress display of executed commands.
$(VERBOSE).SILENT:
@@ -78,24 +67,24 @@
# The main all target
all: cmake_check_build_system
- cd /home/covertar/source/development_72806/development && $(CMAKE_COMMAND) -E cmake_progress_start /home/covertar/source/development_72806/development/CMakeFiles $(CMAKE_ALL_PROGRESS)
- cd /home/covertar/source/development_72806/development && $(MAKE) -f CMakeFiles/Makefile2 source/utils/task_events/all
- $(CMAKE_COMMAND) -E cmake_progress_start /home/covertar/source/development_72806/development/CMakeFiles 0
+ cd /home/covertar/source/trunk_2012007 && $(CMAKE_COMMAND) -E cmake_progress_start /home/covertar/source/trunk_2012007/CMakeFiles $(CMAKE_ALL_PROGRESS)
+ cd /home/covertar/source/trunk_2012007 && $(MAKE) -f CMakeFiles/Makefile2 source/utils/task_events/all
+ $(CMAKE_COMMAND) -E cmake_progress_start /home/covertar/source/trunk_2012007/CMakeFiles 0
# The main clean target
clean:
- cd /home/covertar/source/development_72806/development && $(MAKE) -f CMakeFiles/Makefile2 source/utils/task_events/clean
+ cd /home/covertar/source/trunk_2012007 && $(MAKE) -f CMakeFiles/Makefile2 source/utils/task_events/clean
# The main clean target
clean/fast: clean
# Prepare targets for installation.
preinstall: all
- cd /home/covertar/source/development_72806/development && $(MAKE) -f CMakeFiles/Makefile2 source/utils/task_events/preinstall
+ cd /home/covertar/source/trunk_2012007 && $(MAKE) -f CMakeFiles/Makefile2 source/utils/task_events/preinstall
# Prepare targets for installation.
preinstall/fast:
- cd /home/covertar/source/development_72806/development && $(MAKE) -f CMakeFiles/Makefile2 source/utils/task_events/preinstall
+ cd /home/covertar/source/trunk_2012007 && $(MAKE) -f CMakeFiles/Makefile2 source/utils/task_events/preinstall
# clear depends
depend:
@@ -110,7 +99,6 @@
@echo "... edit_cache"
@echo "... install"
@echo "... rebuild_cache"
- @echo "... test"
@@ -121,5 +109,5 @@
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
- cd /home/covertar/source/development_72806/development && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
+ cd /home/covertar/source/trunk_2012007 && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
Modified: trunk/support/config/analyze.cfg
===================================================================
--- trunk/support/config/analyze.cfg 2007-02-18 17:14:21 UTC (rev 1331)
+++ trunk/support/config/analyze.cfg 2007-02-19 17:32:11 UTC (rev 1332)
@@ -8,3 +8,26 @@
#
#############################################################################
+SET c C_FI_250ku_basemut_org50_1dist_lc_largepop_fixlen
+SET d $cdumps/
+SET e 32205
+
+FORRANGE i $e00 $e00
+ DEBUG $c$i
+
+ LOAD_DETAIL_DUMP $ddetail-$i.pop
+ LOAD_DETAIL_DUMP $dhistoric-$i.pop
+
+ NAME_BATCH $c$i
+
+ FIND_LINEAGE num_cpus
+ RECALCULATE
+
+ #DETAIL lineage.$c$i.html id parent_id update_born update_dead num_cpus total_cpus fitness merit length copy_length exe_length gest_time efficiency parent_dist comp_merit_ratio efficiency_ratio fitness_ratio html.sequence task.0 task.1 task.2 task.3 task.4 task.5 task.6 task.7 task.8
+ #DETAIL lineage.$c$i.dat id parent_id update_born update_dead num_cpus total_cpus fitness merit length copy_length exe_length gest_time efficiency parent_dist comp_merit_ratio efficiency_ratio fitness_ratio html.sequence task.0 task.1 task.2 task.3 task.4 task.5 task.6 task.7 task.8
+
+ ANALYZE_EPISTASIS 0.25 $c$i
+
+ PURGE_BATCH
+END
+
More information about the Avida-cvs
mailing list