public static void testPopulationSize(TSP problem, int[] populationSizes, int numOfGenerations)
        {
            string      line;
            TSPGenotype genotype;
            var         file = new System.IO.StreamWriter(@"/Users/aggami/Library/Mobile Documents/com~apple~CloudDocs/Studia/Semestr 6/SIiIW/" + problem.Name + "testPopulacjiGen=" + numOfGenerations + ".txt");

            file.AutoFlush = true;

            AlgorytmEwolucyjny algorytmProb = new AlgorytmEwolucyjny(problem, populationSizes[0], numOfGenerations, "TNM");
            string             infoLine     = algorytmProb.ToString();

            string startLine = "Popsize; Avg; Min; Max; Stand.dev; AvgTime; ";

            file.WriteLine(startLine);



            foreach (int ps in populationSizes)
            {
                Console.WriteLine("Start for value: " + ps);
                float[] results = new float[10];
                float   min     = Single.MaxValue;
                float   max     = 0;
                float   sum     = 0;
                float   avg     = 0;
                float   dev     = 0;
                float   temp;

                var watch = System.Diagnostics.Stopwatch.StartNew();

                for (int i = 0; i < 10; i++)
                {
                    Console.WriteLine("Run " + i);

                    AlgorytmEwolucyjny algorytmT = new AlgorytmEwolucyjny(problem, ps, numOfGenerations, "TNM");
                    genotype = algorytmT.runAlgorithm();
                    temp     = genotype.fitness();
                    sum     += temp;

                    results[i] = genotype.fitness();
                    if (temp > max)
                    {
                        max = temp;
                    }
                    if (temp < min)
                    {
                        min = temp;
                    }
                }

                watch.Stop();
                avg = sum / 10;

                for (int i = 0; i < 10; i++)
                {
                    dev += (results[i] - avg) * (results[i] - avg);
                }

                dev = Convert.ToSingle(Math.Sqrt(dev / 10));

                var elapsedTime = watch.ElapsedMilliseconds;
                elapsedTime = elapsedTime / 10000;


                line = ps + "; " + avg + "; " + min + "; " + max + "; " + dev + "; " + elapsedTime + ";";
                file.WriteLine(line);
            }

            file.Close();
        }
        public static void testSelectionMethods(TSP problem, int populationSize, int generationNum)
        {
            string      line;
            TSPGenotype genotype;
            var         file = new System.IO.StreamWriter(@"/Users/aggami/Library/Mobile Documents/com~apple~CloudDocs/Studia/Semestr 6/SIiIW/" + problem.Name + "testSelekcji pop=" + populationSize + " gen=" + generationNum + ".txt");

            AlgorytmEwolucyjny algorytmProb = new AlgorytmEwolucyjny(problem, populationSize, generationNum, "TNM");

            algorytmProb.CrossoverProb = 0.9;
            algorytmProb.MutationProb  = 0.4;
            string infoLine = algorytmProb.ToString();

            file.WriteLine(infoLine);

            string startLine = "Method; Avg; Min; Max; Stand.dev; AvgTime; ";

            file.WriteLine(startLine);



            Console.WriteLine("Start TNM");

            float[] results = new float[10];
            float   min     = Single.MaxValue;
            float   max     = 0;
            float   sum     = 0;
            float   avg     = 0;
            float   dev     = 0;
            float   temp;

            var watch = System.Diagnostics.Stopwatch.StartNew();



            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine("Run " + i);
                AlgorytmEwolucyjny algorytmT = new AlgorytmEwolucyjny(problem, populationSize, generationNum, "TNM");
                algorytmT.CrossoverProb = 0.9;
                algorytmT.MutationProb  = 0.4;

                genotype = algorytmT.runAlgorithm();
                temp     = genotype.fitness();
                sum     += temp;


                results[i] = genotype.fitness();
                if (temp > max)
                {
                    max = temp;
                }
                if (temp < min)
                {
                    min = temp;
                }
            }

            watch.Stop();
            avg = sum / 10;

            for (int i = 0; i < 10; i++)
            {
                dev += (results[i] - avg) * (results[i] - avg);
            }

            dev = Convert.ToSingle(Math.Sqrt(dev / 10));

            var elapsedTime = watch.ElapsedMilliseconds;

            elapsedTime = elapsedTime / 10000;


            line = "Tournament" + "; " + avg + "; " + min + "; " + max + "; " + dev + "; " + elapsedTime + ";";
            file.WriteLine(line);

            Console.WriteLine("Start ROU");


            min = Single.MaxValue;
            max = 0;
            sum = 0;
            avg = 0;
            dev = 0;

            watch = System.Diagnostics.Stopwatch.StartNew();



            for (int i = 0; i < 10; i++)
            {
                AlgorytmEwolucyjny algorytmT = new AlgorytmEwolucyjny(problem, populationSize, generationNum, "ROU");
                algorytmT.CrossoverProb = 0.9;
                algorytmT.MutationProb  = 0.4;
                genotype = algorytmT.runAlgorithm();
                temp     = genotype.fitness();
                sum     += temp;

                results[i] = genotype.fitness();
                if (temp > max)
                {
                    max = temp;
                }
                if (temp < min)
                {
                    min = temp;
                }
            }

            watch.Stop();
            avg = sum / 10;

            for (int i = 0; i < 10; i++)
            {
                dev += (results[i] - avg) * (results[i] - avg);
            }

            dev = Convert.ToSingle(Math.Sqrt(dev / 10));

            elapsedTime = watch.ElapsedMilliseconds;
            elapsedTime = elapsedTime / 10000;


            line = "Roulette" + "; " + avg + "; " + min + "; " + max + "; " + dev + "; " + elapsedTime + ";";
            file.WriteLine(line);

            file.Close();
        }