Mutlithreaded RegionManager

This commit is contained in:
glax 2023-04-21 15:14:02 +02:00
parent 976108569b
commit d8ce6e4ce5

View File

@ -26,7 +26,7 @@ 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);
TestVariables(workingDir, start, finish, 16); TestVariables(workingDir, start, finish, 32);
/* /*
string parentFolder = new DirectoryInfo(workingDir).Parent!.FullName; string parentFolder = new DirectoryInfo(workingDir).Parent!.FullName;
@ -73,6 +73,8 @@ public class Server
{ {
string parentFolder = new DirectoryInfo(workingDir).Parent!.FullName; string parentFolder = new DirectoryInfo(workingDir).Parent!.FullName;
RegionManager rm = new (workingDir);
Queue<Thread> calcThreads = new(); Queue<Thread> calcThreads = new();
for (double sameRoadPriority = 0.02; sameRoadPriority < 0.4; sameRoadPriority += 0.02) for (double sameRoadPriority = 0.02; sameRoadPriority < 0.4; sameRoadPriority += 0.02)
@ -86,7 +88,7 @@ public class Server
double factor = angleWeightFactor; double factor = angleWeightFactor;
calcThreads.Enqueue(new Thread(() => calcThreads.Enqueue(new Thread(() =>
{ {
Pathfinder testresult = new Pathfinder(workingDir).AStar(start, Pathfinder testresult = new Pathfinder(rm).AStar(start,
finish, Tag.SpeedType.car, priority, roadPriority, finish, Tag.SpeedType.car, priority, roadPriority,
0, factor); 0, factor);
string fileName = string fileName =