[Avida-SVN] r2772 - in branches/movement: documentation/notes source/actions source/cpu source/main
grabow38 at myxo.css.msu.edu
grabow38 at myxo.css.msu.edu
Tue Sep 9 06:53:58 PDT 2008
Author: grabow38
Date: 2008-09-09 09:53:57 -0400 (Tue, 09 Sep 2008)
New Revision: 2772
Modified:
branches/movement/documentation/notes/release-milestones.txt
branches/movement/source/actions/EnvironmentActions.cc
branches/movement/source/cpu/cHardwareCPU.cc
branches/movement/source/main/cEventList.cc
branches/movement/source/main/cEventList.h
branches/movement/source/main/cStats.cc
branches/movement/source/main/cTaskLib.cc
Log:
Merged development changes r2761:2771 into branches/movement.
Modified: branches/movement/documentation/notes/release-milestones.txt
===================================================================
--- branches/movement/documentation/notes/release-milestones.txt 2008-09-09 12:33:36 UTC (rev 2771)
+++ branches/movement/documentation/notes/release-milestones.txt 2008-09-09 13:53:57 UTC (rev 2772)
@@ -1,67 +1,3 @@
Avida Release Milestones
-Feature Key:
-- Planned feature, to be implemented
-+ Feature currently in development
-* Feature completed, ready for release
-? Planned feature, but possibly delayed to next milestone
-
-
-Visualized development/support timeline (* current):
---2.6----
- --2.7--
- *-2.8----
- --2.9--
- --3.0----
- --3.1--
- --3.2----
- --3.3--
- --3.4----
- --3.5--
- --3.6----
- --3.7--
- --3.8----
- --3.9--
- --4.0----
-
-
-Version 2.6 - stable - Status: End of Life
-Version 2.7 - development - Status: Wrapping Up
-Version 2.8 - stable - Status: Pre-release preparation
-
-Version 2.9 - development - Target: August 2008 - Status: Soon
-
-David:
-- Completed AvidaScript
- - Merged 'avida' and 'avida-s' functionality
-- Cleanup Landscaping tools
-+ Error reporting, input validation
-
-Dave K:
-- Topology manager
- + environment named regions
-
-Charles:
-- Completed Viewers based on Core Viewer/GUI frameworks
-
-Bess:
-+ Consistency test coverage
-
-Unassigned:
-- New Mutation framework
-- Schedulable object framework (organism threads scheduled rather than organisms, events, etc.)
-- Serialization
-
-All:
-- Update documentation
-- Code release cleanup
-
-
-**** NOTE: Backwards compatibility breaks at this point ****
-
-
-Version 3.0 - stable - Target: Ongoing - Status: Planned, pending version 2.9 completion
-
-Version 3.1 - development - Target: tbd - Status: feature set tdb
-
-- Basic OS X native GUI
+See http://avida.devosoft.org/trac/roadmap
Modified: branches/movement/source/actions/EnvironmentActions.cc
===================================================================
--- branches/movement/source/actions/EnvironmentActions.cc 2008-09-09 12:33:36 UTC (rev 2771)
+++ branches/movement/source/actions/EnvironmentActions.cc 2008-09-09 13:53:57 UTC (rev 2772)
@@ -538,31 +538,84 @@
/**
Sets resource availiblity to seasonal
*/
-class cActionSetSeasonalResource : public cAction
+class cActionSetSeasonalResource : public cAction {
+private:
+ cString m_res_name;
+
+public:
+ cActionSetSeasonalResource(cWorld* world, const cString& args): cAction(world, args), m_res_name("")
{
- private:
- cString m_res_name;
+ cString largs(args);
+ if (largs.GetSize()) m_res_name = largs.PopWord();
+ }
- public:
- cActionSetSeasonalResource(cWorld* world, const cString& args): cAction(world, args), m_res_name("")
- {
- cString largs(args);
- if (largs.GetSize()) m_res_name = largs.PopWord();
- }
+ static const cString GetDescription() { return "Arguments: <string reaction_name>"; }
- static const cString GetDescription() { return "Arguments: <string reaction_name>"; }
+ void Process(cAvidaContext& ctx)
+ {
+ int time = m_world->GetStats().GetUpdate();
+ double m_res_count = -1*(0.4*tanh((time-182500)/50000)+0.5)*(0.5*sin(time/58.091)+0.5)+1;
+ cResource* res = m_world->GetEnvironment().GetResourceLib().GetResource(m_res_name);
+ if (res != NULL)
+ m_world->GetPopulation().SetResource(res->GetID(), m_res_count);
+ }
+};
+
+/**
+ Sets resource availiblity to seasonal 1 to -1 for 1K years of 365 updates
+ */
+class cActionSetSeasonalResource1Kyears_1To_1 : public cAction {
+private:
+ cString m_res_name;
- void Process(cAvidaContext& ctx)
- {
- int time = m_world->GetStats().GetUpdate();
- double m_res_count = -1*(0.4*tanh((time-182500)/50000)+0.5)*(0.5*sin(time/58.091)+0.5)+1;
- cResource* res = m_world->GetEnvironment().GetResourceLib().GetResource(m_res_name);
- if (res != NULL) m_world->GetPopulation().SetResource(res->GetID(), m_res_count);
-
- }
- };
+public:
+ cActionSetSeasonalResource1Kyears_1To_1(cWorld* world, const cString& args): cAction(world, args), m_res_name("")
+ {
+ cString largs(args);
+ if (largs.GetSize()) m_res_name = largs.PopWord();
+ }
+
+ static const cString GetDescription() { return "Arguments: <string reaction_name>"; }
+
+ void Process(cAvidaContext& ctx)
+ {
+ int time = m_world->GetStats().GetUpdate();
+ double m_res_count = -1*(tanh((time-182500)/50000)+1)*(0.5*sin(time/58.091)+0.5)+1;
+ cResource* res = m_world->GetEnvironment().GetResourceLib().GetResource(m_res_name);
+ if (res != NULL)
+ m_world->GetPopulation().SetResource(res->GetID(), m_res_count);
+ }
+};
+
/**
+ Sets resource availiblity to seasonal 1 to -1 for 10K years of 365 updates
+ */
+class cActionSetSeasonalResource10Kyears_1To_1 : public cAction {
+private:
+ cString m_res_name;
+
+public:
+ cActionSetSeasonalResource10Kyears_1To_1(cWorld* world, const cString& args): cAction(world, args), m_res_name("")
+ {
+ cString largs(args);
+ if (largs.GetSize()) m_res_name = largs.PopWord();
+ }
+
+ static const cString GetDescription() { return "Arguments: <string reaction_name>"; }
+
+ void Process(cAvidaContext& ctx)
+ {
+ int time = m_world->GetStats().GetUpdate();
+ double m_res_count = -1*(tanh((time-1825000)/500000)+1)*(0.5*sin(time/58.091)+0.5)+1;
+ cResource* res = m_world->GetEnvironment().GetResourceLib().GetResource(m_res_name);
+ if (res != NULL)
+ m_world->GetPopulation().SetResource(res->GetID(), m_res_count);
+ }
+};
+
+
+/**
Sets resource availiblity to periodic
*/
class cActionSetPeriodicResource : public cAction
@@ -878,6 +931,8 @@
action_lib->Register<cActionSetEnvironmentRandomMask>("SetEnvironmentRandomMask");
action_lib->Register<cActionSetSeasonalResource>("SetSeasonalResource");
+ action_lib->Register<cActionSetSeasonalResource1Kyears_1To_1>("SetSeasonalResource1Kyears_1To_1");
+ action_lib->Register<cActionSetSeasonalResource10Kyears_1To_1>("SetSeasonalResource10Kyears_1To_1");
action_lib->Register<cActionSetPeriodicResource>("SetPeriodicResource");
action_lib->Register<cActionSetNumInstBefore0Energy>("SetNumInstBefore0Energy");
Modified: branches/movement/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/movement/source/cpu/cHardwareCPU.cc 2008-09-09 12:33:36 UTC (rev 2771)
+++ branches/movement/source/cpu/cHardwareCPU.cc 2008-09-09 13:53:57 UTC (rev 2772)
@@ -4719,6 +4719,12 @@
// Declarations
int fromcellID, destcellID; //, actualNeighborhoodSize, fromFacing, destFacing, currentFacing;
+ fromcellID = organism->GetCellID(); //absolute id of current cell
+
+ if(fromcellID == -1) {
+ return false;
+ }
+
// Get population
cPopulation& pop = m_world->GetPopulation();
cDeme &deme = pop.GetDeme(pop.GetCell(organism->GetCellID()).GetDemeID());
@@ -4734,7 +4740,7 @@
// Code
if (0 < stepsize) {
// Current cell
- fromcellID = organism->GetCellID();
+ //fromcellID = organism->GetCellID();
// With sanity check
if (-1 == fromcellID) return false;
// Destination cell
@@ -5975,9 +5981,15 @@
// Sense if the organism is on a target -- put 1 in reg is so, 0 otherwise
bool cHardwareCPU::Inst_SenseTarget(cAvidaContext& ctx) {
int reg_to_set = FindModifiedRegister(REG_CX);
- int cell_data = m_world->GetPopulation().GetCell(organism->GetCellID()).GetCellData();
+ int cellid = organism->GetCellID();
+
+ if(cellid == -1) {
+ return false;
+ }
+
+ int cell_data = m_world->GetPopulation().GetCell(cellid).GetCellData();
int val = 0;
-
+
if(cell_data > 0) {
val = 1;
}
@@ -5991,11 +6003,17 @@
int reg_to_set = FindModifiedRegister(REG_CX);
cPopulation& pop = m_world->GetPopulation();
- cPopulationCell& mycell = pop.GetCell(organism->GetCellID());
-
+ int cellid = organism->GetCellID();
+
+ if(cellid == -1) {
+ return true;
+ }
+
+ cPopulationCell& mycell = pop.GetCell(cellid);
+
int cell_data = mycell.GetCellFaced().GetCellData(); //absolute id of faced cell
int val = 0;
-
+
if(cell_data > 0) {
val = 1;
}
@@ -6010,6 +6028,10 @@
{
int reg_to_set = FindModifiedRegister(REG_BX);
+ if(cellid == -1) {
+ return false;
+ }
+
cPopulation& pop = m_world->GetPopulation();
cDeme &deme = pop.GetDeme(pop.GetCell(cellid).GetDemeID());
int relative_cell_id = deme.GetRelativeCellID(cellid);
@@ -7117,7 +7139,13 @@
bool cHardwareCPU::Inst_IfTarget(cAvidaContext& ctx)
{
- int cell_data = m_world->GetPopulation().GetCell(organism->GetCellID()).GetCellData();
+ int cellid = organism->GetCellID(); //absolute id of current cell
+
+ if(cellid == -1) {
+ return true;
+ }
+
+ int cell_data = m_world->GetPopulation().GetCell(cellid).GetCellData();
if(cell_data == -1) {
IP().Advance();
@@ -7129,7 +7157,13 @@
bool cHardwareCPU::Inst_IfNotTarget(cAvidaContext& ctx)
{
- int cell_data = m_world->GetPopulation().GetCell(organism->GetCellID()).GetCellData();
+ int cellid = organism->GetCellID(); //absolute id of current cell
+
+ if(cellid == -1) {
+ return true;
+ }
+
+ int cell_data = m_world->GetPopulation().GetCell(cellid).GetCellData();
if(cell_data > 0) {
IP().Advance();
Modified: branches/movement/source/main/cEventList.cc
===================================================================
--- branches/movement/source/main/cEventList.cc 2008-09-09 12:33:36 UTC (rev 2771)
+++ branches/movement/source/main/cEventList.cc 2008-09-09 13:53:57 UTC (rev 2772)
@@ -133,6 +133,9 @@
case GENERATION:
t_val = m_world->GetStats().SumGeneration().Average();
break;
+ case BIRTHS:
+ t_val = m_world->GetStats().GetTotCreatures();
+ break;
case UNDEFINED:
break;
}
@@ -251,6 +254,9 @@
case IMMEDIATE:
os << "immediate ";
break;
+ case BIRTHS:
+ os << "births ";
+ break;
default:
os << "undefined ";
}
@@ -306,6 +312,9 @@
} else if( cur_word == "g" || cur_word == "generation") {
trigger = GENERATION;
cur_word = cur_line.PopWord();
+ } else if (cur_word == "b" || cur_word == "births") {
+ trigger = BIRTHS;
+ cur_word = cur_line.PopWord();
} else {
// If Trigger is skipped so assume IMMEDIATE
trigger = IMMEDIATE;
Modified: branches/movement/source/main/cEventList.h
===================================================================
--- branches/movement/source/main/cEventList.h 2008-09-09 12:33:36 UTC (rev 2771)
+++ branches/movement/source/main/cEventList.h 2008-09-09 13:53:57 UTC (rev 2772)
@@ -52,7 +52,7 @@
tMemTrack<cEventList> mt;
#endif
public:
- enum eTriggerType { UPDATE, GENERATION, IMMEDIATE, UNDEFINED };
+ enum eTriggerType { UPDATE, GENERATION, IMMEDIATE, BIRTHS, UNDEFINED };
static const double TRIGGER_BEGIN;
static const double TRIGGER_END;
Modified: branches/movement/source/main/cStats.cc
===================================================================
--- branches/movement/source/main/cStats.cc 2008-09-09 12:33:36 UTC (rev 2771)
+++ branches/movement/source/main/cStats.cc 2008-09-09 13:53:57 UTC (rev 2772)
@@ -169,6 +169,9 @@
resource_count.Resize( m_world->GetNumResources() );
resource_count.SetAll(0);
+ resource_geometry.Resize( m_world->GetNumResources() );
+ resource_geometry.SetAll(nGeometry::GLOBAL);
+
task_names.Resize(num_tasks);
for (int i = 0; i < num_tasks; i++)
task_names[i] = env.GetTask(i).GetDesc();
Modified: branches/movement/source/main/cTaskLib.cc
===================================================================
--- branches/movement/source/main/cTaskLib.cc 2008-09-09 12:33:36 UTC (rev 2771)
+++ branches/movement/source/main/cTaskLib.cc 2008-09-09 13:53:57 UTC (rev 2772)
@@ -2898,7 +2898,7 @@
return 1.0;
}
-double cTaskLib::Task_MoveToRightSide(cTaskContext& ctx) const {
+double cTaskLib::Task_MoveToRightSide(cTaskContext& ctx) const {
cDeme& deme = m_world->GetPopulation().GetDeme(ctx.GetOrgInterface()->GetDemeID());
std::pair<int, int> location = deme.GetCellPosition(ctx.GetOrgInterface()->GetCellID());
@@ -2931,6 +2931,11 @@
//Note - a generic version of this is now at - Task_MoveToMovementEvent
{
cOrgInterface* iface = ctx.GetOrgInterface();
+
+ if(ctx.GetOrganism()->GetCellID() == -1) {
+ return 0.0;
+ }
+
cDeme& deme = m_world->GetPopulation().GetDeme(ctx.GetOrgInterface()->GetDemeID());
int celldata = m_world->GetPopulation().GetCell(iface->GetCellID()).GetCellData();
@@ -2958,6 +2963,11 @@
} //End cTaskLib::TaskMoveToTarget()
double cTaskLib::Task_MoveToMovementEvent(cTaskContext& ctx) const {
+
+ if(ctx.GetOrganism()->GetCellID() == -1) {
+ return 0.0;
+ }
+
cDeme& deme = m_world->GetPopulation().GetDeme(ctx.GetOrgInterface()->GetDemeID());
int cell_data = m_world->GetPopulation().GetCell(ctx.GetOrgInterface()->GetCellID()).GetCellData();
cOrgInterface* iface = ctx.GetOrgInterface();
@@ -2977,6 +2987,11 @@
double cTaskLib::Task_MoveBetweenMovementEvent(cTaskContext& ctx) const {
+
+ if(ctx.GetOrganism()->GetCellID() == -1) {
+ return 0.0;
+ }
+
cDeme& deme = m_world->GetPopulation().GetDeme(ctx.GetOrgInterface()->GetDemeID());
int cell_data = m_world->GetPopulation().GetCell(ctx.GetOrgInterface()->GetCellID()).GetCellData();
cOrgInterface* iface = ctx.GetOrgInterface();
@@ -3019,6 +3034,11 @@
}
double cTaskLib::Task_MoveToEvent(cTaskContext& ctx) const {
+
+ if(ctx.GetOrganism()->GetCellID() == -1) {
+ return 0.0;
+ }
+
cDeme* deme = ctx.GetOrganism()->GetOrgInterface().GetDeme();
int cell_data = ctx.GetOrganism()->GetOrgInterface().GetCellData();
if(cell_data <= 0)
More information about the Avida-cvs
mailing list