예제 #1
0
        static public void RunParameterTest(Cities cities, int time, int populationSize, int matingPoolSize,
                                            int tournamentSize, int mutationProbability, int mutationType,
                                            string path)
        {
            float  bestDistance  = (float)cities.BestDistance;
            float  distance      = (float)Genetic.AnalyzeWeight(cities, time, populationSize, matingPoolSize, tournamentSize, mutationProbability, mutationType);
            string relativeError = (((distance - bestDistance) / bestDistance) * 100.0f).ToString();

            path += cities.AdjacencyMatrix.GetLength(0) + "_Genetic_" + time + "s_" + populationSize + "os_" + matingPoolSize + "mat_" + tournamentSize +
                    "trnm_" + mutationProbability + "%_" + (mutationType == 0 ? "invert" : "swap") + ".txt";

            WriteOutputToFile(path, relativeError);
        }