[Avida-SVN] r1900 - branches/dkdev/source/main

dknoester at myxo.css.msu.edu dknoester at myxo.css.msu.edu
Tue Aug 7 13:04:40 PDT 2007


Author: dknoester
Date: 2007-08-07 16:04:40 -0400 (Tue, 07 Aug 2007)
New Revision: 1900

Modified:
   branches/dkdev/source/main/cStats.cc
   branches/dkdev/source/main/cStats.h
Log:
updates to stat tracking


Modified: branches/dkdev/source/main/cStats.cc
===================================================================
--- branches/dkdev/source/main/cStats.cc	2007-08-07 19:33:22 UTC (rev 1899)
+++ branches/dkdev/source/main/cStats.cc	2007-08-07 20:04:40 UTC (rev 1900)
@@ -865,6 +865,7 @@
 
 /*! Generic statistics that should be gathered for all networks. */
 void cStats::Topology(cDeme::Network& network) {
+  ++_topo_attempted_repl;
   _topo_edges.Add(boost::num_edges(network));
   _topo_vertices.Add(boost::num_vertices(network));
   _topo_last_network = network;
@@ -873,12 +874,15 @@
 
 /*! Statistics that should be gathered only for those networks that cause replication. */
 void cStats::TopologyReplication(cDeme::Network& network) {
-  ++_topo_connected;
+  ++_topo_repl;
   _topo_edges_repl.Add(boost::num_edges(network));
   _topo_vertices_repl.Add(boost::num_vertices(network));
   _topo_clustering_coeff.Add(clustering_coefficient(network));
-  _topo_cpl.Add(characteristic_path_length(network));
-  _topo_diameter.Add(diameter(network));
+  if(network_is_connected(network)) {
+    ++_topo_connected;
+    _topo_cpl.Add(characteristic_path_length(network));
+    _topo_diameter.Add(diameter(network));
+  }
 }
 
 void cStats::PrintTopologyData(const cString& filename) {
@@ -886,9 +890,11 @@
 	df.WriteComment( "Topology data\n" );
 	df.WriteTimeStamp();
 	df.Write(GetUpdate(), "update [update]" );
-  df.Write(_topo_edges.Average(), "mean edges in all networks [edges]");
-  df.Write(_topo_edges_repl.Average(), "mean edges in all replicated networks [repl_edges]");
-  df.Write(_topo_vertices.Average(), "mean vertices in all networks [vertices]");
+  df.Write(_topo_attempted_repl, "attempted replications [repl_attempts]");
+  df.Write(_topo_repl, "successful replications [repl]");
+  df.Write(_topo_edges.Average(), "mean edges [edges]");
+  df.Write(_topo_edges_repl.Average(), "mean edges in replicated networks [repl_edges]");
+  df.Write(_topo_vertices.Average(), "mean vertices [vertices]");
   df.Write(_topo_vertices_repl.Average(), "mean vertices in all replicated networks [repl_vertices]");
   df.Write(_topo_connected, "count of connected networks [connected]");
   df.Write(_topo_clustering_coeff.Average(), "mean clustering coefficient [cluster_coeff]");
@@ -896,11 +902,13 @@
   df.Write(_topo_diameter.Average(), "mean diameter [diameter]");
 	df.Endl();
   
-  _topo_connected = 0;
+  _topo_attempted_repl = 0;
+  _topo_repl = 0;
 	_topo_edges.Clear();
   _topo_edges_repl.Clear();
   _topo_vertices.Clear();
   _topo_vertices_repl.Clear();
+  _topo_connected = 0;
   _topo_clustering_coeff.Clear();
   _topo_cpl.Clear();
   _topo_diameter.Clear();

Modified: branches/dkdev/source/main/cStats.h
===================================================================
--- branches/dkdev/source/main/cStats.h	2007-08-07 19:33:22 UTC (rev 1899)
+++ branches/dkdev/source/main/cStats.h	2007-08-07 20:04:40 UTC (rev 1900)
@@ -557,15 +557,20 @@
   void PrintEachTopology();
   
 private:
+  // Stats gathered on replication test:
+  int _topo_attempted_repl; //!< Count of attempted replications.
   int _topo_connected; //!< Count of connected networks.
   cDoubleSum _topo_edges; //!< Edge count in all networks.
+  cDoubleSum _topo_vertices; //!< Vertex count in all networks;
+  cDoubleSum _topo_clustering_coeff; //!< Clustering coefficient.
+  cDeme::Network _topo_last_network; //!< The last constructed network.
+  
+  // Stats gathered on replication pass:
+  int _topo_repl; //!< Count of actual replications.
   cDoubleSum _topo_edges_repl; //!< Edge count in networks that replicated.
-  cDoubleSum _topo_vertices; //!< Vertex count in all networks;
   cDoubleSum _topo_vertices_repl; //!< Vertex count in networks that replicated.
-  cDoubleSum _topo_clustering_coeff; //!< Clustering coefficient.
   cDoubleSum _topo_cpl; //!< Characteristic path length.
   cDoubleSum _topo_diameter; //!< Diameter of the network.
-  cDeme::Network _topo_last_network; //!< The last constructed network.
   
   //
   // Deme-related statistics.




More information about the Avida-cvs mailing list