Index: branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning.Test/Program.cs
===================================================================
--- branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning.Test/Program.cs	(revision 8514)
+++ branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning.Test/Program.cs	(revision 8516)
@@ -7,19 +7,22 @@
 using System.Xml;
 using HeuristicLab.Algorithms.GraphRouting;
-using HeuristicLab.Problems.RoutePlanning.Graph;
-using HeuristicLab.Problems.RoutePlanning.Osm;
-using HeuristicLab.Problems.RoutePlanning.Osm.Data;
+using HeuristicLab.Algorithms.GraphRouting.Interfaces;
+using HeuristicLab.Problems.RoutePlanning.Data.DIMACS;
+using HeuristicLab.Problems.RoutePlanning.Data.Osm;
+using HeuristicLab.Problems.RoutePlanning.Interfaces;
+using HeuristicLab.Problems.RoutePlanning.RoutingGraph;
+
+// For testing openstreetmap data is used
+// http://www.openstreetmap.org
+// Map data © OpenStreetMap contributors, CC BY-SA
+
 namespace HeuristicLab.Problems.RoutePlanning.Test {
   class Program {
     static void Main(string[] args) {
-      // For testing openstreetmap data is used
-      // http://www.openstreetmap.org
-      // Map data © OpenStreetMap contributors, CC BY-SA
-
       string file1 = @"..\..\OsmTestFiles\test.osm";
       string file2 = @"..\..\OsmTestFiles\testNode1.osm";
       string file3 = @"..\..\OsmTestFiles\testWay1.osm";
       string file4 = @"..\..\OsmTestFiles\testRelation1.osm";
-      string file5 = @"..\..\OsmTestFiles\test_mid.osm";
+      string file5 = @"C:\dev\osmfiles\test_mid.osm";
       string file6 = @"C:\dev\osmfiles\oberosterreich.highway.osm";
       string file7 = @"C:\dev\osmfiles\austria.highway.osm";
@@ -29,58 +32,29 @@
       string fileNYCoords = @"C:\dev\DIMACSfiles\USA-road-d.NY.co.gz";
 
-      //IDataSource ds = TestLoad(typeof(XmlDataSource), file7);
-      //IDataSource ds = TestLoad(typeof(OsmDataSource), file6);
-      //OsmGraph graph = new OsmGraph(ds);
-
-      //IGraph graphNew = TestGetRoutingGraph(ds);
-      //ExecuteBenchmark(graphNew, typeof(AStarAlgorithmV3), 262144, 20);
-
-      //IRouter router = new AStarAlgorithmV3(graphNew);
+      IDataSource ds1 = TestLoad(typeof(OsmDataSource), file6);
+      IDataSource ds2 = TestLoad(typeof(DIMACSDataSource), fileNYCoords, fileNYArcs);
+
+      //IGraph graph = TestGetRoutingGraph(ds1);
+      //ExecuteBenchmark(graph, typeof(AStarAlgorithmV3), 262144, 20);
+
+      //IRouter router = new AStarAlgorithmV3(graph);
       //long[] r = router.Calculate(266733493, 986825165);
-      ////long[] r = router.Calculate(998717680, 986825165);
-
-      //IDataSource ds = new DIMACSDataSource(fileNYCoords, fileNYArcs);
-      //IDataSource ds = new OsmDataSource(file5);
-
-      //TestRouter(new DijkstraAlgorithm(graph), 529102170, 1001363194, true);
-      //TestRouter(new DijkstraAlgorithmV2(graphNew), 529102170, 1001363194, true);
-      //TestRouter(new DijkstraAlgorithm(graph), 529102170, 31372732, false); // inz - hgb
-      //TestRouter(new DijkstraAlgorithmV2(graphNew), 529102170, 31372732, false); // inz - hgb
-      //TestRouter(new BidrectionalDijkstraAlgorithm(graph), 529102170, 31372732, false); // inz - hgb
-      //TestRouter(new BidrectionalDijkstraAlgorithmV2(graphNew), 529102170, 31372732, false); // inz - hgb
-      //TestRouter(new AStarAlgorithm(graph), 529102170, 31372732, false); // inz - hgb
-      //TestRouter(new AStarAlgorithmV2(graph), 529102170, 31372732, false); // inz - hgb
-      //TestRouter(new AStarAlgorithmV3(graphNew), 529102170, 31372732, false); // inz - hgb
-
-      //TestRouter(new AStarAlgorithmV2(graph), 763113382, 1078628481, false); // bregenz (bahnhofstr) - podersdorf (??)
-      //TestRouter(new AStarAlgorithmV3(graphNew), 346151602, 33196510, false); // bregenz (bahnhofstr) - wien (stepansplatz)
-      //TestRouter(new AStarAlgorithmV2(graph), 346151602, 33196510, false); // bregenz (bahnhofstr) - wien (stepansplatz)
-
-      //TestRouter(new AStarAlgorithmV2(graph), 32044987, 261576106, false);    //vorarblberg
-      //TestRouter(new AStarAlgorithmV3(graphNew), 32044987, 261576106, false);    //vorarblberg
-
-      //TestLoadAndRouter(file6, typeof(DijkstraAlgorithm), 529102170, 31372732, false, false); // inz - hgb
-      //TestLoadAndRouter(file6, typeof(AStarAlgorithm), 529102170, 31372732, false, false); // inz - hgb
-      //TestLoadAndRouter(file6, typeof(AStarAlgorithmV2), 529102170, 31372732, false, true); // inz - hgb
-
-      //TestLoadAndRouter(file6, typeof(DijkstraAlgorithm), 529102170, 1001363194, true, false);
-      //TestLoadAndRouter(file6, typeof(DijkstraAlgorithm), 529102170, 1001363194, true, false);
-      //TestLoadAndRouter(file6, typeof(AStarAlgorithm), 529102170, 1001363194, true, false);
-      //TestLoadAndRouter(file6, typeof(AStarAlgorithmV2), 529102170, 1001363194, true, false);
-      //TestLoadAndRouter(file6, typeof(BidrectionalDijkstraAlgorithm), 529102170, 1001363194, true, false);
-
-      //TestLoadAndRouter(file5, typeof(DijkstraAlgorithm), 529102170, 1001363194, true, false);
-      //TestLoadAndRouter(file5, typeof(BidrectionalDijkstraAlgorithm), 529102170, 1001363194, true, true);
-      //TestLoadAndRouter(file6, typeof(BidrectionalDijkstraAlgorithm), 529102170, 31372732, false, true); // inz - hgb
-
-      TestLoadAndRouterNew(file6, typeof(AStarAlgorithmV3), 529102170, 31372732, false, true); // inz - hgb
-      //TestLoadAndRouterNew(file6, typeof(DijkstraAlgorithmV2), 529102170, 31372732, false, true);
-      //TestLoadAndRouterNew(file6, typeof(BidrectionalDijkstraAlgorithmV2), 529102170, 31372732, false, true);
-      //TestLoadAndRouterNew(file6, typeof(AStarAlgorithmV3), 529102170, 31372732, false, true);
-
-      //TestLoadAndRouter(file7, typeof(AStarAlgorithmV2), 346151602, 33196510, false, true); // bregenz (bahnhofstr) - wien (stepansplatz)
-      //TestLoadAndRouterNew(file7, typeof(AStarAlgorithmV3), 346151602, 33196510, false, true); // bregenz (bahnhofstr) - wien (stepansplatz)
-
-      //TestLoadAndRouter(file8, typeof(AStarAlgorithmV2), 32044987, 261576106, false, true);    //vorarblberg
+      //long[] r = router.Calculate(998717680, 986825165);
+
+      //TestRouter(new DijkstraAlgorithmV2(graph), 529102170, 1001363194, true); // inz
+
+      //TestRouter(new DijkstraAlgorithmV2(graph), 529102170, 31372732, false); // inz - hgb
+      //TestRouter(new BidrectionalDijkstraAlgorithmV2(graph), 529102170, 31372732, false); // inz - hgb
+      //TestRouter(new AStarAlgorithmV3(graph), 529102170, 31372732, false); // inz - hgb
+
+      //TestRouter(new AStarAlgorithmV3(graph), 346151602, 33196510, false); // bregenz (bahnhofstr) - wien (stepansplatz)
+
+      //TestRouter(new AStarAlgorithmV3(graph), 32044987, 261576106, false);    //vorarblberg
+
+      //TestLoadAndRouter(typeof(OsmDataSource), file6, typeof(AStarAlgorithmV3), 529102170, 31372732, false, true); // inz - hgb
+      //TestLoadAndRouter(typeof(OsmDataSource), file6, typeof(DijkstraAlgorithmV2), 529102170, 31372732, false, true); // inz - hgb
+      //TestLoadAndRouter(typeof(OsmDataSource), file6, typeof(BidrectionalDijkstraAlgorithmV2), 529102170, 31372732, false, true); // inz - hgb
+      //TestLoadAndRouter(typeof(OsmDataSource), file6, typeof(AStarAlgorithmV3), 529102170, 31372732, false, true); // inz - hgb
+      //TestLoadAndRouter(typeof(OsmDataSource), file7, typeof(AStarAlgorithmV3), 346151602, 33196510, false, true); // bregenz (bahnhofstr) - wien (stepansplatz)
 
       System.Console.Read();
@@ -126,5 +100,5 @@
     }
 
-    private static void TestLoadAndRouter(string filepath, Type routerType, long sourceNodeId, long targetNodeId, bool showResult, bool writeResultFile) {
+    private static void TestLoadAndRouter(Type dsType, string filepath, Type routerType, long sourceNodeId, long targetNodeId, bool showResult, bool writeResultFile) {
       FileInfo file = new FileInfo(filepath);
       Console.WriteLine("Test Load and Route BEGIN -------------------------");
@@ -133,10 +107,10 @@
       Console.Write("Loading data ... ");
       var sw = Stopwatch.StartNew();
-      XmlDataSource xmlDs = new XmlDataSource(filepath);
+      IDataSource ds = (IDataSource)Activator.CreateInstance(dsType, filepath);
       sw.Stop();
       Console.WriteLine("done.");
       Console.WriteLine("Loading Time: {0}", sw.Elapsed);
       Console.WriteLine();
-      OsmGraph graph = new OsmGraph(xmlDs);
+      IGraph graph = ds.GetRoutingGraph();
       IRouter router = (IRouter)Activator.CreateInstance(routerType, graph);
       Console.Write("Calculate route ... ");
@@ -164,90 +138,5 @@
     }
 
-    private static void TestLoadAndRouterNew(string filepath, Type routerType, long sourceNodeId, long targetNodeId, bool showResult, bool writeResultFile) {
-      FileInfo file = new FileInfo(filepath);
-      Console.WriteLine("Test Load and Route BEGIN -------------------------");
-      Console.WriteLine("File name: {0}", file.Name);
-      Console.WriteLine();
-      Console.Write("Loading data ... ");
-      var sw = Stopwatch.StartNew();
-      //XmlDataSource xmlDs = new XmlDataSource(filepath);
-      IDataSource xmlDs = new OsmDataSource(filepath);
-      sw.Stop();
-      Console.WriteLine("done.");
-      Console.WriteLine("Loading Time: {0}", sw.Elapsed);
-      Console.WriteLine();
-      IGraph graph = xmlDs.GetRoutingGraph();
-      IRouter router = (IRouter)Activator.CreateInstance(routerType, graph);
-      Console.Write("Calculate route ... ");
-      sw = Stopwatch.StartNew();
-      long[] result = router.Calculate(sourceNodeId, targetNodeId);
-      sw.Stop();
-      Console.WriteLine("done.");
-      Console.WriteLine("Execution Time: {0}", sw.Elapsed);
-      Console.WriteLine();
-      if (showResult) {
-        Console.WriteLine("Result: ");
-        foreach (long i in result) System.Console.Write(i + "; ");
-        Console.WriteLine();
-        Console.WriteLine();
-      }
-      if (writeResultFile) {
-        string dt = DateTime.Now.ToString("yyyyMMddhhmmss_");
-        string fn = Path.GetFileNameWithoutExtension(file.Name);
-        string resultFile = dt + fn + "_" + sourceNodeId + "-" + targetNodeId + ".gpx";
-        Console.WriteLine("Result file: {0}", resultFile);
-        WriteGPXFileNew(graph, result, resultFile);
-      }
-      Console.WriteLine("===================================================");
-      Console.WriteLine();
-    }
-
-    private static void WriteGPXFile(OsmGraph graph, long[] route, string file) {
-      XmlWriterSettings settings = new XmlWriterSettings();
-      settings.Indent = true;
-      settings.IndentChars = ("   ");
-
-      using (XmlWriter writer = XmlWriter.Create(file, settings)) {
-        writer.WriteStartElement("gpx", "http://www.topografix.com/GPX/1/0");
-        writer.WriteAttributeString("version", "1.1");
-        writer.WriteAttributeString("creator", "cloudia");
-
-        foreach (long nodeId in route) {
-          OsmVertex<Node> node = graph.GetVertex(nodeId);
-          writer.WriteStartElement("wpt");
-          writer.WriteAttributeString("lat", XmlConvert.ToString(node.Node.Latitude));
-          writer.WriteAttributeString("lon", XmlConvert.ToString(node.Node.Longitude));
-          writer.WriteEndElement(); // wpt
-        }
-
-        //writer.WriteStartElement("rte");
-        //foreach (long nodeId in route) {
-        //  Vertex<Node> node = graph.GetVertex(nodeId);
-        //  writer.WriteStartElement("rtept");
-        //  writer.WriteAttributeString("lat", XmlConvert.ToString(node.Node.Latitude));
-        //  writer.WriteAttributeString("lon", XmlConvert.ToString(node.Node.Longitude));
-        //  writer.WriteEndElement(); // rtept
-        //}
-        //writer.WriteEndElement(); // rte
-
-        //writer.WriteStartElement("trk");
-        //writer.WriteElementString("name", "RoutePath");
-        ////writer.WriteEndElement(); // name
-        //writer.WriteStartElement("trkseq");
-        //foreach (long nodeId in route) {
-        //  Vertex<Node> node = graph.GetVertex(nodeId);
-        //  writer.WriteStartElement("trkpt");
-        //  writer.WriteAttributeString("lat", XmlConvert.ToString(node.Node.Latitude));
-        //  writer.WriteAttributeString("lon", XmlConvert.ToString(node.Node.Longitude));
-        //  writer.WriteEndElement(); // trkpt
-        //}
-        //writer.WriteEndElement(); // trkseq
-        //writer.WriteEndElement(); // trk
-
-        writer.WriteEndElement(); // gpx
-      }
-    }
-
-    private static void WriteGPXFileNew(IGraph graph, long[] route, string file) {
+    private static void WriteGPXFile(IGraph graph, long[] route, string file) {
       XmlWriterSettings settings = new XmlWriterSettings();
       settings.Indent = true;
@@ -267,28 +156,4 @@
         }
 
-        //writer.WriteStartElement("rte");
-        //foreach (long nodeId in route) {
-        //  Vertex<Node> node = graph.GetVertex(nodeId);
-        //  writer.WriteStartElement("rtept");
-        //  writer.WriteAttributeString("lat", XmlConvert.ToString(node.Node.Latitude));
-        //  writer.WriteAttributeString("lon", XmlConvert.ToString(node.Node.Longitude));
-        //  writer.WriteEndElement(); // rtept
-        //}
-        //writer.WriteEndElement(); // rte
-
-        //writer.WriteStartElement("trk");
-        //writer.WriteElementString("name", "RoutePath");
-        ////writer.WriteEndElement(); // name
-        //writer.WriteStartElement("trkseq");
-        //foreach (long nodeId in route) {
-        //  Vertex<Node> node = graph.GetVertex(nodeId);
-        //  writer.WriteStartElement("trkpt");
-        //  writer.WriteAttributeString("lat", XmlConvert.ToString(node.Node.Latitude));
-        //  writer.WriteAttributeString("lon", XmlConvert.ToString(node.Node.Longitude));
-        //  writer.WriteEndElement(); // trkpt
-        //}
-        //writer.WriteEndElement(); // trkseq
-        //writer.WriteEndElement(); // trk
-
         writer.WriteEndElement(); // gpx
       }
