Index: /branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/OrienteeringProblem.cs
===================================================================
--- /branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/OrienteeringProblem.cs	(revision 11268)
+++ /branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/OrienteeringProblem.cs	(revision 11269)
@@ -172,12 +172,12 @@
       }
       ParameterizeSolutionCreator();
-      CalculateDistanceMatrix();
+      UpdateDistanceMatrix();
     }
     private void CoordinatesValue_ItemChanged(object sender, EventArgs<int, int> e) {
-      CalculateDistanceMatrix();
+      UpdateDistanceMatrix();
     }
     private void CoordinatesValue_Reset(object sender, EventArgs e) {
       ParameterizeSolutionCreator();
-      CalculateDistanceMatrix();
+      UpdateDistanceMatrix();
     }
     private void StartingPointParameter_ValueChanged(object sender, EventArgs e) {
@@ -295,18 +295,27 @@
     #endregion
 
-    private void CalculateDistanceMatrix() {
-      var distances = new double[Coordinates.Rows, Coordinates.Rows];
-      for (int i = 0; i < Coordinates.Rows; i++) {
-        for (int j = 0; j < Coordinates.Rows; j++) {
-          double distanceX = Math.Abs(Coordinates[i, 0] - Coordinates[j, 0]);
-          double distanceY = Math.Abs(Coordinates[i, 1] - Coordinates[j, 1]);
-          distances[i, j] = Math.Sqrt(Math.Pow(distanceX, 2) + Math.Pow(distanceY, 2));
+    private DistanceMatrix CalculateDistanceMatrix(double[,] coordinates) {
+      var distances = DistanceHelper.GetDistanceMatrix(DistanceMeasure.Euclidean, coordinates, null, coordinates.GetLength(0));
+
+      return new DistanceMatrix(distances);
+    }
+    private void UpdateDistanceMatrix() {
+      var coordinates = Coordinates;
+      int dimension = coordinates.Rows;
+      var distances = DistanceMatrix;
+      for (int i = 0; i < dimension - 1; i++) {
+        for (int j = i + 1; j < dimension; j++) {
+          double x1 = coordinates[i, 0];
+          double y1 = coordinates[i, 1];
+          double x2 = coordinates[j, 0];
+          double y2 = coordinates[j, 1];
+          distances[i, j] = Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
+          distances[j, i] = distances[i, j];
         }
       }
-      DistanceMatrix = new DistanceMatrix(distances);
     }
 
     private void InitializeInitialOrienteeringInstance() {
-      Coordinates = new DoubleMatrix(new double[21, 2] {
+      var coordinates = new double[21, 2] {
         {  4.60,  7.10 }, {  5.70, 11.40 }, {  4.40, 12.30 }, {  2.80, 14.30 }, {  3.20, 10.30 },
         {  3.50,  9.80 }, {  4.40,  8.40 }, {  7.80, 11.00 }, {  8.80,  9.80 }, {  7.70,  8.20 },
@@ -314,6 +323,7 @@
         { 14.10, 14.20 }, { 11.20, 13.60 }, {  9.70, 16.40 }, {  9.50, 18.80 }, {  4.70, 16.80 },
         {  5.00,  5.60 }
-      });
-      CalculateDistanceMatrix();
+      };
+      Coordinates = new DoubleMatrix(coordinates);
+      DistanceMatrix = CalculateDistanceMatrix(coordinates);
 
       StartingPoint.Value = 0;
@@ -338,16 +348,13 @@
 
       Coordinates = new DoubleMatrix(data.Coordinates);
-      if (data.Distances != null)
-        DistanceMatrix = new DistanceMatrix(data.Distances);
-      else
-        CalculateDistanceMatrix();
-
-      StartingPoint = new IntValue(0);// Depot is interpreted as start and endpoint (default)
-      TerminusPoint = new IntValue(0);
+      DistanceMatrix = data.Distances != null
+        ? new DistanceMatrix(data.Distances)
+        : CalculateDistanceMatrix(data.Coordinates);
+
+      StartingPoint = new IntValue(0); // Depot is interpreted as start point
+      TerminusPoint = new IntValue(0); // Last city is interpreted als end point
 
       MaximumDistance = new DoubleValue(data.Capacity * 2); // capacity is interpreted as max distance
       Scores = new DoubleArray(data.Demands); // demands are interpreted as scores
-
-
 
       OnReset();
