Esempio n. 1
0
        public void SplashView(SudokuTool.TestResult testResults, EvolutionStats stats, int[][] originalMatrix,
                               int[][] bestMatrix)
        {
            Console.Clear();
            DisplayMatrix(originalMatrix);
            Console.WriteLine("\nSearching for Best solution: \n");


            if (testResults.isOptimal == false)
            {
                Console.ForegroundColor = (ConsoleColor.Red);
                Console.WriteLine(" Did not find optimal solution \nBest solution found: \n");
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("Optimal solution found. \n");
            }

            DisplayMatrix(bestMatrix);

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(" -- Statistics -- ");
            Console.ForegroundColor = ConsoleColor.Yellow;

            // show some stats
            Console.WriteLine($@"Final Status: {testResults.resultStatus}
Errors: {testResults.errorCount}
-- Stats -- 
| Epochs (years): {stats.epochsCompleted} 
| Mass Extinctions (resets): {stats.extinctions} 
| Organisms Created: {stats.organismsBorn} | Died of Old Age (>999 years): {stats.diedOfOldAge} 
| Mutation Fails: {stats.mutationFailed} | Evolution Successes: {stats.evolutionWorked} 
| Worst Replaced by Mating Results: {stats.culledCount} | Mating Results Were Best: {stats.bestBabies} 
| Rare Mutation Was Best: {stats.bestMutationsEver} | Random Solution Was Best: {stats.randomWasTheBest} ");

            var mutationvsevolution = ((double)stats.bestMutationsEver / stats.evolutionWorked);


            double ccRatio = (double)stats.culledCount / stats.organismsBorn;

            double meRatio = (double)stats.mutationFailed / stats.evolutionWorked;

            double mpbbRatio = (double)stats.bestBabies / stats.matingPairs;


            double rbbbRatio = (double)stats.randomWasTheBest / stats.bestMutationsEver;
        }
Esempio n. 2
0
 public void SplashView(SudokuTool.TestResult testResults, EvolutionStats stats, int[][] originalMatrix,
                        int[][] bestMatrix)
 {
     // System.Diagnostics.Debug.Clear();
     DisplayMatrix(originalMatrix);
     System.Diagnostics.Debug.WriteLine("\nSearching for Best solution: \n");
     //System.Diagnostics.Debug.ForegroundColor = ConsoleColor.Cyan;
     DisplayMatrix(bestMatrix);
     // Console.ForegroundColor = ConsoleColor.Green;
     System.Diagnostics.Debug.WriteLine(" -- Statistics -- ");
     // Console.ForegroundColor = ConsoleColor.Yellow;
     System.Diagnostics.Debug.WriteLine($"Epochs Completed: {stats.epochsCompleted}");
     System.Diagnostics.Debug.WriteLine($"Great Extinctions: {stats.extinctions}");
     System.Diagnostics.Debug.WriteLine($"{stats.diedOfOldAge} organisms aged-out.");
     System.Diagnostics.Debug.WriteLine($"{stats.culledCount} organisms culled.");
 }
Esempio n. 3
0
 public EvolutionSolution(EvolutionStats stats)
 {
     _stats = stats ?? new EvolutionStats();
 }
Esempio n. 4
0
 public EvolutionSolution()
 {
     _stats = new EvolutionStats();
 }
Esempio n. 5
0
 /// <summary>
 /// pass in a IDisplayMatrix if you want the tests to output some information about the solution.
 /// </summary>
 /// <param name="disp">IDisplayMatrix instance to be used in output (write your own for logging, consoles, debugging, etc.)</param>
 public EvolutionSolution(IDisplayMatrix disp, EvolutionStats stats = null)
 {
     displayVector = disp;
     _stats        = stats ?? new EvolutionStats();
 }