Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/24/12 17:41:24 (12 years ago)
Author:
spimming
Message:

#1894: initial version of astar algorithm

Location:
branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph/Graph.cs

    r8314 r8321  
    117117      return (float)weight;
    118118    }
     119
     120    public float EstimatedCosts(long sourceId, long targetId) {
     121      Vertex<Node> source = GetVertex(sourceId);
     122      Vertex<Node> target = GetVertex(targetId);
     123      return EstimatedCosts(source, target);
     124    }
     125
     126    public float EstimatedCosts(Vertex<Node> source, Vertex<Node> target) {
     127      double distance = Utils.Distance(source.Node.Point, target.Node.Point);
     128      int speed = 130;
     129      double costs = (distance / speed) * 3.6;
     130      return (float)costs;
     131    }
    119132  }
    120133}
Note: See TracChangeset for help on using the changeset viewer.