Exemple #1
0
 private static string GetInstanceInfo()
 {
     return("Nom de l'instance : " + filename + "\n" +
            "Taille : " + qap.N + "\n" +
            "Meilleure solution : " + bestKnownSolution.ToString() + "\n" +
            "Fitness meilleur solution : " + bestKnownSolution.Fitness + "\n"
            );
 }
        public override string ToString()
        {
            string str = "";

            str += "\nN : " + InitialSol.N;
            str += "\nS0 : " + InitialSol.ToString();
            str += "\nSize Tabou : " + SizeTabou;
            str += "\nNbsteps : " + NbSteps;
            str += "\n";

            return(str);
        }
Exemple #3
0
            public override string ToString()
            {
                string str = "";

                str += "\nFinal Temperature: " + FinalTemperature;
                str += "\nNumber of Worse Solution Picked : " + NbWorsePicked;
                str += "\nImprovement chart : " + ImprovementChart;
                str += "\nBest Solution : " + Best.ToString();
                str += "\nBest Fitness : " + BestFitness;
                str += "\nTotal Improvement : " + BestImprovement + "%";
                str += "\nExecution Time : " + timeEllapsed + "ms";


                str += "\n";

                return(str);
            }
Exemple #4
0
            public override string ToString()
            {
                string str = "";

                str += "\nAverage Tabou Size : " + AverageTabouSize;

                str += "\nBest Solution : " + Best.ToString();
                str += "\nBest Fitness : " + BestFitness;
                str += "\nTotal Improvement : " + BestImprovement + "%";


                str += "\nNb Up/Downhills : " + Uphills;
                str += "\nExecution Time : " + timeEllapsed + "ms";

                str += "\n";

                return(str);
            }
Exemple #5
0
            public override string ToString()
            {
                string str = "";

                str += "\nStep #" + Step;
                str += "\nCurrent Temperature : " + CurrentTemp;

                str += "\nCurrent : " + Current.ToString();
                str += "\nCurrent Fitness : " + CurrentFitness;
                str += "\nCurrent Improvement : " + CurrentImprovement + "%";

                str += "\nBest : " + Best.ToString();
                str += "\nBest Fitness : " + BestFitness;
                str += "\nBest Improvement : " + BestImprovement + "%";

                str += "\n";

                return(str);
            }
Exemple #6
0
        private static void TestAlgorithmGenetic()
        {
            string problemFilepath  = path + "tai12a" + ".dat";
            QuadraticAssignment qap = new QuadraticAssignment(problemFilepath);

            //Seed it!
            RandomSingleton.Instance.Seed = 0;

            GeneticAlgorithmQAP ga = new GeneticAlgorithmQAP(qap, 100, 50, 0.05d, 2, 20);

            ga.Verbose  = true;
            ga.WithLogs = true;
            QuadraticAssignmentSolution best = ga.Run();

            string pathWrite = Path.Combine(pathCSV, "tai12a", "ga.csv");

            ga.Logs.SaveLogsTo(pathWrite);

            Console.WriteLine("Best Solution : " + best.ToString());
            Console.WriteLine("Fitness : " + best.Fitness);
        }
Exemple #7
0
        private static void TestEquals()
        {
            Console.WriteLine("---- TEST EQUALS SOLUTIONS -----");
            int[] p1 = new int[] { 1, 4, 2, 3, 5 };
            int[] p2 = new int[] { 2, 3, 5, 4, 1 };

            QuadraticAssignmentSolution s1 = new QuadraticAssignmentSolution(p1);
            QuadraticAssignmentSolution s2 = new QuadraticAssignmentSolution(p2);


            Console.WriteLine("s1 = " + s1.ToString());
            Console.WriteLine("s2 = " + s2.ToString());
            Console.WriteLine();

            Console.WriteLine("s1.Equals(s1) == true");
            DisplaySuccess(s1.Equals(s1) == true);

            Console.WriteLine("s1.Equals(s2) == false");
            DisplaySuccess(s1.Equals(s2) == false);

            Console.WriteLine();

            Console.WriteLine("s1.Equals(p1) == true");
            DisplaySuccess(s1.Equals(p1) == true);

            Console.WriteLine("s1.Equals(p2) == false");
            DisplaySuccess(s1.Equals(p2) == false);


            Console.WriteLine();

            Console.WriteLine("s1.Equals(new int[] { 1, 4, 2, 3, 5 }) == true");
            DisplaySuccess(s1.Equals(new int[] { 1, 4, 2, 3, 5 }) == true);

            Console.WriteLine("s1.Equals(new int[] { 2, 3, 5, 4, 1 }) == false");
            DisplaySuccess(s1.Equals(new int[] { 2, 3, 5, 4, 1 }) == false);


            Console.WriteLine("------");
        }
Exemple #8
0
            public override string ToString()
            {
                string str = "";

                str += "\nStep #" + Step;
                if (HasImproved)
                {
                    str += "\nCurrent has improved";
                }
                str += "\nCurrent Tabou Size : " + CurrentTabouSize;

                str += "\nCurrent : " + Current.ToString();
                str += "\nCurrent Fitness : " + CurrentFitness;
                str += "\nCurrent Improvement : " + CurrentImprovement + "%";

                str += "\nBest : " + Best.ToString();
                str += "\nBest Fitness : " + BestFitness;
                str += "\nBest Improvement : " + BestImprovement + "%";

                str += "\n";

                return(str);
            }
Exemple #9
0
        private static void TestRecuitSimuleGA()
        {
            string problemFilepath  = path + "tai12a" + ".dat";
            QuadraticAssignment qap = new QuadraticAssignment(problemFilepath);

            //Seed it!
            RandomSingleton.Instance.Seed = 0;

            QuadraticAssignmentSolution initialSol = qap.Identity;

            RecuitSimule recuit = new RecuitSimule(qap);

            GeneticAlgorithmRecuit ga = new GeneticAlgorithmRecuit(recuit, 40, 15, 0.05d, 1, 3);

            ga.Verbose  = true;
            ga.WithLogs = true;
            RecuitSimuleParameters      bestParam = ga.Run();
            QuadraticAssignmentSolution best      = recuit.Execute(bestParam);

            Console.WriteLine("Best Params : " + bestParam.ToString());
            Console.WriteLine("\nBest Solution : " + best.ToString());
            Console.WriteLine("Fitness : " + best.Fitness);
        }