Ejemplo n.º 1
0
 public void ResultNotNull()
 {
     int pop = 10;
     int gen = 10;
     Algorithm nsga = new Nsga2();
     Assert.AreNotEqual(nsga.StartEvaluation(pop,gen), null);
 }
Ejemplo n.º 2
0
 private void buttonEvaluate_Click(object sender, EventArgs e)
 {
     Algorithm nsga = new Nsga2();
     int pop = 10;
     int gen = 1000;
     Population p = nsga.StartEvaluation(pop, gen);
     //p.PrintToConsole();
 }
Ejemplo n.º 3
0
        public void InitalPopulationBoundaries()
        {
            Algorithm nsga = new Nsga2();
            int pop = 10;
            int gen = 10;
            TestFunctions funcs = TestFunctions.GetTestFunctions();
            Population p = nsga.StartEvaluation(pop, gen);
            int mistakes = 0;
            for (int i = 0; i < p.GetCount(); i++)
            {
                for(int j = 0; j < p.Get(i).DecisionVariables.Count; j++)
                {
                    if (p.Get(i).DecisionVariables[0] < funcs.GetLowerThreshold()
                        || p.Get(i).DecisionVariables[j] > funcs.GetUpperThreshold())
                    {
                        mistakes++;

                    }
                }
            }
            Assert.AreEqual(mistakes, 0);
        }