[Avida-SVN] r1148 - branches/coopcomm/source/main

dknoester at myxo.css.msu.edu dknoester at myxo.css.msu.edu
Mon Dec 18 10:10:08 PST 2006


Author: dknoester
Date: 2006-12-18 13:10:08 -0500 (Mon, 18 Dec 2006)
New Revision: 1148

Modified:
   branches/coopcomm/source/main/cAvidaConfig.h
   branches/coopcomm/source/main/cOrganism.cc
Log:
Added undetectable message loss on receive.

Modified: branches/coopcomm/source/main/cAvidaConfig.h
===================================================================
--- branches/coopcomm/source/main/cAvidaConfig.h	2006-12-18 15:50:28 UTC (rev 1147)
+++ branches/coopcomm/source/main/cAvidaConfig.h	2006-12-18 18:10:08 UTC (rev 1148)
@@ -279,6 +279,7 @@
   // Coop-comm
   CONFIG_ADD_GROUP(COOP_COMM_GROUP, "Cooperative Communications Group");
   CONFIG_ADD_VAR(CELL_ID_RESET_PROB, double, 0.0, "Probability that a cell's random ID will be reset when an organism is inserted.");
+  CONFIG_ADD_VAR(MSG_LOSS_RATE, double, 0.0, "Probability that a organism will not receive a message.");
   
 #endif
   

Modified: branches/coopcomm/source/main/cOrganism.cc
===================================================================
--- branches/coopcomm/source/main/cOrganism.cc	2006-12-18 15:50:28 UTC (rev 1147)
+++ branches/coopcomm/source/main/cOrganism.cc	2006-12-18 18:10:08 UTC (rev 1148)
@@ -651,6 +651,13 @@
 */
 bool cOrganism::ReceiveMessage(cOrgMessage& msg)
 {
+  double loss_rate = m_world->GetConfig().MSG_LOSS_RATE.Get();
+  if(loss_rate > 0.0 && m_world->GetRandom().P(loss_rate)) {
+    // We're returning true here because this should be an undetectable error
+    // on the sender side.
+    return true;
+  }
+  
   m_world->GetStats().IncReceived();
   int old_size = m_received_messages.size();
   m_received_messages.push_back(msg);




More information about the Avida-cvs mailing list