[Avida-SVN] r2771 - in branches/movement/source: cpu main

grabow38 at myxo.css.msu.edu grabow38 at myxo.css.msu.edu
Tue Sep 9 05:33:38 PDT 2008


Author: grabow38
Date: 2008-09-09 08:33:36 -0400 (Tue, 09 Sep 2008)
New Revision: 2771

Modified:
   branches/movement/source/cpu/cHardwareCPU.cc
   branches/movement/source/main/cAvidaConfig.h
   branches/movement/source/main/cPhenotype.cc
   branches/movement/source/main/cPopulation.cc
Log:
Added new config option for idealized gradient.

Modified: branches/movement/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/movement/source/cpu/cHardwareCPU.cc	2008-09-07 22:01:11 UTC (rev 2770)
+++ branches/movement/source/cpu/cHardwareCPU.cc	2008-09-09 12:33:36 UTC (rev 2771)
@@ -3169,6 +3169,10 @@
 
 bool cHardwareCPU::DoSense(cAvidaContext& ctx, int conversion_method, double base)
 {
+
+  // @LMG debugging with new environment
+  // cout << "Entering DoSense" << endl;
+  
   // Returns the amount of a resource or resources 
   // specified by modifying NOPs into register BX
   const tArray<double> res_count = organism->GetOrgInterface().GetResources() + 
@@ -3277,6 +3281,10 @@
   sensed_index+= GetLabel().AsInt(num_nops);
   organism->GetPhenotype().IncSenseCount(sensed_index);
   
+  // @LMG, output for testing sensing and environment
+  // cout << "Output resource info..." << endl;
+  // cout << "Res. index: " << sensed_index << " Res. amount: " << resource_result << "Leaving DoSense" << endl;
+  
   return true; 
 
   // Note that we are converting <double> resources to <int> register values

Modified: branches/movement/source/main/cAvidaConfig.h
===================================================================
--- branches/movement/source/main/cAvidaConfig.h	2008-09-07 22:01:11 UTC (rev 2770)
+++ branches/movement/source/main/cAvidaConfig.h	2008-09-09 12:33:36 UTC (rev 2771)
@@ -546,6 +546,7 @@
   CONFIG_ADD_VAR(MOVT_TRACK_ON, int, 0, "Movement tracking on [1 = on, 0 = off]");
   CONFIG_ADD_VAR(MOVT_MERIT_DIV, int, 0, "Calculate merit bonus only on divide [1 = yes, 0 = no]");
   CONFIG_ADD_VAR(MOVT_DEBUG_OUT, int, 0, "Show movement debugging output [1 = yes, 0 = no]");
+  CONFIG_ADD_VAR(IDEAL_GRAD_ON, int, 0, "Using idealized gradient [1 = yes, 0 = no]");
 
   // BDC: Additions for pheromones
   CONFIG_ADD_GROUP(PHEROMONE_GROUP, "Pheromone Settings");

Modified: branches/movement/source/main/cPhenotype.cc
===================================================================
--- branches/movement/source/main/cPhenotype.cc	2008-09-07 22:01:11 UTC (rev 2770)
+++ branches/movement/source/main/cPhenotype.cc	2008-09-09 12:33:36 UTC (rev 2771)
@@ -593,11 +593,11 @@
   int target_y_coord = target_id / world_x;
   int org_x_coord = end_cell_id % world_x;
   int org_y_coord = end_cell_id / world_x;
-  if ( m_world->GetConfig().MOVT_DEBUG_OUT.Get() ) {
-    cout << " Org. cell id: " << end_cell_id << " Target id: " << target_id
-		 << " Target x, y: " << target_x_coord << ", " << target_y_coord
-		 << " Org. x, y: "  << org_x_coord << ", " << org_y_coord << endl;
-  }
+	if ( m_world->GetConfig().MOVT_DEBUG_OUT.Get() ) {
+		cout << " Org. cell id: " << end_cell_id << " Target id: " << target_id
+			 << " Target x, y: " << target_x_coord << ", " << target_y_coord
+			 << " Org. x, y: "  << org_x_coord << ", " << org_y_coord << endl;
+	}
 		 
 	int cur_dist = (org_x_coord - target_x_coord) * (org_x_coord - target_x_coord) + 
 				 (org_y_coord - target_y_coord) * (org_y_coord - target_y_coord);

Modified: branches/movement/source/main/cPopulation.cc
===================================================================
--- branches/movement/source/main/cPopulation.cc	2008-09-07 22:01:11 UTC (rev 2770)
+++ branches/movement/source/main/cPopulation.cc	2008-09-09 12:33:36 UTC (rev 2771)
@@ -360,7 +360,10 @@
   if (parent_alive == true) {
   
     // Reset parent target cell @LMG 
-	parent_organism.SetTargetCell();
+	// Currently called only when the idealized gradient configuration is ON
+    if ( m_world->GetConfig().IDEAL_GRAD_ON.Get() ) {
+      parent_organism.SetTargetCell();
+    }
 
     // Reset inputs and re-calculate merit if required
     if (m_world->GetConfig().RESET_INPUTS_ON_DIVIDE.Get() > 0){
@@ -563,7 +566,10 @@
   }
   
   // @LMG for moving to target 
-  in_organism->SetTargetCell();
+  // Currently called only when the idealized gradient configuration is ON
+  if ( m_world->GetConfig().IDEAL_GRAD_ON.Get() ) {
+    in_organism->SetTargetCell();
+  }
 }
 
 // @WRE 2007/07/05 Helper function to take care of side effects of Avidian 
@@ -896,7 +902,7 @@
 		target_x << " " <<
 		target_y << " " << endl;
 	    movelog.close();
-	}
+		}
     } else {
 	schedule->Adjust(cell2.GetID(), cMerit(0));
     }




More information about the Avida-cvs mailing list