[Avida-cvs] [avida-svn] r855 - in development/source: actions event
brysonda@myxo.css.msu.edu
brysonda at myxo.css.msu.edu
Tue Jul 25 21:51:51 PDT 2006
Author: brysonda
Date: 2006-07-26 00:51:51 -0400 (Wed, 26 Jul 2006)
New Revision: 855
Modified:
development/source/actions/PopulationActions.cc
development/source/event/cEventManager.cc
Log:
Add an additional sanity check to SetMutProb (cap final ending value to Population size). Remove old set_*_prob events.
Modified: development/source/actions/PopulationActions.cc
===================================================================
--- development/source/actions/PopulationActions.cc 2006-07-26 04:43:36 UTC (rev 854)
+++ development/source/actions/PopulationActions.cc 2006-07-26 04:51:51 UTC (rev 855)
@@ -620,6 +620,7 @@
m_start = m_end;
m_end = temp;
}
+ if (m_end > m_world->GetPopulation().GetSize()) m_end = m_world->GetPopulation().GetSize();
}
const cString GetDescription() { return "SetMutProb [string mut_type='copy'] [double prob=0.0] [int start_cell=-1] [int end_cell=-1]"; }
Modified: development/source/event/cEventManager.cc
===================================================================
--- development/source/event/cEventManager.cc 2006-07-26 04:43:36 UTC (rev 854)
+++ development/source/event/cEventManager.cc 2006-07-26 04:51:51 UTC (rev 855)
@@ -140,48 +140,7 @@
}
};
-///// set_copy_mut /////
-/**
-**/
-
-
-class cEvent_set_copy_mut : public cEvent {
-private:
- double cmut;
- int start_cell;
- int end_cell;
-public:
- const cString GetName() const { return "set_copy_mut"; }
- const cString GetDescription() const { return "set_copy_mut <double cmut> [int start_cell=-1] [int end_cell=-1]"; }
-
- void Configure(cWorld* world, const cString& in_args)
- {
- m_world = world;
- m_args = in_args;
- cString args(in_args);
- cmut = args.PopWord().AsDouble();
- if (args == "") start_cell=-1; else start_cell=args.PopWord().AsInt();
- if (args == "") end_cell=-1; else end_cell=args.PopWord().AsInt();
- }
- ///// set_copy_mut /////
- void Process(){
- if (start_cell < 0) { // start_cell == -1 --> all
- m_world->GetConfig().COPY_MUT_PROB.Set(cmut);
- start_cell = 0;
- end_cell = m_world->GetPopulation().GetSize();
- }
- else if (end_cell < -1) { // end_cell == -1 --> Only one cell!
- end_cell = start_cell + 1;
- }
- assert(start_cell >= 0 && start_cell < m_world->GetPopulation().GetSize());
- assert(end_cell > 0 && end_cell <= m_world->GetPopulation().GetSize());
- for (int i = start_cell; i < end_cell; i++) {
- m_world->GetPopulation().GetCell(i).MutationRates().SetCopyMutProb(cmut);
- }
- }
-};
-
///// mod_point_mut /////
/**
@@ -218,41 +177,6 @@
}
};
-///// set_point_mut /////
-
-/**
-**/
-
-
-class cEvent_set_point_mut : public cEvent {
-private:
- double pmut;
- int cell;
-public:
- const cString GetName() const { return "set_point_mut"; }
- const cString GetDescription() const { return "set_point_mut <double pmut> [int cell=-1]"; }
-
- void Configure(cWorld* world, const cString& in_args)
- {
- m_world = world;
- m_args = in_args;
- cString args(in_args);
- pmut = args.PopWord().AsDouble();
- if (args == "") cell=-1; else cell=args.PopWord().AsInt();
- }
- ///// set_point_mut /////
- void Process(){
- if (cell < 0) { // cell == -1 --> all
- for (int i = 0; i < m_world->GetPopulation().GetSize(); i++) {
- m_world->GetPopulation().GetCell(i).MutationRates().SetPointMutProb(pmut);
- }
- m_world->GetConfig().POINT_MUT_PROB.Set(pmut);
- } else {
- m_world->GetPopulation().GetCell(cell).MutationRates().SetPointMutProb(pmut);
- }
- }
-};
-
///// test_dom /////
/**
@@ -1406,9 +1330,7 @@
REGISTER(zero_muts);
REGISTER(mod_copy_mut);
REGISTER(mod_div_mut);
- REGISTER(set_copy_mut);
REGISTER(mod_point_mut);
- REGISTER(set_point_mut);
REGISTER(test_dom);
REGISTER(task_snapshot);
More information about the Avida-cvs
mailing list