public void ResultNotNull() { int pop = 10; int gen = 10; Algorithm nsga = new Nsga2(); Assert.AreNotEqual(nsga.StartEvaluation(pop,gen), null); }
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(); }
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); }