[Avida-SVN] r2955 - branches/movement/source/actions
grabow38 at myxo.css.msu.edu
grabow38 at myxo.css.msu.edu
Thu Nov 20 09:52:32 PST 2008
Author: grabow38
Date: 2008-11-20 12:52:32 -0500 (Thu, 20 Nov 2008)
New Revision: 2955
Modified:
branches/movement/source/actions/PopulationActions.cc
Log:
In cActionInjectDemes, added arguments to specify start and end demes for injection.
Modified: branches/movement/source/actions/PopulationActions.cc
===================================================================
--- branches/movement/source/actions/PopulationActions.cc 2008-11-20 14:29:57 UTC (rev 2954)
+++ branches/movement/source/actions/PopulationActions.cc 2008-11-20 17:52:32 UTC (rev 2955)
@@ -549,18 +549,21 @@
double m_merit;
int m_lineage_label;
double m_neutral_metric;
+ int start_deme, end_deme; // @ LMG to enable injecting into specified demes
public:
cActionInjectDemes(cWorld* world, const cString& args) : cAction(world, args), m_merit(-1), m_lineage_label(0), m_neutral_metric(0)
{
cString largs(args);
if (!largs.GetSize()) m_filename = "START_CREATURE"; else m_filename = largs.PopWord();
+ if (largs.GetSize()) start_deme = largs.PopWord().AsInt(); else start_deme = 0;
+ if (largs.GetSize()) end_deme = largs.PopWord().AsInt(); else end_deme = m_world->GetPopulation().GetNumDemes() - 1;
if (largs.GetSize()) m_merit = largs.PopWord().AsDouble();
if (largs.GetSize()) m_lineage_label = largs.PopWord().AsInt();
if (largs.GetSize()) m_neutral_metric = largs.PopWord().AsDouble();
if (m_filename == "START_CREATURE") m_filename = m_world->GetConfig().START_CREATURE.Get();
}
- static const cString GetDescription() { return "Arguments: [string fname=\"START_CREATURE\"] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]"; }
+ static const cString GetDescription() { return "Arguments: [string fname=\"START_CREATURE\"] [start_deme=0] [end_deme=num_demes] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]"; }
void Process(cAvidaContext& ctx)
{
@@ -573,7 +576,7 @@
m_world->GetPopulation().GetDeme(i).IncInjectedCount();
}
} else {
- for(int i=0; i<m_world->GetPopulation().GetNumDemes(); ++i) {
+ for(int i = start_deme; i <= end_deme; ++i) {
// WARNING: initial ancestor has already be injected into the population
// calling this will overwrite it.
// m_world->GetPopulation().Inject(genome,
@@ -584,17 +587,12 @@
m_world->GetPopulation().DemeSelectInjectionCell( m_world->GetPopulation().GetDeme(i), 0),
m_merit, m_lineage_label, m_neutral_metric);
- //CALL void cPopulation::DemePostInjection(cDeme& deme, cPopulationCell& cell)
cDeme& deme = m_world->GetPopulation().GetDeme(i);
cPopulationCell& cell = m_world->GetPopulation().GetCell( m_world->GetPopulation().DemeSelectInjectionCell( m_world->GetPopulation().GetDeme(i), 0));
m_world->GetPopulation().DemePostInjection(deme, cell);
m_world->GetPopulation().GetDeme(i).IncInjectedCount();
- // Debugging @ LMG
- /*cout << "Deme " << deme.GetID()
- << " I am facing " << m_world->GetPopulation().GetCell(cell.GetID()).GetCellFaced().GetID()
- << " // Called from end of InjectDemes " << endl;*/
}
}
}
More information about the Avida-cvs
mailing list