Compare commits

..

3 Commits

Author SHA1 Message Date
c7a0d8da41 Dependency changes 2024-07-29 01:35:43 +02:00
60b4e44244 Add time taken 2024-07-25 02:28:20 +02:00
3877c87094 Benchmark for initial Search 2024-07-25 02:28:09 +02:00
2 changed files with 37 additions and 14 deletions

View File

@ -8,20 +8,37 @@ 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)
{
for (int explorationDistance = 1000; explorationDistance <= 1400; explorationDistance += 100)
for (float speedRating = 0.75f; speedRating <= 0.75f; speedRating += 0.1f)
{
for (int additionalExploration = 45; additionalExploration <= 80; additionalExploration += 5)
for (float angleRating = 1f; angleRating <= 1f; angleRating += 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 distanceImprovedRating = 0.1f; distanceImprovedRating <= 0.1f; distanceImprovedRating += 0.1f)
{
for (float distanceSpeedRating = 0f; distanceSpeedRating <= 0f; distanceSpeedRating += 0.1f)
{
for (int explorationDistance = 1000; explorationDistance <= 2500; explorationDistance += 250)
{
for (int additionalExploration = 50; additionalExploration <= 200; additionalExploration += 25)
{
logger?.LogInformation($"Speed:{speedRating:0.00} Angle:{angleRating:0.00} DistanceImproved:{distanceImprovedRating:0.00} DistanceSpeed:{distanceSpeedRating:0.00} ExplorationDistance:{explorationDistance:000} Additional:{additionalExploration:000}");
string name = $"{speedRating:0.00}${angleRating:0.00}${distanceImprovedRating:0.00}${distanceSpeedRating:0.00}${explorationDistance:000}${additionalExploration:000}";
DateTime start = DateTime.Now;
Route r = new Astar(new(0, 0.07f, 0, 0),explorationDistance).
FindPath(startLat, startLon, endLat, endLon, regionSize, true, PathMeasure.Time, additionalExploration, importPath, logger);
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}");
logger?.LogInformation($"Took {end-start:hh\\:mm\\:ss\\.fff}");
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,8 +42,14 @@ Logger logger = new(LogLevel.Information, consoleOut: Console.Out);
if (!arguments.ContainsKey(benchmarkArg))
{
Route r = new Astar().FindPath(startLat, startLon, endLat, endLon, regionSize, true, PathMeasure.Time, 300, importPathVal[0], logger);
Renderer.Render(r, 20000, exportRenderPath[0]);
DateTime start = DateTime.Now;
Route r = new Astar().FindPath(startLat, startLon, endLat, endLon, regionSize, true, PathMeasure.Distance, importPathVal[0], logger);
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
Benchmark.Run(startLat, startLon, endLat, endLon, regionSize, importPathVal[0], Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Benchmark"), logger);