Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8516


Ignore:
Timestamp:
08/22/12 11:46:08 (10 years ago)
Author:
spimming
Message:

#1894:

  • solution restructured
  • removed obsolete and outdated parts
Location:
branches/RoutePlanning
Files:
32 added
12 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • branches/RoutePlanning/HeuristicLab.Algorithms.GraphRouting/3.3/AStarAlgorithmV3.cs

    r8481 r8516  
    22using System;
    33using System.Collections.Generic;
    4 using HeuristicLab.Problems.RoutePlanning.Graph;
     4using HeuristicLab.Algorithms.GraphRouting.Interfaces;
     5using HeuristicLab.Problems.RoutePlanning.Interfaces;
    56namespace HeuristicLab.Algorithms.GraphRouting {
    67  public class AStarAlgorithmV3 : IRouter {
  • branches/RoutePlanning/HeuristicLab.Algorithms.GraphRouting/3.3/BidirectionalDijkstraAlgorithmV2.cs

    r8481 r8516  
    22using System;
    33using System.Collections.Generic;
    4 using HeuristicLab.Problems.RoutePlanning.Graph;
     4using HeuristicLab.Algorithms.GraphRouting.Interfaces;
     5using HeuristicLab.Problems.RoutePlanning.Interfaces;
    56namespace HeuristicLab.Algorithms.GraphRouting {
    67  public class BidrectionalDijkstraAlgorithmV2 : IRouter {
  • branches/RoutePlanning/HeuristicLab.Algorithms.GraphRouting/3.3/DijkstraAlgorithmV2.cs

    r8509 r8516  
    22using System;
    33using System.Collections.Generic;
    4 using HeuristicLab.Problems.RoutePlanning.Graph;
     4using HeuristicLab.Algorithms.GraphRouting.Interfaces;
     5using HeuristicLab.Problems.RoutePlanning.Interfaces;
    56namespace HeuristicLab.Algorithms.GraphRouting {
    67  public class DijkstraAlgorithmV2 : IRouter {
  • branches/RoutePlanning/HeuristicLab.Algorithms.GraphRouting/3.3/HeuristicLab.Algorithms.GraphRouting.csproj

    r8481 r8516  
    5757  </ItemGroup>
    5858  <ItemGroup>
    59     <Compile Include="AStarAlgorithm.cs" />
    60     <Compile Include="AStarAlgorithmV2.cs" />
    61     <Compile Include="BidirectionalDijkstraAlgorithm.cs" />
    6259    <Compile Include="AStarAlgorithmV3.cs" />
    6360    <Compile Include="BidirectionalDijkstraAlgorithmV2.cs" />
    6461    <Compile Include="DijkstraAlgorithmV2.cs" />
    65     <Compile Include="DijkstraAlgorithm.cs" />
    6662    <Compile Include="GraphRoutingAlgorithm.cs" />
    67     <Compile Include="IRouter.cs" />
    68     <Compile Include="Pair.cs" />
     63    <Compile Include="Interfaces\IRouter.cs" />
     64    <Compile Include="Utilities\Pair.cs" />
    6965    <Compile Include="Plugin.cs" />
    70     <Compile Include="PriorityQueue.cs" />
    71     <Compile Include="PriorityQueueOld.cs" />
     66    <Compile Include="Utilities\PriorityQueue.cs" />
     67    <Compile Include="Utilities\PriorityQueueOld.cs" />
    7268    <Compile Include="Properties\AssemblyInfo.cs" />
    7369  </ItemGroup>
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning.Test/Program.cs

    r8514 r8516  
    77using System.Xml;
    88using HeuristicLab.Algorithms.GraphRouting;
    9 using HeuristicLab.Problems.RoutePlanning.Graph;
    10 using HeuristicLab.Problems.RoutePlanning.Osm;
    11 using HeuristicLab.Problems.RoutePlanning.Osm.Data;
     9using HeuristicLab.Algorithms.GraphRouting.Interfaces;
     10using HeuristicLab.Problems.RoutePlanning.Data.DIMACS;
     11using HeuristicLab.Problems.RoutePlanning.Data.Osm;
     12using HeuristicLab.Problems.RoutePlanning.Interfaces;
     13using HeuristicLab.Problems.RoutePlanning.RoutingGraph;
     14
     15// For testing openstreetmap data is used
     16// http://www.openstreetmap.org
     17// Map data © OpenStreetMap contributors, CC BY-SA
     18
    1219namespace HeuristicLab.Problems.RoutePlanning.Test {
    1320  class Program {
    1421    static void Main(string[] args) {
    15       // For testing openstreetmap data is used
    16       // http://www.openstreetmap.org
    17       // Map data © OpenStreetMap contributors, CC BY-SA
    18 
    1922      string file1 = @"..\..\OsmTestFiles\test.osm";
    2023      string file2 = @"..\..\OsmTestFiles\testNode1.osm";
    2124      string file3 = @"..\..\OsmTestFiles\testWay1.osm";
    2225      string file4 = @"..\..\OsmTestFiles\testRelation1.osm";
    23       string file5 = @"..\..\OsmTestFiles\test_mid.osm";
     26      string file5 = @"C:\dev\osmfiles\test_mid.osm";
    2427      string file6 = @"C:\dev\osmfiles\oberosterreich.highway.osm";
    2528      string file7 = @"C:\dev\osmfiles\austria.highway.osm";
     
    2932      string fileNYCoords = @"C:\dev\DIMACSfiles\USA-road-d.NY.co.gz";
    3033
    31       //IDataSource ds = TestLoad(typeof(XmlDataSource), file7);
    32       //IDataSource ds = TestLoad(typeof(OsmDataSource), file6);
    33       //OsmGraph graph = new OsmGraph(ds);
    34 
    35       //IGraph graphNew = TestGetRoutingGraph(ds);
    36       //ExecuteBenchmark(graphNew, typeof(AStarAlgorithmV3), 262144, 20);
    37 
    38       //IRouter router = new AStarAlgorithmV3(graphNew);
     34      IDataSource ds1 = TestLoad(typeof(OsmDataSource), file6);
     35      IDataSource ds2 = TestLoad(typeof(DIMACSDataSource), fileNYCoords, fileNYArcs);
     36
     37      //IGraph graph = TestGetRoutingGraph(ds1);
     38      //ExecuteBenchmark(graph, typeof(AStarAlgorithmV3), 262144, 20);
     39
     40      //IRouter router = new AStarAlgorithmV3(graph);
    3941      //long[] r = router.Calculate(266733493, 986825165);
    40       ////long[] r = router.Calculate(998717680, 986825165);
    41 
    42       //IDataSource ds = new DIMACSDataSource(fileNYCoords, fileNYArcs);
    43       //IDataSource ds = new OsmDataSource(file5);
    44 
    45       //TestRouter(new DijkstraAlgorithm(graph), 529102170, 1001363194, true);
    46       //TestRouter(new DijkstraAlgorithmV2(graphNew), 529102170, 1001363194, true);
    47       //TestRouter(new DijkstraAlgorithm(graph), 529102170, 31372732, false); // inz - hgb
    48       //TestRouter(new DijkstraAlgorithmV2(graphNew), 529102170, 31372732, false); // inz - hgb
    49       //TestRouter(new BidrectionalDijkstraAlgorithm(graph), 529102170, 31372732, false); // inz - hgb
    50       //TestRouter(new BidrectionalDijkstraAlgorithmV2(graphNew), 529102170, 31372732, false); // inz - hgb
    51       //TestRouter(new AStarAlgorithm(graph), 529102170, 31372732, false); // inz - hgb
    52       //TestRouter(new AStarAlgorithmV2(graph), 529102170, 31372732, false); // inz - hgb
    53       //TestRouter(new AStarAlgorithmV3(graphNew), 529102170, 31372732, false); // inz - hgb
    54 
    55       //TestRouter(new AStarAlgorithmV2(graph), 763113382, 1078628481, false); // bregenz (bahnhofstr) - podersdorf (??)
    56       //TestRouter(new AStarAlgorithmV3(graphNew), 346151602, 33196510, false); // bregenz (bahnhofstr) - wien (stepansplatz)
    57       //TestRouter(new AStarAlgorithmV2(graph), 346151602, 33196510, false); // bregenz (bahnhofstr) - wien (stepansplatz)
    58 
    59       //TestRouter(new AStarAlgorithmV2(graph), 32044987, 261576106, false);    //vorarblberg
    60       //TestRouter(new AStarAlgorithmV3(graphNew), 32044987, 261576106, false);    //vorarblberg
    61 
    62       //TestLoadAndRouter(file6, typeof(DijkstraAlgorithm), 529102170, 31372732, false, false); // inz - hgb
    63       //TestLoadAndRouter(file6, typeof(AStarAlgorithm), 529102170, 31372732, false, false); // inz - hgb
    64       //TestLoadAndRouter(file6, typeof(AStarAlgorithmV2), 529102170, 31372732, false, true); // inz - hgb
    65 
    66       //TestLoadAndRouter(file6, typeof(DijkstraAlgorithm), 529102170, 1001363194, true, false);
    67       //TestLoadAndRouter(file6, typeof(DijkstraAlgorithm), 529102170, 1001363194, true, false);
    68       //TestLoadAndRouter(file6, typeof(AStarAlgorithm), 529102170, 1001363194, true, false);
    69       //TestLoadAndRouter(file6, typeof(AStarAlgorithmV2), 529102170, 1001363194, true, false);
    70       //TestLoadAndRouter(file6, typeof(BidrectionalDijkstraAlgorithm), 529102170, 1001363194, true, false);
    71 
    72       //TestLoadAndRouter(file5, typeof(DijkstraAlgorithm), 529102170, 1001363194, true, false);
    73       //TestLoadAndRouter(file5, typeof(BidrectionalDijkstraAlgorithm), 529102170, 1001363194, true, true);
    74       //TestLoadAndRouter(file6, typeof(BidrectionalDijkstraAlgorithm), 529102170, 31372732, false, true); // inz - hgb
    75 
    76       TestLoadAndRouterNew(file6, typeof(AStarAlgorithmV3), 529102170, 31372732, false, true); // inz - hgb
    77       //TestLoadAndRouterNew(file6, typeof(DijkstraAlgorithmV2), 529102170, 31372732, false, true);
    78       //TestLoadAndRouterNew(file6, typeof(BidrectionalDijkstraAlgorithmV2), 529102170, 31372732, false, true);
    79       //TestLoadAndRouterNew(file6, typeof(AStarAlgorithmV3), 529102170, 31372732, false, true);
    80 
    81       //TestLoadAndRouter(file7, typeof(AStarAlgorithmV2), 346151602, 33196510, false, true); // bregenz (bahnhofstr) - wien (stepansplatz)
    82       //TestLoadAndRouterNew(file7, typeof(AStarAlgorithmV3), 346151602, 33196510, false, true); // bregenz (bahnhofstr) - wien (stepansplatz)
    83 
    84       //TestLoadAndRouter(file8, typeof(AStarAlgorithmV2), 32044987, 261576106, false, true);    //vorarblberg
     42      //long[] r = router.Calculate(998717680, 986825165);
     43
     44      //TestRouter(new DijkstraAlgorithmV2(graph), 529102170, 1001363194, true); // inz
     45
     46      //TestRouter(new DijkstraAlgorithmV2(graph), 529102170, 31372732, false); // inz - hgb
     47      //TestRouter(new BidrectionalDijkstraAlgorithmV2(graph), 529102170, 31372732, false); // inz - hgb
     48      //TestRouter(new AStarAlgorithmV3(graph), 529102170, 31372732, false); // inz - hgb
     49
     50      //TestRouter(new AStarAlgorithmV3(graph), 346151602, 33196510, false); // bregenz (bahnhofstr) - wien (stepansplatz)
     51
     52      //TestRouter(new AStarAlgorithmV3(graph), 32044987, 261576106, false);    //vorarblberg
     53
     54      //TestLoadAndRouter(typeof(OsmDataSource), file6, typeof(AStarAlgorithmV3), 529102170, 31372732, false, true); // inz - hgb
     55      //TestLoadAndRouter(typeof(OsmDataSource), file6, typeof(DijkstraAlgorithmV2), 529102170, 31372732, false, true); // inz - hgb
     56      //TestLoadAndRouter(typeof(OsmDataSource), file6, typeof(BidrectionalDijkstraAlgorithmV2), 529102170, 31372732, false, true); // inz - hgb
     57      //TestLoadAndRouter(typeof(OsmDataSource), file6, typeof(AStarAlgorithmV3), 529102170, 31372732, false, true); // inz - hgb
     58      //TestLoadAndRouter(typeof(OsmDataSource), file7, typeof(AStarAlgorithmV3), 346151602, 33196510, false, true); // bregenz (bahnhofstr) - wien (stepansplatz)
    8559
    8660      System.Console.Read();
     
    126100    }
    127101
    128     private static void TestLoadAndRouter(string filepath, Type routerType, long sourceNodeId, long targetNodeId, bool showResult, bool writeResultFile) {
     102    private static void TestLoadAndRouter(Type dsType, string filepath, Type routerType, long sourceNodeId, long targetNodeId, bool showResult, bool writeResultFile) {
    129103      FileInfo file = new FileInfo(filepath);
    130104      Console.WriteLine("Test Load and Route BEGIN -------------------------");
     
    133107      Console.Write("Loading data ... ");
    134108      var sw = Stopwatch.StartNew();
    135       XmlDataSource xmlDs = new XmlDataSource(filepath);
     109      IDataSource ds = (IDataSource)Activator.CreateInstance(dsType, filepath);
    136110      sw.Stop();
    137111      Console.WriteLine("done.");
    138112      Console.WriteLine("Loading Time: {0}", sw.Elapsed);
    139113      Console.WriteLine();
    140       OsmGraph graph = new OsmGraph(xmlDs);
     114      IGraph graph = ds.GetRoutingGraph();
    141115      IRouter router = (IRouter)Activator.CreateInstance(routerType, graph);
    142116      Console.Write("Calculate route ... ");
     
    164138    }
    165139
    166     private static void TestLoadAndRouterNew(string filepath, Type routerType, long sourceNodeId, long targetNodeId, bool showResult, bool writeResultFile) {
    167       FileInfo file = new FileInfo(filepath);
    168       Console.WriteLine("Test Load and Route BEGIN -------------------------");
    169       Console.WriteLine("File name: {0}", file.Name);
    170       Console.WriteLine();
    171       Console.Write("Loading data ... ");
    172       var sw = Stopwatch.StartNew();
    173       //XmlDataSource xmlDs = new XmlDataSource(filepath);
    174       IDataSource xmlDs = new OsmDataSource(filepath);
    175       sw.Stop();
    176       Console.WriteLine("done.");
    177       Console.WriteLine("Loading Time: {0}", sw.Elapsed);
    178       Console.WriteLine();
    179       IGraph graph = xmlDs.GetRoutingGraph();
    180       IRouter router = (IRouter)Activator.CreateInstance(routerType, graph);
    181       Console.Write("Calculate route ... ");
    182       sw = Stopwatch.StartNew();
    183       long[] result = router.Calculate(sourceNodeId, targetNodeId);
    184       sw.Stop();
    185       Console.WriteLine("done.");
    186       Console.WriteLine("Execution Time: {0}", sw.Elapsed);
    187       Console.WriteLine();
    188       if (showResult) {
    189         Console.WriteLine("Result: ");
    190         foreach (long i in result) System.Console.Write(i + "; ");
    191         Console.WriteLine();
    192         Console.WriteLine();
    193       }
    194       if (writeResultFile) {
    195         string dt = DateTime.Now.ToString("yyyyMMddhhmmss_");
    196         string fn = Path.GetFileNameWithoutExtension(file.Name);
    197         string resultFile = dt + fn + "_" + sourceNodeId + "-" + targetNodeId + ".gpx";
    198         Console.WriteLine("Result file: {0}", resultFile);
    199         WriteGPXFileNew(graph, result, resultFile);
    200       }
    201       Console.WriteLine("===================================================");
    202       Console.WriteLine();
    203     }
    204 
    205     private static void WriteGPXFile(OsmGraph graph, long[] route, string file) {
    206       XmlWriterSettings settings = new XmlWriterSettings();
    207       settings.Indent = true;
    208       settings.IndentChars = ("   ");
    209 
    210       using (XmlWriter writer = XmlWriter.Create(file, settings)) {
    211         writer.WriteStartElement("gpx", "http://www.topografix.com/GPX/1/0");
    212         writer.WriteAttributeString("version", "1.1");
    213         writer.WriteAttributeString("creator", "cloudia");
    214 
    215         foreach (long nodeId in route) {
    216           OsmVertex<Node> node = graph.GetVertex(nodeId);
    217           writer.WriteStartElement("wpt");
    218           writer.WriteAttributeString("lat", XmlConvert.ToString(node.Node.Latitude));
    219           writer.WriteAttributeString("lon", XmlConvert.ToString(node.Node.Longitude));
    220           writer.WriteEndElement(); // wpt
    221         }
    222 
    223         //writer.WriteStartElement("rte");
    224         //foreach (long nodeId in route) {
    225         //  Vertex<Node> node = graph.GetVertex(nodeId);
    226         //  writer.WriteStartElement("rtept");
    227         //  writer.WriteAttributeString("lat", XmlConvert.ToString(node.Node.Latitude));
    228         //  writer.WriteAttributeString("lon", XmlConvert.ToString(node.Node.Longitude));
    229         //  writer.WriteEndElement(); // rtept
    230         //}
    231         //writer.WriteEndElement(); // rte
    232 
    233         //writer.WriteStartElement("trk");
    234         //writer.WriteElementString("name", "RoutePath");
    235         ////writer.WriteEndElement(); // name
    236         //writer.WriteStartElement("trkseq");
    237         //foreach (long nodeId in route) {
    238         //  Vertex<Node> node = graph.GetVertex(nodeId);
    239         //  writer.WriteStartElement("trkpt");
    240         //  writer.WriteAttributeString("lat", XmlConvert.ToString(node.Node.Latitude));
    241         //  writer.WriteAttributeString("lon", XmlConvert.ToString(node.Node.Longitude));
    242         //  writer.WriteEndElement(); // trkpt
    243         //}
    244         //writer.WriteEndElement(); // trkseq
    245         //writer.WriteEndElement(); // trk
    246 
    247         writer.WriteEndElement(); // gpx
    248       }
    249     }
    250 
    251     private static void WriteGPXFileNew(IGraph graph, long[] route, string file) {
     140    private static void WriteGPXFile(IGraph graph, long[] route, string file) {
    252141      XmlWriterSettings settings = new XmlWriterSettings();
    253142      settings.Indent = true;
     
    267156        }
    268157
    269         //writer.WriteStartElement("rte");
    270         //foreach (long nodeId in route) {
    271         //  Vertex<Node> node = graph.GetVertex(nodeId);
    272         //  writer.WriteStartElement("rtept");
    273         //  writer.WriteAttributeString("lat", XmlConvert.ToString(node.Node.Latitude));
    274         //  writer.WriteAttributeString("lon", XmlConvert.ToString(node.Node.Longitude));
    275         //  writer.WriteEndElement(); // rtept
    276         //}
    277         //writer.WriteEndElement(); // rte
    278 
    279         //writer.WriteStartElement("trk");
    280         //writer.WriteElementString("name", "RoutePath");
    281         ////writer.WriteEndElement(); // name
    282         //writer.WriteStartElement("trkseq");
    283         //foreach (long nodeId in route) {
    284         //  Vertex<Node> node = graph.GetVertex(nodeId);
    285         //  writer.WriteStartElement("trkpt");
    286         //  writer.WriteAttributeString("lat", XmlConvert.ToString(node.Node.Latitude));
    287         //  writer.WriteAttributeString("lon", XmlConvert.ToString(node.Node.Longitude));
    288         //  writer.WriteEndElement(); // trkpt
    289         //}
    290         //writer.WriteEndElement(); // trkseq
    291         //writer.WriteEndElement(); // trk
    292 
    293158        writer.WriteEndElement(); // gpx
    294159      }
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/HeuristicLab.Problems.RoutePlanning.csproj

    r8488 r8516  
    5757  </ItemGroup>
    5858  <ItemGroup>
    59     <Compile Include="DIMACS\DIMACSDataSource.cs" />
    60     <Compile Include="Graph\EarthDistanceCostCalculator.cs" />
    61     <Compile Include="Graph\ICostCalculator.cs" />
    62     <Compile Include="Graph\Edge.cs" />
    63     <Compile Include="Graph\Graph.cs" />
    64     <Compile Include="Graph\IGraph.cs" />
    65     <Compile Include="Graph\OsmGraph.cs" />
    66     <Compile Include="Graph\IEdge.cs" />
    67     <Compile Include="Graph\OsmVertex.cs" />
    68     <Compile Include="Graph\Route.cs" />
    69     <Compile Include="Graph\TravelTimeCostCalculator.cs" />
    70     <Compile Include="Graph\Vertex.cs" />
    71     <Compile Include="Osm.Data\OsmDataSource.cs" />
    72     <Compile Include="Osm.Data\XmlDataSource.cs" />
    73     <Compile Include="Osm\IDataSource.cs" />
    74     <Compile Include="Osm\Node.cs" />
    75     <Compile Include="Osm\OsmBase.cs" />
    76     <Compile Include="Osm\PointD.cs" />
    77     <Compile Include="Osm\RectangleD.cs" />
    78     <Compile Include="Osm\Relation.cs" />
    79     <Compile Include="Osm\RelationMember.cs" />
    80     <Compile Include="Osm\TagConstants.cs" />
    81     <Compile Include="Osm\Utils.cs" />
    82     <Compile Include="Osm\Way.cs" />
     59    <Compile Include="Data.DIMACS\DIMACSDataSource.cs" />
     60    <Compile Include="RoutingGraph\EarthDistanceCostCalculator.cs" />
     61    <Compile Include="Interfaces\ICostCalculator.cs" />
     62    <Compile Include="RoutingGraph\Edge.cs" />
     63    <Compile Include="RoutingGraph\Graph.cs" />
     64    <Compile Include="Interfaces\IGraph.cs" />
     65    <Compile Include="Interfaces\IEdge.cs" />
     66    <Compile Include="RoutingGraph\TravelTimeCostCalculator.cs" />
     67    <Compile Include="RoutingGraph\Vertex.cs" />
     68    <Compile Include="Data.Osm\OsmDataSource.cs" />
     69    <Compile Include="Interfaces\IDataSource.cs" />
     70    <Compile Include="Data.Osm.Core\Node.cs" />
     71    <Compile Include="Data.Osm.Core\OsmBase.cs" />
     72    <Compile Include="Utilities\PointD.cs" />
     73    <Compile Include="Utilities\RectangleD.cs" />
     74    <Compile Include="Data.Osm.Core\Relation.cs" />
     75    <Compile Include="Data.Osm.Core\RelationMember.cs" />
     76    <Compile Include="Data.Osm.Core\TagConstants.cs" />
     77    <Compile Include="Utilities\Utils.cs" />
     78    <Compile Include="Data.Osm.Core\Way.cs" />
    8379    <Compile Include="Plugin.cs" />
    8480    <Compile Include="Properties\AssemblyInfo.cs" />
     
    9086    <None Include="Properties\AssemblyInfo.cs.frame" />
    9187  </ItemGroup>
     88  <ItemGroup />
    9289  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    9390  <PropertyGroup>
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/RoutePlanningProblem.cs

    r8429 r8516  
    2727using HeuristicLab.Parameters;
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    29 using HeuristicLab.Problems.RoutePlanning.Graph;
    30 using HeuristicLab.Problems.RoutePlanning.Osm;
    31 using HeuristicLab.Problems.RoutePlanning.Osm.Data;
     29using HeuristicLab.Problems.RoutePlanning.Data.Osm;
     30using HeuristicLab.Problems.RoutePlanning.Interfaces;
    3231
    3332namespace HeuristicLab.Problems.RoutePlanning {
     
    4241
    4342    IDataSource dataSource;
    44     OsmGraph graph;
     43    IGraph graph;
    4544
    4645    #region Parameter Properties
     
    105104    public void LoadData(string file) {
    106105      FileInfo f = new FileInfo(file);
    107       dataSource = new XmlDataSource(file);
    108       graph = new OsmGraph(dataSource);
     106      dataSource = new OsmDataSource(file);
     107      graph = dataSource.GetRoutingGraph();
    109108
    110109      Name = f.Name;
Note: See TracChangeset for help on using the changeset viewer.