[Avida-cvs] [avida-svn] r930 - in development: documentation/notes source/actions source/main
brysonda at myxo.css.msu.edu
brysonda at myxo.css.msu.edu
Wed Sep 6 19:22:38 PDT 2006
Author: brysonda
Date: 2006-09-06 22:22:38 -0400 (Wed, 06 Sep 2006)
New Revision: 930
Modified:
development/documentation/notes/release-milestones.txt
development/source/actions/LandscapeActions.cc
development/source/main/cLandscape.cc
development/source/main/cLandscape.h
Log:
Transition cLandscape::PredictWLandscape to use cDataFile.
Fix PredictNuLandscape action to use the correct command.
Modified: development/documentation/notes/release-milestones.txt
===================================================================
--- development/documentation/notes/release-milestones.txt 2006-09-06 02:47:57 UTC (rev 929)
+++ development/documentation/notes/release-milestones.txt 2006-09-07 02:22:38 UTC (rev 930)
@@ -54,7 +54,7 @@
* Consistency test support
* Framework for unit testing
* Move UnitTest functions from classes to namespaces
-+ Update documentation
+* Update documentation
+ Code release cleanup
Modified: development/source/actions/LandscapeActions.cc
===================================================================
--- development/source/actions/LandscapeActions.cc 2006-09-06 02:47:57 UTC (rev 929)
+++ development/source/actions/LandscapeActions.cc 2006-09-07 02:22:38 UTC (rev 930)
@@ -417,7 +417,7 @@
void Process(cAvidaContext& ctx)
{
cInstSet& inst_set = m_world->GetHardwareManager().GetInstSet();
- std::ofstream& outfile = m_world->GetDataFileOFStream(m_filename);
+ cDataFile& df = m_world->GetDataFile(m_filename);
if (ctx.GetAnalyzeMode()) {
if (m_world->GetVerbosity() >= VERBOSE_ON) {
@@ -432,7 +432,7 @@
cAnalyzeGenotype* genotype = NULL;
while (genotype = batch_it.Next()) {
cLandscape land(m_world, genotype->GetGenome(), inst_set);
- land.PredictWProcess(ctx, outfile);
+ land.PredictWProcess(ctx, df);
}
} else {
if (m_world->GetVerbosity() >= VERBOSE_DETAILS)
@@ -440,7 +440,7 @@
const cGenome& best_genome = m_world->GetClassificationManager().GetBestGenotype()->GetGenome();
cLandscape land(m_world, best_genome, inst_set);
- land.PredictWProcess(ctx, outfile, m_world->GetStats().GetUpdate());
+ land.PredictWProcess(ctx, df, m_world->GetStats().GetUpdate());
}
}
};
@@ -482,7 +482,7 @@
cAnalyzeGenotype* genotype = NULL;
while (genotype = batch_it.Next()) {
cLandscape land(m_world, genotype->GetGenome(), inst_set);
- land.PredictWProcess(ctx, outfile);
+ land.PredictNuProcess(ctx, outfile);
}
} else {
if (m_world->GetVerbosity() >= VERBOSE_DETAILS)
@@ -490,7 +490,7 @@
const cGenome& best_genome = m_world->GetClassificationManager().GetBestGenotype()->GetGenome();
cLandscape land(m_world, best_genome, inst_set);
- land.PredictWProcess(ctx, outfile, m_world->GetStats().GetUpdate());
+ land.PredictNuProcess(ctx, outfile, m_world->GetStats().GetUpdate());
}
}
};
Modified: development/source/main/cLandscape.cc
===================================================================
--- development/source/main/cLandscape.cc 2006-09-06 02:47:57 UTC (rev 929)
+++ development/source/main/cLandscape.cc 2006-09-07 02:22:38 UTC (rev 930)
@@ -235,7 +235,7 @@
}
// Prediction for a landscape where n sites are _randomized_.
-void cLandscape::PredictWProcess(cAvidaContext& ctx, ostream& fp, int update)
+void cLandscape::PredictWProcess(cAvidaContext& ctx, cDataFile& df, int update)
{
cTestCPU* testcpu = m_world->GetHardwareManager().CreateTestCPU();
@@ -279,18 +279,17 @@
const int total_tests = genome_size * inst_size;
total_dead_found = total_tests - total_pos_found - total_neut_found - total_neg_found;
- fp << update << " "
- << "1 "
- << ((double) total_dead_found / (double) total_tests) << " "
- << ((double) total_neg_found / (double) total_tests) << " "
- << ((double) total_neut_found / (double) total_tests) << " "
- << ((double) total_pos_found / (double) total_tests) << " "
- << total_tests << " "
- << total_neut_found + total_pos_found << " "
- << total_fitness / (double) total_tests << " "
- << total_sqr_fitness / (double) total_tests << " "
- << endl;
- fp.flush();
+ df.Write(update, "Update");
+ df.Write(1, "Number of Mutations");
+ df.Write((static_cast<double>(total_dead_found) / static_cast<double>(total_tests)), "Probability Lethal");
+ df.Write((static_cast<double>(total_neg_found) / static_cast<double>(total_tests)), "Probability Deleterious");
+ df.Write((static_cast<double>(total_neut_found) / static_cast<double>(total_tests)), "Probability Neutral");
+ df.Write((static_cast<double>(total_pos_found) / static_cast<double>(total_tests)), "Probability Beneficial");
+ df.Write(total_tests, "Total Tests");
+ df.Write(total_neut_found + total_pos_found, "Total Neutral and Beneficial");
+ df.Write(total_fitness / static_cast<double>(total_tests), "Average Fitness");
+ df.Write(total_sqr_fitness / static_cast<double>(total_tests), "Average Square Fitness");
+ df.Endl();
// Sample the table out to 10 mutations
const int max_muts = 10;
@@ -326,18 +325,17 @@
}
total_dead_found = test_id - total_pos_found - total_neut_found - total_neg_found;
- fp << update << " " // 1
- << num_muts << " " // 2
- << ((double) total_dead_found / (double) test_id) << " " // 3
- << ((double) total_neg_found / (double) test_id) << " " // 4
- << ((double) total_neut_found / (double) test_id) << " " // 5
- << ((double) total_pos_found / (double) test_id) << " " // 6
- << test_id << " " // 7
- << total_neut_found + total_pos_found << " " // 8
- << total_fitness / (double) test_id << " " // 9
- << total_sqr_fitness / (double) test_id << " " // 10
- << endl;
- fp.flush();
+ df.Write(update, "Update");
+ df.Write(num_muts, "Number of Mutations");
+ df.Write((static_cast<double>(total_dead_found) / static_cast<double>(test_id)), "Probability Lethal");
+ df.Write((static_cast<double>(total_neg_found) / static_cast<double>(test_id)), "Probability Deleterious");
+ df.Write((static_cast<double>(total_neut_found) / static_cast<double>(test_id)), "Probability Neutral");
+ df.Write((static_cast<double>(total_pos_found) / static_cast<double>(test_id)), "Probability Beneficial");
+ df.Write(test_id, "Total Tests");
+ df.Write(total_neut_found + total_pos_found, "Total Neutral and Beneficial");
+ df.Write(total_fitness / static_cast<double>(test_id), "Average Fitness");
+ df.Write(total_sqr_fitness / static_cast<double>(test_id), "Average Square Fitness");
+ df.Endl();
if (total_pos_found + total_neut_found < min_found / 2) break;
}
Modified: development/source/main/cLandscape.h
===================================================================
--- development/source/main/cLandscape.h 2006-09-06 02:47:57 UTC (rev 929)
+++ development/source/main/cLandscape.h 2006-09-07 02:22:38 UTC (rev 930)
@@ -111,7 +111,7 @@
void Process(cAvidaContext& ctx);
void ProcessDelete(cAvidaContext& ctx);
void ProcessInsert(cAvidaContext& ctx);
- void PredictWProcess(cAvidaContext& ctx, std::ostream& fp, int update = -1);
+ void PredictWProcess(cAvidaContext& ctx, cDataFile& df, int update = -1);
void PredictNuProcess(cAvidaContext& ctx, std::ostream& fp, int update = -1);
inline void SetDistance(int in_distance) { distance = in_distance; }
More information about the Avida-cvs
mailing list