Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8423


Ignore:
Timestamp:
08/07/12 10:52:01 (12 years ago)
Author:
spimming
Message:

#1894

  • bidirectional version of Dijkstra algorithm
  • method to get neighbors of a node in reversed order
  • check for roundabouts in OneWay property
Location:
branches/RoutePlanning
Files:
1 added
5 edited

Legend:

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

    r8408 r8423  
    5959    <Compile Include="AStarAlgorithm.cs" />
    6060    <Compile Include="AStarAlgorithmV2.cs" />
     61    <Compile Include="BidirectionalDijkstraAlgorithm.cs" />
    6162    <Compile Include="DijkstraAlgorithm.cs" />
    6263    <Compile Include="GraphRoutingAlgorithm.cs" />
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning.Test/Program.cs

    r8408 r8423  
    2626      //Test(file6, 529102170, 1001363194, true, false); // inz - inz
    2727
    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
     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
    3232
    3333      //TestLoadAndRouter(file6, typeof(DijkstraAlgorithm), 529102170, 31372732, false, false); // inz - hgb
    3434      //TestLoadAndRouter(file6, typeof(AStarAlgorithm), 529102170, 31372732, false, false); // inz - hgb
    3535      //TestLoadAndRouter(file6, typeof(AStarAlgorithmV2), 529102170, 31372732, false, false); // inz - hgb
     36
     37      //TestLoadAndRouter(file5, typeof(DijkstraAlgorithm), 529102170, 1001363194, true, false);
     38      //TestLoadAndRouter(file5, typeof(BidrectionalDijkstraAlgorithm), 529102170, 1001363194, true, true);
     39      TestLoadAndRouter(file6, typeof(BidrectionalDijkstraAlgorithm), 529102170, 31372732, false, true); // inz - hgb
    3640
    3741      System.Console.Read();
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph/Graph.cs

    r8408 r8423  
    3535        foreach (Vertex<Node> neighbor in vertices) {
    3636          if (edge.CanBeTraversed(vertex.Node, neighbor.Node)) {
     37            float weight = GetWeight(edge, vertex, neighbor);
     38            neighbors[neighbor.Node.Id] = weight;
     39          }
     40        }
     41      }
     42      return neighbors;
     43    }
     44
     45    public Dictionary<long, float> GetNeighborsReversed(long id) {
     46      Vertex<Node> vertex = GetVertex(id);
     47      Dictionary<long, float> neighbors = new Dictionary<long, float>();
     48      List<Way> edges = GetEdges(vertex);
     49      foreach (Way edge in edges) {
     50        List<Vertex<Node>> vertices = GetNeighborVerticesOnEdge(edge, vertex);
     51        foreach (Vertex<Node> neighbor in vertices) {
     52          if (edge.CanBeTraversed(neighbor.Node, vertex.Node)) {
    3753            float weight = GetWeight(edge, vertex, neighbor);
    3854            neighbors[neighbor.Node.Id] = weight;
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Osm/TagConstants.cs

    r8369 r8423  
    33  public class TagConstants {
    44    public const string HighwayTagKey = "highway";
     5    public const string JunctionTagKey = "junction";
    56    public const string OneWayTag = "oneway";
     7    public const string RoundaboutValue = "roundabout";
    68    public const string YesValue = "yes";
     9    public const string TrueValue = "true";
    710  }
    811}
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Osm/Way.cs

    r8408 r8423  
    7373        if (base.Tags.ContainsKey(TagConstants.OneWayTag)) {
    7474          string value = base.Tags[TagConstants.OneWayTag];
    75           return value.Equals(TagConstants.YesValue);
     75          return value.Equals(TagConstants.YesValue) || value.Equals(TagConstants.TrueValue);
     76        } else if (base.Tags.ContainsKey(TagConstants.JunctionTagKey)) {
     77          string value = base.Tags[TagConstants.JunctionTagKey];
     78          return value.Equals(TagConstants.RoundaboutValue);
    7679        } else {
    7780          return false;
Note: See TracChangeset for help on using the changeset viewer.