Method for mass-testing all factors.
This commit is contained in:
parent
28ab2b2bb8
commit
8b7cfcbd77
@ -4,6 +4,7 @@ using OSMDatastructure;
|
|||||||
using OSMDatastructure.Graph;
|
using OSMDatastructure.Graph;
|
||||||
using Pathfinding;
|
using Pathfinding;
|
||||||
using RenderPath;
|
using RenderPath;
|
||||||
|
using Region = OSMDatastructure.Region;
|
||||||
|
|
||||||
namespace Server;
|
namespace Server;
|
||||||
|
|
||||||
@ -24,18 +25,58 @@ public class Server
|
|||||||
|
|
||||||
Coordinates start = new (48.7933798f, 9.8275859f);
|
Coordinates start = new (48.7933798f, 9.8275859f);
|
||||||
Coordinates finish = new (48.795918f, 9.021618f);
|
Coordinates finish = new (48.795918f, 9.021618f);
|
||||||
|
|
||||||
|
|
||||||
|
Console.WriteLine("Preparing BaseRender");
|
||||||
|
string parentFolder = new DirectoryInfo(workingDir).Parent!.FullName;
|
||||||
|
|
||||||
|
RegionManager allRegions = new(workingDir);
|
||||||
|
for (float lat = 48.75f - Region.RegionSize / 2; lat < 48.85f + Region.RegionSize / 2; lat += Region.RegionSize / 2)
|
||||||
|
{
|
||||||
|
for (float lon = 9f - Region.RegionSize / 2; lon < 9.9f + Region.RegionSize / 2; lon += Region.RegionSize / 2)
|
||||||
|
{
|
||||||
|
allRegions.GetRegion(new Coordinates(lat, lon));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Console.WriteLine("Regions Loaded. Rendering.");
|
||||||
|
ValueTuple<Image, Renderer.Bounds> baseRender = Renderer.DrawArea(allRegions);
|
||||||
|
|
||||||
|
for (double sameRoadPriority = 0; sameRoadPriority < 0.4; sameRoadPriority += 0.015)
|
||||||
|
{
|
||||||
|
for (double roadLevelPriority = 0.4; roadLevelPriority > 0; roadLevelPriority -= 0.015)
|
||||||
|
{
|
||||||
|
for (double angleWeightFactor = 45; angleWeightFactor < 65; angleWeightFactor += 1.0)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"{angleWeightFactor}/65 {roadLevelPriority}/0,4 {sameRoadPriority}/0,4");
|
||||||
|
Pathfinder testresult = new Pathfinder(workingDir).AStar(start,
|
||||||
|
finish, Tag.SpeedType.car, roadLevelPriority, sameRoadPriority,
|
||||||
|
0, angleWeightFactor);
|
||||||
|
string fileName = $"angle{angleWeightFactor}_level{roadLevelPriority}_same{sameRoadPriority}.png";
|
||||||
|
string path = Path.Join(parentFolder, fileName);
|
||||||
|
Image areaHeur = Renderer.DrawGScores(testresult.gScore, baseRender.Item1, baseRender.Item2).Item1;
|
||||||
|
Image areaHeurPath = Renderer.DrawPath(testresult.pathResult, areaHeur, baseRender.Item2).Item1;
|
||||||
|
areaHeurPath.Save(path, ImageFormat.Png);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
Pathfinder result = new Pathfinder(workingDir).AStar(start,
|
Pathfinder result = new Pathfinder(workingDir).AStar(start,
|
||||||
finish, Tag.SpeedType.car, 0.01, 0.0001,
|
finish, Tag.SpeedType.car, 0.03, 0.01,
|
||||||
0);
|
0, 50);
|
||||||
|
|
||||||
|
Console.WriteLine($"Calc-time {result.pathResult!.calcTime} Path-length: {result.pathResult.pathNodes.Count} Visited-nodes: {result.gScore!.Count}");
|
||||||
|
|
||||||
|
string fileName = DateTime.Now.ToFileTime().ToString();
|
||||||
|
|
||||||
string parentFolder = new DirectoryInfo(workingDir).Parent!.FullName;
|
string parentFolder = new DirectoryInfo(workingDir).Parent!.FullName;
|
||||||
string resultFileName = $"{new DirectoryInfo(workingDir).Name}-{DateTime.Now.ToFileTime()}.result";
|
string resultFileName = $"{new DirectoryInfo(workingDir).Name}-{fileName}.result";
|
||||||
result.SaveResult(Path.Join(parentFolder, resultFileName));
|
result.SaveResult(Path.Join(parentFolder, resultFileName));
|
||||||
|
|
||||||
string renderFileName = $"{new DirectoryInfo(workingDir).Name}-{DateTime.Now.ToFileTime()}.render.png";
|
string renderFileName = $"{new DirectoryInfo(workingDir).Name}-{fileName}.render.png";
|
||||||
Image render = Renderer.DrawPathfinder(result);
|
Image render = Renderer.DrawPathfinder(result);
|
||||||
#pragma warning disable CA1416
|
#pragma warning disable CA1416
|
||||||
render.Save(Path.Join(parentFolder, renderFileName), ImageFormat.Png);
|
render.Save(Path.Join(parentFolder, renderFileName), ImageFormat.Png);
|
||||||
#pragma warning restore CA1416
|
#pragma warning restore CA1416*/
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user