[Avida-SVN] r3544 - in branches/parasites/source: drivers main
zaman at myxo.css.msu.edu
zaman at myxo.css.msu.edu
Mon Nov 30 12:12:37 PST 2009
Author: zaman
Date: 2009-11-30 15:12:37 -0500 (Mon, 30 Nov 2009)
New Revision: 3544
Modified:
branches/parasites/source/drivers/cDefaultRunDriver.cc
branches/parasites/source/main/cOrganism.cc
branches/parasites/source/main/cPopulation.cc
Log:
fixed neighborhood bug in non-mass action setup
Modified: branches/parasites/source/drivers/cDefaultRunDriver.cc
===================================================================
--- branches/parasites/source/drivers/cDefaultRunDriver.cc 2009-11-30 18:10:27 UTC (rev 3543)
+++ branches/parasites/source/drivers/cDefaultRunDriver.cc 2009-11-30 20:12:37 UTC (rev 3544)
@@ -136,7 +136,7 @@
// << "Spec: " << setw(6) << setprecision(4) << stats.GetAveSpeculative() << " "
// << "SWst: " << setw(6) << setprecision(4) << (((double)stats.GetSpeculativeWaste() / (double)UD_size) * 100.0) << "%"
<< "Thrd: " << setw(6) << stats.GetNumThreads() << " "
- << "Para: " << stats.GetNumParasites();
+ << "Para: " << stats.GetNumParasites() << " GenEntr: " << stats.GetEntropy() << " ";
if (m_world->GetPopulation().GetNumDemes() > 1) cout << "Demes: " << setw(4) << stats.GetNumOccupiedDemes() << " ";
cout << endl;
}
Modified: branches/parasites/source/main/cOrganism.cc
===================================================================
--- branches/parasites/source/main/cOrganism.cc 2009-11-30 18:10:27 UTC (rev 3543)
+++ branches/parasites/source/main/cOrganism.cc 2009-11-30 20:12:37 UTC (rev 3544)
@@ -413,6 +413,9 @@
bool task_completed = m_phenotype.TestOutput(ctx, taskctx, globalAndDeme_resource_count,
m_phenotype.GetCurRBinsAvail(), globalAndDeme_res_change,
insts_triggered);
+
+ if(task_completed)
+ cout << "task done" << endl;
// Handle merit increases that take the organism above it's current population merit
if (m_world->GetConfig().MERIT_INC_APPLY_IMMEDIATE.Get()) {
Modified: branches/parasites/source/main/cPopulation.cc
===================================================================
--- branches/parasites/source/main/cPopulation.cc 2009-11-30 18:10:27 UTC (rev 3543)
+++ branches/parasites/source/main/cPopulation.cc 2009-11-30 20:12:37 UTC (rev 3544)
@@ -535,17 +535,18 @@
assert(parent_id >= 0 && parent_id < cell_array.GetSize());
cPopulationCell& parent_cell = cell_array[ parent_id ];
- int num_potential_hosts = 0;
+ cOrganism* target_organism = NULL;
if (m_world->GetConfig().BIRTH_METHOD.Get() == POSITION_OFFSPRING_FULL_SOUP_RANDOM)
{
- num_potential_hosts = cell_array.GetSize();
+ target_organism = GetCell(m_world->GetRandom().GetUInt(cell_array.GetSize())).GetOrganism();
}
else
- int num_potential_hosts = parent.GetNeighborhoodSize();
-
- cOrganism* target_organism = GetCell(m_world->GetRandom().GetUInt(num_potential_hosts)).GetOrganism();
-
+ {
+ target_organism =
+ parent_cell.ConnectionList().GetPos(m_world->GetRandom().GetUInt(parent.GetNeighborhoodSize()))->GetOrganism();
+ }
+
if (target_organism == NULL) return false;
cHardwareBase& child_cpu = target_organism->GetHardware();
@@ -630,7 +631,7 @@
if (target_organism->InjectHost(label, injected_code)) {
cInjectGenotype* child_genotype = parent_genotype;
- // If the parent genotype is not correct for the child, adjust it.
+ // If the parent genotype is not correct for the child, adjust it.
if (parent_genotype == NULL || parent_genotype->GetGenome() != injected_code) {
child_genotype = m_world->GetClassificationManager().GetInjectGenotype(injected_code, parent_genotype);
}
More information about the Avida-cvs
mailing list