- Timestamp:
- 08/03/12 15:04:27 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning.Test/Program.cs
r8350 r8408 11 11 class Program { 12 12 static void Main(string[] args) { 13 // For testing openstreetmap data is used 14 // http://www.openstreetmap.org 15 // Map data © OpenStreetMap contributors, CC BY-SA 16 13 17 string file1 = @"..\..\OsmTestFiles\test.osm"; 14 18 string file2 = @"..\..\OsmTestFiles\testNode1.osm"; … … 18 22 string file6 = @"C:\dev\osmfiles\oberosterreich.highway.osm"; 19 23 20 Test(file5, 529102170, 1001363194, true, false); 21 //Test(file6, 529102170, 1001363194, true, false); 22 //Test(file6, 529102170, 31372732, false, true); // inz - hgb 24 //TestD(file5, 529102170, 1001363194, true, false); // inz - inz 25 //Test(file5, 529102170, 1001363194, true, false); // inz - inz 26 //Test(file6, 529102170, 1001363194, true, false); // inz - inz 27 28 IDataSource ds = TestLoad(file6); 29 Graph.Graph graph = new Graph.Graph(ds); 30 TestRouter(new AStarAlgorithm(graph), 529102170, 31372732, false); // inz - hgb 31 TestRouter(new AStarAlgorithmV2(graph), 529102170, 31372732, false); // inz - hgb 32 33 //TestLoadAndRouter(file6, typeof(DijkstraAlgorithm), 529102170, 31372732, false, false); // inz - hgb 34 //TestLoadAndRouter(file6, typeof(AStarAlgorithm), 529102170, 31372732, false, false); // inz - hgb 35 //TestLoadAndRouter(file6, typeof(AStarAlgorithmV2), 529102170, 31372732, false, false); // inz - hgb 36 23 37 System.Console.Read(); 24 38 } 25 39 26 private static void Test(string filepath, long sourceNodeId, long targetNodeId, bool showResult, bool writeResultFile) { 40 private static long[] TestRouter(IRouter router, long sourceNodeId, long targetNodeId, bool showResult) { 41 Console.WriteLine("Test Router BEGIN ---------------------------------"); 42 Console.WriteLine("Type: " + router.GetType()); 43 44 Console.Write("Calculate route ... "); 45 var sw = Stopwatch.StartNew(); 46 long[] result = router.Calculate(sourceNodeId, targetNodeId); 47 sw.Stop(); 48 Console.WriteLine("done."); 49 Console.WriteLine("Execution Time: {0}", sw.Elapsed); 50 Console.WriteLine(); 51 if (showResult) { 52 Console.WriteLine("Result: "); 53 foreach (long i in result) System.Console.Write(i + "; "); 54 Console.WriteLine(); 55 Console.WriteLine(); 56 } 57 Console.WriteLine("==================================================="); 58 Console.WriteLine(); 59 return result; 60 } 61 62 private static IDataSource TestLoad(string filepath) { 27 63 FileInfo file = new FileInfo(filepath); 28 Console.WriteLine("Test BEGIN ------------------------------"); 64 Console.WriteLine("Test Load Data BEGIN ------------------------------"); 65 Console.WriteLine("File name: {0}", file.Name); 66 Console.WriteLine(); 67 Console.Write("Loading data ... "); 68 var sw = Stopwatch.StartNew(); 69 XmlDataSource xmlDs = new XmlDataSource(filepath); 70 sw.Stop(); 71 Console.WriteLine("done."); 72 Console.WriteLine("Time: {0}", sw.Elapsed); 73 Console.WriteLine(); 74 Console.WriteLine("==================================================="); 75 Console.WriteLine(); 76 return xmlDs; 77 } 78 79 private static void TestLoadAndRouter(string filepath, Type routerType, long sourceNodeId, long targetNodeId, bool showResult, bool writeResultFile) { 80 FileInfo file = new FileInfo(filepath); 81 Console.WriteLine("Test Load and Route BEGIN -------------------------"); 29 82 Console.WriteLine("File name: {0}", file.Name); 30 83 Console.WriteLine(); … … 37 90 Console.WriteLine(); 38 91 Graph.Graph graph = new Graph.Graph(xmlDs); 39 //IRouter router = new DijkstraAlgorithm(graph); 40 IRouter router = new AStarAlgorithm(graph); 92 IRouter router = (IRouter)Activator.CreateInstance(routerType, graph); 41 93 Console.Write("Calculate route ... "); 42 94 sw = Stopwatch.StartNew(); … … 59 111 WriteGPXFile(graph, result, resultFile); 60 112 } 61 Console.WriteLine("========================================= ");113 Console.WriteLine("==================================================="); 62 114 Console.WriteLine(); 63 115 }
Note: See TracChangeset
for help on using the changeset viewer.