public void GenerateMaze() { DestroyMaze(); G = MazeGraph <int> .CreateNoWallsGraph4(rows, cols); executeAlgorithm(); createOBJ(); AssetDatabase.Refresh(); Generate3dMaze(); }
public void TimeComparison() { using (System.IO.StreamWriter file = new System.IO.StreamWriter(@Application.dataPath + "/Tiempos.csv")) { StatComparison <int> Test = new StatComparison <int>(); StringBuilder sb = new StringBuilder(); sb.Clear(); sb.Append("Algorithm,Size,Time(ms)\n"); file.Write(sb.ToString()); int size = 50; int maxsize = 100; int inc = 10; //int rows = size; //int cols = size; TimeSpan stop; TimeSpan start; while (size <= maxsize) { G = MazeGraph <int> .CreateNoWallsGraph4(size, size); for (int i = 0; i < 10; i++) { foreach (MazeGenerator.Algorithm it in Enum.GetValues(typeof(MazeGenerator.Algorithm))) { sb.Clear(); generationAlgorithm = it; start = new TimeSpan(DateTime.Now.Ticks); executeAlgorithm(); stop = new TimeSpan(DateTime.Now.Ticks); sb.Append(it + "," + (size + "x" + size) + "," + stop.Subtract(start).TotalMilliseconds.ToString("00.000", CultureInfo.InvariantCulture) + "\n"); file.Write(sb.ToString()); } } size = size + inc; } } }
public void executeCharacteristicsAnalysis() { using (System.IO.StreamWriter file = new System.IO.StreamWriter(@Application.dataPath + "/analisis.csv")) { StatComparison <int> Test = new StatComparison <int>(); StringBuilder sb = new StringBuilder(); sb.Clear(); sb.Append("Algorithm,DeadEnds,Intersection,LongestPath,Directness,Twistiness\n"); file.Write(sb.ToString()); int rows = 10; int cols = 10; for (int i = 0; i < 100; i++) { TimeSpan stop; TimeSpan start = new TimeSpan(DateTime.Now.Ticks); // codigo a medir foreach (MazeGenerator.Algorithm it in Enum.GetValues(typeof(MazeGenerator.Algorithm))) { sb.Clear(); G = MazeGraph <int> .CreateNoWallsGraph4(rows, cols); var generationAlgorithm = it; executeAlgorithm(); sb.Append(it + ","); sb.Append(Test.deadendsPercentage(G).ToString("00.000", CultureInfo.InvariantCulture) + ","); sb.Append(Test.interSectionsPercentage(G).ToString("00.000", CultureInfo.InvariantCulture) + ","); sb.Append(Test.LongestPath(G).ToString("00.000", CultureInfo.InvariantCulture) + ","); sb.Append(Test.Directness(G).ToString("00.000", CultureInfo.InvariantCulture) + ","); sb.Append(Test.Twistiness(G).ToString("00.000", CultureInfo.InvariantCulture) + "\n"); file.Write(sb.ToString()); } stop = new TimeSpan(DateTime.Now.Ticks); Debug.Log("Iteracion " + i + " , Tiempo(s) : " + stop.Subtract(start).TotalMilliseconds / 1000.0f); } } }