[Avida-SVN] r1455 - in branches/dkdev: Avida.xcodeproj source/main
dknoester at myxo.css.msu.edu
dknoester at myxo.css.msu.edu
Wed Apr 4 06:22:45 PDT 2007
Author: dknoester
Date: 2007-04-04 09:22:44 -0400 (Wed, 04 Apr 2007)
New Revision: 1455
Modified:
branches/dkdev/Avida.xcodeproj/project.pbxproj
branches/dkdev/source/main/cPopulation.cc
Log:
Support for differently sized demes, and the non-grid topologies.
Modified: branches/dkdev/Avida.xcodeproj/project.pbxproj
===================================================================
--- branches/dkdev/Avida.xcodeproj/project.pbxproj 2007-04-04 00:42:33 UTC (rev 1454)
+++ branches/dkdev/Avida.xcodeproj/project.pbxproj 2007-04-04 13:22:44 UTC (rev 1455)
@@ -246,7 +246,6 @@
E03F28DC0B8A2840009966B8 /* cDeme.cc in Sources */ = {isa = PBXBuildFile; fileRef = E03F28DA0B8A2840009966B8 /* cDeme.cc */; };
E03F28DD0B8A2840009966B8 /* cDeme.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = E03F28DB0B8A2840009966B8 /* cDeme.h */; };
E08178BA0B3DCB9600B474B6 /* cTopology.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = E08178B90B3DCB9600B474B6 /* cTopology.h */; };
- E0D141EA0BB736E800077264 /* cTopologyManager.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = E0D141E90BB736E800077264 /* cTopologyManager.h */; };
E0D1973A0B8B2F4C005EF7EE /* cOrgMessage.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = E0D197390B8B2F4C005EF7EE /* cOrgMessage.h */; };
E0F61AE80BA2FDBD00B53C23 /* cGermline.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = E0F61AE70BA2FDBD00B53C23 /* cGermline.h */; };
E0F61B210BA33F5D00B53C23 /* cGermline.cc in Sources */ = {isa = PBXBuildFile; fileRef = E0F61B200BA33F5D00B53C23 /* cGermline.cc */; };
@@ -297,7 +296,6 @@
E03F28DD0B8A2840009966B8 /* cDeme.h in CopyFiles */,
E0D1973A0B8B2F4C005EF7EE /* cOrgMessage.h in CopyFiles */,
E0F61AE80BA2FDBD00B53C23 /* cGermline.h in CopyFiles */,
- E0D141EA0BB736E800077264 /* cTopologyManager.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -805,8 +803,6 @@
E03F28DA0B8A2840009966B8 /* cDeme.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cDeme.cc; sourceTree = "<group>"; };
E03F28DB0B8A2840009966B8 /* cDeme.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cDeme.h; sourceTree = "<group>"; };
E08178B90B3DCB9600B474B6 /* cTopology.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cTopology.h; sourceTree = "<group>"; };
- E0D141E90BB736E800077264 /* cTopologyManager.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cTopologyManager.h; sourceTree = "<group>"; };
- E0D141F00BB7423D00077264 /* cTopologyManager.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cTopologyManager.cc; sourceTree = "<group>"; };
E0D197390B8B2F4C005EF7EE /* cOrgMessage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cOrgMessage.h; sourceTree = "<group>"; };
E0F61AE70BA2FDBD00B53C23 /* cGermline.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cGermline.h; sourceTree = "<group>"; };
E0F61B200BA33F5D00B53C23 /* cGermline.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cGermline.cc; sourceTree = "<group>"; };
@@ -1305,8 +1301,6 @@
70B0868A08F49EA800FC65FE /* cPopulationCell.cc */,
70B0868608F49E9700FC65FE /* cPopulationCell.h */,
702D4EFD08DA5341007BA469 /* cPopulationInterface.cc */,
- E0D141E90BB736E800077264 /* cTopologyManager.h */,
- E0D141F00BB7423D00077264 /* cTopologyManager.cc */,
702D4EF608DA5328007BA469 /* cPopulationInterface.h */,
70B0871E08F5E82D00FC65FE /* cReaction.cc */,
70B0870E08F5E81000FC65FE /* cReaction.h */,
@@ -1964,6 +1958,7 @@
suppress,
);
PRODUCT_NAME = avida;
+ USER_HEADER_SEARCH_PATHS = "source/main source/cpu";
};
name = Development;
};
Modified: branches/dkdev/source/main/cPopulation.cc
===================================================================
--- branches/dkdev/source/main/cPopulation.cc 2007-04-04 00:42:33 UTC (rev 1454)
+++ branches/dkdev/source/main/cPopulation.cc 2007-04-04 13:22:44 UTC (rev 1455)
@@ -845,7 +845,43 @@
// definitely needs refactoring.
cGermline& source_germline = source_deme.GetGermline();
const double f=1.0;
- source_germline.UpdateMerit(pow(f*(72 - boost::num_edges(network) + 1), 2));
+
+ // Need to calculate the maximum number of edges in the deme.
+ // This number is geometry-dependent. This should be abstracted
+ // out into a topology management thingy. And we need an easy way to
+ // specify group tasks (for merit).
+ int max_edges=0;
+ switch(m_world->GetConfig().WORLD_GEOMETRY.Get()) {
+ case nGeometry::GRID: {
+ const int interior_nodes = (world_x-2) * (world_y/num_demes - 2);
+ const int exterior_nodes = source_deme.GetSize() - interior_nodes;
+ // Each interior node has 8 edges.
+ max_edges += interior_nodes * 8;
+ // Each external node (except for corners) has 5 edges.
+ max_edges += (exterior_nodes-4) * 5;
+ // Each corner has 3 edges.
+ max_edges += 12;
+ // And now we've counted each edge twice.
+ max_edges /= 2;
+ break;
+ }
+ case nGeometry::TORUS: {
+ // Each node has 8 edges; avoid double-counting.
+ max_edges = source_deme.GetSize()*4;
+ break;
+ }
+ case nGeometry::CLIQUE: {
+ // Euler's formula.
+ max_edges = source_deme.GetSize()*(source_deme.GetSize()-1)/2;
+ break;
+ }
+ default: {
+ assert(false);
+ break;
+ }
+ }
+
+ source_germline.UpdateMerit(pow(f*(max_edges - boost::num_edges(network) + 1), 2));
}
break;
}
More information about the Avida-cvs
mailing list