[Avida-SVN] r1399 - branches/dkdev/source/main
dknoester at myxo.css.msu.edu
dknoester at myxo.css.msu.edu
Tue Mar 13 09:56:54 PDT 2007
Author: dknoester
Date: 2007-03-13 12:56:54 -0400 (Tue, 13 Mar 2007)
New Revision: 1399
Modified:
branches/dkdev/source/main/cPopulation.cc
Log:
Fixed mutations of germline -- no longer using cTestCPU, which does not allow mutations anyway.
Modified: branches/dkdev/source/main/cPopulation.cc
===================================================================
--- branches/dkdev/source/main/cPopulation.cc 2007-03-13 00:18:51 UTC (rev 1398)
+++ branches/dkdev/source/main/cPopulation.cc 2007-03-13 16:56:54 UTC (rev 1399)
@@ -38,7 +38,6 @@
#include "cTaskEntry.h"
#include "cWorld.h"
#include "cTopology.h"
-#include "cCPUTestInfo.h"
#include <fstream>
#include <vector>
@@ -858,17 +857,20 @@
cGermline& source_germline = source_deme.GetGermline();
cGenome& source_germ = source_germline.GetLatest();
- // Run the germ in the test cpu; if it doesn't reproduce, we're done.
- cTestCPU test_cpu(m_world);
- cAvidaContext test_context(m_world->GetRandom());
- cCPUTestInfo test_info;
- test_cpu.TestGenome(test_context, test_info, source_germ);
- if(!test_info.IsViable()) continue;
-
- // Ok, we have a new germ. Add it to the source deme's germline,
- // replace the target deme's germline, and inject clones into the
- // source and target.
- const cGenome& next_germ = test_cpu.GetOffspringGenome();
+ // Now create the next germ by manually mutating the source.
+ // @refactor (strategy pattern)
+ cGenome next_germ(source_germ);
+ cMutationRates mutator; mutator.Setup(m_world);
+ if(mutator.GetCopyMutProb() > 0) {
+ const cInstSet& instset = m_world->GetHardwareManager().GetInstSet();
+ cAvidaContext ctx(m_world->GetRandom());
+ for(int i=0; i<next_germ.GetSize(); ++i) {
+ if(mutator.TestCopyMut(ctx)) {
+ next_germ[i] = instset.GetRandomInst(ctx);
+ }
+ }
+ }
+
source_germline.Add(next_germ);
target_deme.ReplaceGermline(source_germline);
More information about the Avida-cvs
mailing list