Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8314 for branches


Ignore:
Timestamp:
07/20/12 18:58:28 (12 years ago)
Author:
spimming
Message:

#1894:

  • error correction on Dijkstra algorithm
  • test program adapted
  • new test graph file added
Location:
branches/RoutePlanning
Files:
1 added
5 edited

Legend:

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

    r8312 r8314  
    9797      }
    9898      route.Add(current);
    99       while (!predecessors.TryGetValue(current, out next)) {
     99      while (predecessors.TryGetValue(current, out next)) {
    100100        current = predecessors[current];
    101101        route.Add(current);
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning.Test/HeuristicLab.Problems.RoutePlanning.Test.csproj

    r8293 r8314  
    5252    <None Include="OsmTestFiles\testRelation1.osm" />
    5353    <None Include="OsmTestFiles\testWay1.osm" />
     54    <None Include="OsmTestFiles\test_mid.osm" />
    5455  </ItemGroup>
    5556  <ItemGroup>
     57    <ProjectReference Include="..\HeuristicLab.Algorithms.GraphRouting\3.3\HeuristicLab.Algorithms.GraphRouting.csproj">
     58      <Project>{4FE72407-6CAA-4F41-9F2D-D45FDA19ED3C}</Project>
     59      <Name>HeuristicLab.Algorithms.GraphRouting</Name>
     60    </ProjectReference>
    5661    <ProjectReference Include="..\HeuristicLab.Problems.RoutePlanning\3.3\HeuristicLab.Problems.RoutePlanning.csproj">
    5762      <Project>{E93A30BD-D4C8-4DEC-8ECF-2BC3CD9F027B}</Project>
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning.Test/Program.cs

    r8301 r8314  
    11
     2using System;
     3using HeuristicLab.Algorithms.GraphRouting;
    24using HeuristicLab.Problems.RoutePlanning.Osm.Data;
    35namespace HeuristicLab.Problems.RoutePlanning.Test {
    46  class Program {
    57    static void Main(string[] args) {
    6       string filepath = @"..\..\OsmTestFiles\test.osm";
     8      Test1();
     9    }
     10
     11    private static void Test1() {
     12      string filepath = @"..\..\OsmTestFiles\test_mid.osm";
     13
     14      Console.Write("Loading data ... ");
     15      XmlDataSource xmlDs = new XmlDataSource(filepath);
     16      Console.WriteLine("done.");
     17
     18      Graph.Graph graph = new Graph.Graph(xmlDs);
     19      IRouter router = new DijkstraAlgorithm(graph);
     20
     21      Console.Write("Calculate route ... ");
     22      long[] result = router.Calculate(529102170, 1001363194);
     23      System.Console.WriteLine("done.");
     24
     25      Console.Write("Result: ");
     26      foreach (long i in result) System.Console.Write(i + "; ");
     27      Console.WriteLine();
     28      System.Console.Read();
     29    }
     30
     31    private static void Test2() {
     32      //string filepath = @"..\..\OsmTestFiles\test.osm";
    733      //string filepath = @"..\..\OsmTestFiles\testNode1.osm";
    834      //string filepath = @"..\..\OsmTestFiles\testWay1.osm";
    935      //string filepath = @"..\..\OsmTestFiles\testRelation1.osm";
     36      string filepath = @"..\..\OsmTestFiles\test_mid.osm";
     37
     38      Console.Write("Loading data ... ");
    1039      XmlDataSource xmlDs = new XmlDataSource(filepath);
    11       //xmlDs.ReadData();
     40      Console.WriteLine("done.");
     41
     42      Graph.Graph graph = new Graph.Graph(xmlDs);
     43      IRouter router = new DijkstraAlgorithm(graph);
     44
     45      Console.Write("Calculate route ... ");
     46      long[] result = router.Calculate(529102170, 1001363194);
     47      System.Console.WriteLine("done.");
     48
     49      Console.Write("Result: ");
     50      foreach (long i in result) System.Console.Write(i + "; ");
     51      Console.WriteLine();
     52      System.Console.Read();
    1253    }
    1354  }
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph/Graph.cs

    r8308 r8314  
    3535        foreach (Vertex<Node> neighbor in vertices) {
    3636          float weight = GetWeight(edge, vertex, neighbor);
    37           neighbors[neighbor.Id] = weight;
     37          neighbors[neighbor.Node.Id] = weight;
    3838        }
    3939      }
    40       return null;
     40      return neighbors;
    4141    }
    4242
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/HeuristicLab.Problems.RoutePlanning.csproj

    r8308 r8314  
    5959    <Compile Include="Graph\Graph.cs" />
    6060    <Compile Include="Graph\IEdge.cs" />
     61    <Compile Include="Graph\Route.cs" />
    6162    <Compile Include="Graph\Vertex.cs" />
    6263    <Compile Include="Osm.Data\XmlDataSource.cs" />
Note: See TracChangeset for help on using the changeset viewer.