Index: /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/DIMACS/DIMACSDataSource.cs
===================================================================
--- /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/DIMACS/DIMACSDataSource.cs	(revision 8487)
+++ /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/DIMACS/DIMACSDataSource.cs	(revision 8488)
@@ -118,6 +118,8 @@
               Vertex vSrc = graph.GetVertex(src);
               Vertex vDst = graph.GetVertex(dst);
+
               Edge<Vertex> edge = new Edge<Vertex>(vSrc, vDst);
-              //TODO  len = weight
+              edge.Weight = len;
+
               graph.AddEdge(edge);
 
Index: /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph/EarthDistanceCostCalculator.cs
===================================================================
--- /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph/EarthDistanceCostCalculator.cs	(revision 8488)
+++ /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph/EarthDistanceCostCalculator.cs	(revision 8488)
@@ -0,0 +1,39 @@
+﻿using System;
+
+namespace HeuristicLab.Problems.RoutePlanning.Graph {
+  public class EarthDistanceCostCalculator : ICostCalculator {
+    private const double earthMeanRadius = 6371.0 * 1000.0;
+
+    #region ICostCalculator Members
+
+    public float Costs(Edge<Vertex> edge) {
+      return edge.Weight;
+    }
+
+    public float EstimatedCosts(Vertex source, Vertex destination) {
+      return (float)EarthDistance(source.Logitude, source.Latitude, destination.Logitude, destination.Latitude);
+    }
+
+    #endregion
+
+    private double DegToRad(double alpha) {
+      return alpha * Math.PI / 180;
+    }
+
+    private double AngularDistance(double startLon, double startLat, double endLon, double endLat) {
+      double lat1 = DegToRad(startLat);
+      double lat2 = DegToRad(endLat);
+      double long1 = DegToRad(startLon);
+      double long2 = DegToRad(endLat);
+
+      double x = Math.Sin(lat1) * Math.Sin(lat2) + Math.Cos(lat1) * Math.Cos(lat2) * Math.Cos(long1 - long2);
+      x = Math.Min(1, Math.Max(0, x));
+
+      return Math.Acos(x);
+    }
+
+    private double EarthDistance(double startLon, double startLat, double endLon, double endLat) {
+      return earthMeanRadius * AngularDistance(startLon, startLat, endLon, endLat);
+    }
+  }
+}
Index: /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph/Edge.cs
===================================================================
--- /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph/Edge.cs	(revision 8487)
+++ /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph/Edge.cs	(revision 8488)
@@ -16,4 +16,10 @@
       get { return category; }
       set { category = value; }
+    }
+
+    private float weight;
+    public float Weight {
+      get { return weight; }
+      set { weight = value; }
     }
 
Index: /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph/ICostCalculator.cs
===================================================================
--- /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph/ICostCalculator.cs	(revision 8488)
+++ /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph/ICostCalculator.cs	(revision 8488)
@@ -0,0 +1,7 @@
+﻿
+namespace HeuristicLab.Problems.RoutePlanning.Graph {
+  public interface ICostCalculator {
+    float Costs(Edge<Vertex> edge);
+    float EstimatedCosts(Vertex source, Vertex destination);
+  }
+}
Index: /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph/TravelTimeCostCalculator.cs
===================================================================
--- /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph/TravelTimeCostCalculator.cs	(revision 8488)
+++ /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Graph/TravelTimeCostCalculator.cs	(revision 8488)
@@ -0,0 +1,29 @@
+﻿
+using HeuristicLab.Problems.RoutePlanning.Osm;
+namespace HeuristicLab.Problems.RoutePlanning.Graph {
+  public class TravelTimeCostCalculator : ICostCalculator {
+    #region CostCalculator Members
+
+    public float Costs(Edge<Vertex> edge) {
+      double distance = Utils.Distance(edge.Source.Logitude, edge.Source.Latitude,
+                                       edge.Target.Logitude, edge.Target.Latitude);
+      //double distance = Utils.LocationDistance(source.Node.Point, target.Node.Point);
+      int speed = edge.GetMaxSpeed();
+      double weight = (distance / speed) * 3.6;
+      //double weight = (distance / speed);
+      return (float)weight;
+    }
+
+    public float EstimatedCosts(Vertex source, Vertex destination) {
+      double distance = Utils.Distance(source.Logitude, source.Latitude,
+                                       destination.Logitude, destination.Latitude);
+      //double distance = Utils.LocationDistance(source.Node.Point, target.Node.Point);
+      int speed = 130;
+      double costs = (distance / speed) * 3.6;
+      //double costs = (distance / speed);
+      return (float)costs;
+    }
+
+    #endregion
+  }
+}
Index: /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/HeuristicLab.Problems.RoutePlanning.csproj
===================================================================
--- /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/HeuristicLab.Problems.RoutePlanning.csproj	(revision 8487)
+++ /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/HeuristicLab.Problems.RoutePlanning.csproj	(revision 8488)
@@ -58,4 +58,6 @@
   <ItemGroup>
     <Compile Include="DIMACS\DIMACSDataSource.cs" />
+    <Compile Include="Graph\EarthDistanceCostCalculator.cs" />
+    <Compile Include="Graph\ICostCalculator.cs" />
     <Compile Include="Graph\Edge.cs" />
     <Compile Include="Graph\Graph.cs" />
@@ -65,5 +67,7 @@
     <Compile Include="Graph\OsmVertex.cs" />
     <Compile Include="Graph\Route.cs" />
+    <Compile Include="Graph\TravelTimeCostCalculator.cs" />
     <Compile Include="Graph\Vertex.cs" />
+    <Compile Include="Osm.Data\OsmDataSource.cs" />
     <Compile Include="Osm.Data\XmlDataSource.cs" />
     <Compile Include="Osm\IDataSource.cs" />
Index: /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Osm.Data/OsmDataSource.cs
===================================================================
--- /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Osm.Data/OsmDataSource.cs	(revision 8488)
+++ /branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Osm.Data/OsmDataSource.cs	(revision 8488)
@@ -0,0 +1,137 @@
+﻿using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Xml;
+using HeuristicLab.Problems.RoutePlanning.Graph;
+
+namespace HeuristicLab.Problems.RoutePlanning.Osm.Data {
+  public class OsmDataSource : IDataSource {
+    private FileInfo file;
+    private Dictionary<long, Vertex> vertices;
+    private IGraph graph;
+
+    public OsmDataSource(string filename) {
+      file = new FileInfo(filename);
+      graph = new Graph.Graph();
+      vertices = new Dictionary<long, Vertex>();
+
+      ReadData();
+    }
+
+    #region IDataSource Members
+
+    public Node GetNode(long nodeId) {
+      throw new NotImplementedException();
+    }
+
+    public Way GetWay(long wayId) {
+      throw new NotImplementedException();
+    }
+
+    public List<Way> GetWays(Node node) {
+      throw new NotImplementedException();
+    }
+
+    public Relation GetRelation(long relationId) {
+      throw new NotImplementedException();
+    }
+
+    public Graph.IGraph GetRoutingGraph() {
+      return graph;
+    }
+
+    #endregion
+
+    private Vertex GetVertex(long Id) {
+      Vertex v;
+      if (vertices.TryGetValue(Id, out v)) {
+        return v;
+      } else {
+        return null;
+      }
+    }
+
+    private void ReadData() {
+      XmlReaderSettings settings = new XmlReaderSettings();
+      settings.IgnoreComments = true;
+      settings.IgnoreWhitespace = true;
+
+      using (XmlReader reader = XmlReader.Create(file.FullName, settings)) {
+        reader.ReadStartElement("osm");
+        //reader.ReadStartElement("bounds");
+        reader.Read();
+        while (reader.LocalName.Equals("node")) {
+          double lat = XmlConvert.ToDouble(reader.GetAttribute("lat"));
+          double lon = XmlConvert.ToDouble(reader.GetAttribute("lon"));
+          long id = XmlConvert.ToInt64(reader.GetAttribute("id"));
+
+          Vertex v = new Vertex(id, lon, lat);
+          vertices.Add(v.Id, v);
+
+          reader.Read();
+          if (reader.LocalName.Equals("tag")) {
+            reader.ReadToFollowing("node");
+          }
+        }
+        while (reader.LocalName.Equals("way")) {
+          List<Vertex> way = new List<Vertex>();
+          bool missingNodes = false;
+          HighwayType category = HighwayType.null_type;
+          bool oneWayRoad = false;
+
+          reader.Read();
+          while (reader.LocalName.Equals("nd") || reader.LocalName.Equals("tag")) {
+            if (reader.LocalName.Equals("nd")) {
+              long refNodeId = XmlConvert.ToInt64(reader.GetAttribute("ref"));
+              Vertex vertex = GetVertex(refNodeId);
+              if (vertex != null) {
+                way.Add(vertex);
+              } else {
+                missingNodes = true;
+              }
+
+            } else if (reader.LocalName.Equals("tag")) {
+              string key = reader.GetAttribute("k");
+              string value = reader.GetAttribute("v");
+
+              if (key == TagConstants.HighwayTagKey) {
+                if (Enum.IsDefined(typeof(HighwayType), value)) {
+                  HighwayType ht = (HighwayType)Enum.Parse(typeof(HighwayType), value, true);
+                  category = ht;
+                } else {
+                  category = HighwayType.null_type;
+                }
+              } else if (key == TagConstants.OneWayTag) {
+                oneWayRoad = value.Equals(TagConstants.YesValue);
+              }
+            }
+            reader.Read();
+          }
+          if (missingNodes) {
+            // TODO: Error/Trace output 
+            // if Way xxx has incomplete nodes. At least one node was missing in the data.
+          }
+          for (int i = 0; i < way.Count - 1; i++) {
+            Vertex v1 = way[i];
+            graph.AddVertex(v1);
+            Vertex v2 = way[i + 1];
+            graph.AddVertex(v2);
+            short vertexCategory = (short)category;
+            if (oneWayRoad) {
+              Edge<Vertex> edge = new Edge<Vertex>(v1, v2, vertexCategory);
+              graph.AddEdge(edge);
+            } else {
+              Edge<Vertex> edgeForward = new Edge<Vertex>(v1, v2, vertexCategory);
+              graph.AddEdge(edgeForward);
+
+              Edge<Vertex> edgeBackward = new Edge<Vertex>(v2, v1, vertexCategory);
+              graph.AddEdge(edgeBackward);
+            }
+          }
+          reader.Read();
+        }
+        reader.Close();
+      }
+    }
+  }
+}
