Compare commits

..

No commits in common. "c7a0d8da41e0aeee39110c5719da61b2e11e6f4d" and "02e3b1e5a37ee1d9dd31fed282a1ee0b94ad7601" have entirely different histories.

2 changed files with 14 additions and 37 deletions

View File

@ -8,37 +8,20 @@ public static class Benchmark
{ {
public static void Run(float startLat, float startLon, float endLat, float endLon, float regionSize, string importPath, string exportPath, ILogger? logger = null) public static void Run(float startLat, float startLon, float endLat, float endLon, float regionSize, string importPath, string exportPath, ILogger? logger = null)
{ {
for (float speedRating = 0.75f; speedRating <= 0.75f; speedRating += 0.1f) for (int explorationDistance = 1000; explorationDistance <= 1400; explorationDistance += 100)
{ {
for (float angleRating = 1f; angleRating <= 1f; angleRating += 0.1f) for (int additionalExploration = 45; additionalExploration <= 80; additionalExploration += 5)
{ {
for (float distanceImprovedRating = 0.1f; distanceImprovedRating <= 0.1f; distanceImprovedRating += 0.1f) logger?.LogInformation($"Speed:{0:0.00} Angle:{0.07f:0.00} DistanceImproved:{0:0.00} DistanceSpeed:{0:0.00} ExplorationDistance:{explorationDistance:000} Additional:{additionalExploration:000}");
{ string name = $"{0:0.00}${0.07f:0.00}${0:0.00}${0:0.00}${explorationDistance:000}${additionalExploration:000}";
for (float distanceSpeedRating = 0f; distanceSpeedRating <= 0f; distanceSpeedRating += 0.1f) DateTime start = DateTime.Now;
{ Route r = new Astar(new(0, 0.07f, 0, 0),explorationDistance).
for (int explorationDistance = 1000; explorationDistance <= 2500; explorationDistance += 250) FindPath(startLat, startLon, endLat, endLon, regionSize, true, PathMeasure.Time, additionalExploration, importPath, logger);
{ DateTime end = DateTime.Now;
for (int additionalExploration = 50; additionalExploration <= 200; additionalExploration += 25) Directory.CreateDirectory(Path.Join(exportPath, "benchmark", name));
{ File.WriteAllText(Path.Join(exportPath, "benchmark", name, "stats.txt"), $"{end - start:hh\\:mm\\:ss\\.fff}\n{r}");
logger?.LogInformation($"Speed:{speedRating:0.00} Angle:{angleRating:0.00} DistanceImproved:{distanceImprovedRating:0.00} DistanceSpeed:{distanceSpeedRating:0.00} ExplorationDistance:{explorationDistance:000} Additional:{additionalExploration:000}"); logger?.LogInformation($"Took {end-start:hh\\:mm\\:ss\\.fff}");
string name = $"{speedRating:0.00}${angleRating:0.00}${distanceImprovedRating:0.00}${distanceSpeedRating:0.00}${explorationDistance:000}${additionalExploration:000}"; Renderer.Render(r, 20000, Path.Join(exportPath, "benchmark", name, "render.png"));
DateTime start = DateTime.Now;
Route r = new Astar(new(speedRating, angleRating, distanceImprovedRating, distanceSpeedRating), explorationDistance: explorationDistance, explorationMultiplier: additionalExploration).
FindPath(startLat, startLon, endLat, endLon, regionSize, true, PathMeasure.Time, importPath, logger);
DateTime end = DateTime.Now;
logger?.LogInformation($"Found path in {end - start:hh\\:mm\\:ss\\.fff}");
Directory.CreateDirectory(Path.Join(exportPath, "benchmark", name));
File.WriteAllText(Path.Join(exportPath, "benchmark", name, "stats.txt"), $"{end - start:hh\\:mm\\:ss\\.fff}\n{r}");
DateTime stats = DateTime.Now;
logger?.LogInformation($"Stats took {stats - end:hh\\:mm\\:ss\\.fff}");
Renderer.Render(r, 20000, Path.Join(exportPath, "benchmark", name, "render.png"));
DateTime rendered = DateTime.Now;
logger?.LogInformation($"Rendered in {rendered - stats:hh\\:mm\\:ss\\.fff}");
logger?.LogInformation($"Total {rendered - start:hh\\:mm\\:ss\\.fff}");
}
}
}
}
} }
} }
} }

View File

@ -42,14 +42,8 @@ Logger logger = new(LogLevel.Information, consoleOut: Console.Out);
if (!arguments.ContainsKey(benchmarkArg)) if (!arguments.ContainsKey(benchmarkArg))
{ {
DateTime start = DateTime.Now; Route r = new Astar().FindPath(startLat, startLon, endLat, endLon, regionSize, true, PathMeasure.Time, 300, importPathVal[0], logger);
Route r = new Astar().FindPath(startLat, startLon, endLat, endLon, regionSize, true, PathMeasure.Distance, importPathVal[0], logger); Renderer.Render(r, 20000, exportRenderPath[0]);
DateTime end = DateTime.Now;
logger.LogInformation($"Found path in {end - start:hh\\:mm\\:ss\\.fff}");
Renderer.Render(r, 25000, exportRenderPath[0]);
DateTime rendered = DateTime.Now;
logger.LogInformation($"Rendered in {rendered - end:hh\\:mm\\:ss\\.fff}");
logger.LogInformation($"Total {rendered - start:hh\\:mm\\:ss\\.fff}");
} }
else else
Benchmark.Run(startLat, startLon, endLat, endLon, regionSize, importPathVal[0], Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Benchmark"), logger); Benchmark.Run(startLat, startLon, endLat, endLon, regionSize, importPathVal[0], Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Benchmark"), logger);