Changeset 8520 for branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/RoutingGraph/Graph.cs
- Timestamp:
- 08/22/12 19:14:33 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/RoutingGraph/Graph.cs
r8516 r8520 3 3 using System.Collections.Generic; 4 4 using HeuristicLab.Problems.RoutePlanning.Interfaces; 5 using HeuristicLab.Problems.RoutePlanning.Utilities;6 5 namespace HeuristicLab.Problems.RoutePlanning.RoutingGraph { 7 6 public class Graph : IGraph { … … 126 125 foreach (Edge<Vertex> edge in edges) { 127 126 // TODO: check if edge can be traversed (eg. highway tag for car roads, ...) 128 float weight = GetWeight(edge); // TODO: edge.Weight? 129 neighbors[edge.Target.Id] = weight; 127 //float weight = GetWeight(edge); // TODO: edge.Weight? 128 //neighbors[edge.Target.Id] = weight; 129 neighbors[edge.Target.Id] = edge.Weight; 130 130 } 131 131 return neighbors; … … 136 136 foreach (Edge<Vertex> edge in edges) { 137 137 // TODO: check if edge can be traversed (eg. highway tag for car roads, ...) 138 float weight = GetWeight(edge); // TODO: edge.Weight? 139 neighbors[edge.Source.Id] = weight; 138 //float weight = GetWeight(edge); // TODO: edge.Weight? 139 //neighbors[edge.Source.Id] = weight; 140 neighbors[edge.Source.Id] = edge.Weight; 140 141 } 141 142 return neighbors; 142 143 } 143 144 144 public float GetWeight(Edge<Vertex> edge) {145 //double distance = Utils.Distance(edge.Source.Logitude, edge.Source.Latitude,146 // edge.Target.Logitude, edge.Target.Latitude);145 //public float GetWeight(Edge<Vertex> edge) { 146 // //double distance = Utils.Distance(edge.Source.Logitude, edge.Source.Latitude, 147 // // edge.Target.Logitude, edge.Target.Latitude); 147 148 148 PointD s = new PointD(edge.Source.Logitude, edge.Source.Latitude);149 PointD t = new PointD(edge.Target.Logitude, edge.Target.Latitude);150 double distance = Utils.LocationDistance(s, t);149 // PointD s = new PointD(edge.Source.Logitude, edge.Source.Latitude); 150 // PointD t = new PointD(edge.Target.Logitude, edge.Target.Latitude); 151 // double distance = Utils.LocationDistance(s, t); 151 152 152 int speed = edge.GetMaxSpeed(); 153 double weight = (distance / speed) * 60; 154 //double weight = (distance / speed) * 3.6; 155 //double weight = (distance / speed); 156 //double weight = distance; 157 return (float)weight; 158 } 153 // //int speed = edge.GetMaxSpeed(); 154 // //double weight = (distance / speed) * 60; 155 // //double weight = (distance / speed) * 3.6; 156 // //double weight = (distance / speed); 157 // //double weight = distance; 158 // //return (float)weight; 159 // return (float)1; 160 //} 159 161 160 public float EstimatedCosts(long sourceId, long targetId) {161 Vertex source = GetVertex(sourceId);162 Vertex target = GetVertex(targetId);163 return EstimatedCosts(source, target);164 }162 //public float EstimatedCosts(long sourceId, long targetId) { 163 // Vertex source = GetVertex(sourceId); 164 // Vertex target = GetVertex(targetId); 165 // return EstimatedCosts(source, target); 166 //} 165 167 166 public float EstimatedCosts(Vertex source, Vertex target) {167 //double distance = Utils.Distance(source.Logitude, source.Latitude,168 // target.Logitude, target.Latitude);168 //public float EstimatedCosts(Vertex source, Vertex target) { 169 // //double distance = Utils.Distance(source.Logitude, source.Latitude, 170 // // target.Logitude, target.Latitude); 169 171 170 PointD s = new PointD(source.Logitude, source.Latitude);171 PointD t = new PointD(target.Logitude, target.Latitude);172 double distance = Utils.LocationDistance(s, t);172 // PointD s = new PointD(source.Logitude, source.Latitude); 173 // PointD t = new PointD(target.Logitude, target.Latitude); 174 // double distance = Utils.LocationDistance(s, t); 173 175 174 //int speed = 130;175 //int speed = 10;176 int speed = 130;177 double costs = (distance / speed) * 60;178 //double costs = (distance / speed) * 3.6;179 //double costs = (distance / speed);180 //double costs = distance;181 return (float)costs;182 }176 // //int speed = 130; 177 // //int speed = 10; 178 // int speed = 130; 179 // double costs = (distance / speed) * 60; 180 // //double costs = (distance / speed) * 3.6; 181 // //double costs = (distance / speed); 182 // //double costs = distance; 183 // return (float)costs; 184 //} 183 185 } 184 186 }
Note: See TracChangeset
for help on using the changeset viewer.