예제 #1
0
        public void PopulationTest()
        {
            Population pop = new Population();

            Assert.AreEqual(0, pop.getPopulationCount());

            ServiceTestData td = ServiceTestData.getInstance();
            pop.SetGenom(td.getMockInitialPopulation(10));
            Assert.AreEqual(td.GetPopulationCount(), pop.getPopulationCount());

            Population pop2 = new Population();
            pop2.SetGenom(td.getMockInitialPopulation());
            Population pop3 = pop.Concat(pop2);
            Assert.AreEqual(2 * td.GetPopulationCount(),
                pop3.getPopulationCount());
        }
예제 #2
0
 public void ConstructionTest()
 {
     ServiceTestData td = ServiceTestData.getInstance();
     Population population = new Population();
     population.SetGenom(td.getMockInitialPopulation());
     Assert.AreEqual(td.GetPopulationCount(), population.getPopulationCount());
 }
예제 #3
0
        public void MockDataTest()
        {
            ServiceTestData svd = ServiceTestData.getInstance();
            Population p = new Population();
            p.SetGenom(svd.getMockInitialPopulation());

            Assert.AreEqual(svd.GetPopulationCount(), p.getPopulationCount());
            ServiceTestFunctions tf = ServiceTestFunctions.GetInstance();
            foreach(Individual i in p)
            {
                Assert.AreEqual(tf.GetDecisionVariablesCount(), i.DecisionVariables.Count);
            }
        }
예제 #4
0
        public void GenerationTest()
        {
            ServiceTestData svd = ServiceTestData.getInstance();
            Population p = new Population();
            p.SetGenom(svd.getMockInitialPopulation());

            p.NextGeneration();

            p.ConcatenateTwoExistingPopulations();
            Assert.AreEqual(2 * svd.GetPopulationCount(), p.getPopulationCount());

            ServiceOutput so = ServiceOutput.GetInstance();
            so.SetOutput(new OutputStd());
            //
            //so.SetOutput(new OutputFile())
            so.Write(p.ToReadableFormat());
            Console.WriteLine("asdf");
        }