public void TestC1() { ArrayList individuals = new ArrayList(); //Argument for ery vertex can be reached from every other vertexRoadNetworkPopulator? Populator thePopulator = new Populator("map.xml"); thePopulator.Populate(individuals); Map theMap = Map.FromFile("map.xml"); //Assert.AreSame(theMap.Start, -1); //Assert.AreSame(theMap.End, -1); //Every vertex can be reached from every other vertex //Map start and end points match those in the roadnetworkpopulator. //Ensure population is made up of valid roadnetworks. //Ensure all are not the same. Boolean passed = false; for (int i = 0; i < individuals.Count; i++) { for (int k = 0; k < ((RoadNetwork)individuals[i]).VertexCount; k++) { for (int l = 0; l < ((RoadNetwork)individuals[i]).VertexCount; l++) { if (((RoadNetwork)individuals[i]).GetVertex(k).Coordinates.X != ((RoadNetwork)individuals[i]).GetVertex(l).Coordinates.X) { passed = true; } } } } Assert.IsTrue(passed); }
static void run() { IPopulator populator = new Populator("map.xml"); IEvaluator evaluator = new Evaluator(null); IGeneticOperator mutator = new Mutator(null); ITerminator terminator = new FitnessThresholdTerminator(FitnessConverter.FromFloat(1.0f / 1024.0f)); IOutputter outputter = new RoadNetworkXmlOutputter(@"c:\roadnetworktest\index.xml"); GeneticEngine engine = new GeneticEngine(populator, evaluator, mutator, terminator, outputter); engine.Repeat(100); engine.FinishOutput(); }