[Avida-SVN] r2200 - branches/dkdev/source/main
dknoester at myxo.css.msu.edu
dknoester at myxo.css.msu.edu
Tue Nov 13 15:12:43 PST 2007
Author: dknoester
Date: 2007-11-13 18:12:43 -0500 (Tue, 13 Nov 2007)
New Revision: 2200
Modified:
branches/dkdev/source/main/cAvidaConfig.h
branches/dkdev/source/main/cDeme.cc
branches/dkdev/source/main/cDeme.h
Log:
Added option for testing in all deme environments.
Modified: branches/dkdev/source/main/cAvidaConfig.h
===================================================================
--- branches/dkdev/source/main/cAvidaConfig.h 2007-11-13 17:17:34 UTC (rev 2199)
+++ branches/dkdev/source/main/cAvidaConfig.h 2007-11-13 23:12:43 UTC (rev 2200)
@@ -172,7 +172,7 @@
CONFIG_ADD_VAR(MAX_DEME_AGE, int, 500, "The maximum age of a deme (in updates) to be used for age-based replication (default=500).");
CONFIG_ADD_VAR(TRACK_GENOTYPES, int, 0, "Whether genotypes are tracked graphically.");
CONFIG_ADD_VAR(TWOCELLS_MIN_REGION_RATIO, double, 0.2, "Ratio of size of two-cells region to environment size.");
-
+ CONFIG_ADD_VAR(TWOCELLS_SEQUENTIAL_REGION, int, 0, "Whether the region is sequential or random; 1=sequential.");
CONFIG_ADD_VAR(RANDOM_SEED, int, 0, "Random number seed (0 for based on time)");
CONFIG_ADD_VAR(HARDWARE_TYPE, int, 0, "0 = Original CPUs\n1 = New SMT CPUs\n2 = Transitional SMT");
Modified: branches/dkdev/source/main/cDeme.cc
===================================================================
--- branches/dkdev/source/main/cDeme.cc 2007-11-13 17:17:34 UTC (rev 2199)
+++ branches/dkdev/source/main/cDeme.cc 2007-11-13 23:12:43 UTC (rev 2200)
@@ -20,6 +20,7 @@
, birth_count(0)
, org_count(0)
, _age(0)
+, _region_position(1)
{
}
@@ -75,6 +76,7 @@
m_cvMap = CellVertexMap();
_trial_merits.clear();
_age = 0;
+ _region_position = 1;
_links = 20; // Start with extra.
_collect_count = 0;
for(CellCountMap::iterator i=_cellsToMsgCount.begin(); i!=_cellsToMsgCount.end(); ++i) {
@@ -119,8 +121,15 @@
void cDeme::NewTrial() {
// (0-6, (0-5)+1
- _cellsToLink = std::make_pair(GetCellID(_world->GetRandom().GetInt(GetWidth()), _world->GetRandom().GetInt(GetHeight()-1)+1),
- cell_ids[_world->GetRandom().GetInt(cell_ids.GetSize())]);
+ if(_world->GetConfig().TWOCELLS_SEQUENTIAL_REGION.Get()) {
+ assert(_region_position > 0 && _region_position < GetHeight());
+ _cellsToLink = std::make_pair(GetCellID(0, _region_position),
+ cell_ids[_world->GetRandom().GetInt(cell_ids.GetSize())]);
+ ++_region_position;
+ } else {
+ _cellsToLink = std::make_pair(GetCellID(_world->GetRandom().GetInt(GetWidth()), _world->GetRandom().GetInt(GetHeight()-1)+1),
+ cell_ids[_world->GetRandom().GetInt(cell_ids.GetSize())]);
+ }
while((_cellsToLink.second == _cellsToLink.first)
|| (((double)region_size(GetCellPosition(_cellsToLink.first), GetCellPosition(_cellsToLink.second))
Modified: branches/dkdev/source/main/cDeme.h
===================================================================
--- branches/dkdev/source/main/cDeme.h 2007-11-13 17:17:34 UTC (rev 2199)
+++ branches/dkdev/source/main/cDeme.h 2007-11-13 23:12:43 UTC (rev 2200)
@@ -126,6 +126,7 @@
cGermline _germline; //!< The germline for this deme, if used.
int _age; //!< How old this deme is, in updates.
+ int _region_position; //!< Hack - where the region is right now.
cWorld* _world; //!< Pointer to the world.
cPopulation* _pop; //!< Pointer to the population, because the world isn't initialized early enough.
int _links; //!< The number of links currently available to members of this deme.
More information about the Avida-cvs
mailing list