Esempio n. 1
0
 public void ResultNotNull()
 {
     int pop = 10;
     int gen = 10;
     Algorithm nsga = new Nsga2();
     Assert.AreNotEqual(nsga.StartEvaluation(pop,gen), null);
 }
Esempio 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();
 }
Esempio n. 3
0
        public void InitialPopulationBoundaries()
        {
            Algorithm nsga = new Nsga2();
            int pop = 10;
            TestFunctions funcs = TestFunctions.GetTestFunctions();
            Population p = new Population();
            p.NewPopulation(pop);
            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);
        }