[Avida-SVN] r3375 - development/source/main
dk at myxo.css.msu.edu
dk at myxo.css.msu.edu
Sat Aug 22 08:50:04 PDT 2009
Author: dk
Date: 2009-08-22 11:50:04 -0400 (Sat, 22 Aug 2009)
New Revision: 3375
Modified:
development/source/main/cPopulation.cc
Log:
bugfix: forgot to update the scheduler after mixing the population.
Modified: development/source/main/cPopulation.cc
===================================================================
--- development/source/main/cPopulation.cc 2009-08-22 14:41:46 UTC (rev 3374)
+++ development/source/main/cPopulation.cc 2009-08-22 15:50:04 UTC (rev 3375)
@@ -5737,8 +5737,7 @@
key component of biologically-inspired approaches to group selection (ie, Wilson's
and Traulsen's models).
- \warning THIS METHOD CHANGES THE ORGANISM POINTERS OF CELLS. IT'S QUITE POSSIBLY
- DANGEROUS, ESPECIALLY IF STATEFUL.
+ \warning THIS METHOD CHANGES THE ORGANISM POINTERS OF CELLS.
*/
void cPopulation::MixPopulation() {
// Get the list of all organism pointers, including nulls:
@@ -5754,9 +5753,11 @@
// Reset the organism pointers of all cells:
for(int i=0; i<cell_array.GetSize(); ++i) {
cell_array[i].RemoveOrganism();
- // Can't insert null, 'cause InsertOrganism asserts.
- if(population[i] != 0) {
+ if(population[i] == 0) {
+ AdjustSchedule(cell_array[i], cMerit(0));
+ } else {
cell_array[i].InsertOrganism(population[i]);
+ AdjustSchedule(cell_array[i], cell_array[i].GetOrganism()->GetPhenotype().GetMerit());
}
}
}
More information about the Avida-cvs
mailing list