Index: trunk/sources/HeuristicLab.Analysis/3.3/MultidimensionalScaling/MultidimensionalScaling.cs
===================================================================
--- trunk/sources/HeuristicLab.Analysis/3.3/MultidimensionalScaling/MultidimensionalScaling.cs	(revision 7410)
+++ trunk/sources/HeuristicLab.Analysis/3.3/MultidimensionalScaling/MultidimensionalScaling.cs	(revision 7416)
@@ -103,8 +103,10 @@
     private static void StressFitness(double[] x, double[] fi, object obj) {
       Info info = (obj as Info);
+      int idx = 0;
       for (int i = 0; i < info.Coordinates.Rows; i++) {
-        double f = Stress(x, info.Dissimilarities[info.Row, i], info.Coordinates[i, 0], info.Coordinates[i, 1]);
-        if (i < info.Row) fi[i] = f;
-        else if (i > info.Row) fi[i - 1] = f;
+        if (i == info.Row) continue;
+        if (!double.IsNaN(info.Dissimilarities[info.Row, i]))
+          fi[idx++] = Stress(x, info.Dissimilarities[info.Row, i], info.Coordinates[i, 0], info.Coordinates[i, 1]);
+        else fi[idx++] = 0.0;
       }
     }
@@ -114,14 +116,16 @@
       int idx = 0;
       for (int i = 0; i < info.Coordinates.Rows; i++) {
-        if (i != info.Row) {
-          double c = info.Dissimilarities[info.Row, i];
-          double a = info.Coordinates[i, 0];
-          double b = info.Coordinates[i, 1];
-          double f = Stress(x, c, a, b);
-          fi[idx] = f;
+        if (i == info.Row) continue;
+        double c = info.Dissimilarities[info.Row, i];
+        double a = info.Coordinates[i, 0];
+        double b = info.Coordinates[i, 1];
+        if (!double.IsNaN(c)) {
+          fi[idx] = Stress(x, c, a, b); ;
           jac[idx, 0] = 2 * (x[0] - a) * (Math.Sqrt((a - x[0]) * (a - x[0]) + (b - x[1]) * (b - x[1])) - c) / Math.Sqrt((a - x[0]) * (a - x[0]) + (b - x[1]) * (b - x[1]));
           jac[idx, 1] = 2 * (x[1] - b) * (Math.Sqrt((a - x[0]) * (a - x[0]) + (b - x[1]) * (b - x[1])) - c) / Math.Sqrt((a - x[0]) * (a - x[0]) + (b - x[1]) * (b - x[1]));
-          idx++;
+        } else {
+          fi[idx] = jac[idx, 0] = jac[idx, 1] = 0;
         }
+        idx++;
       }
     }
@@ -153,6 +157,7 @@
       for (int i = 0; i < dimension - 1; i++) {
         for (int j = i + 1; j < dimension; j++) {
-          if (dissimilarities[i, j] != dissimilarities[j, i]) throw new ArgumentException("Dissimilarities is not a symmetric matrix.", "dissimilarities");
-          if (dissimilarities[i, j] != 0) {
+          if (dissimilarities[i, j] != dissimilarities[j, i] && !(double.IsNaN(dissimilarities[i, j]) && double.IsNaN(dissimilarities[j, i])))
+            throw new ArgumentException("Dissimilarities is not a symmetric matrix.", "dissimilarities");
+          if (!double.IsNaN(dissimilarities[i, j])) {
             stress += Stress(coordinates[i, 0], coordinates[i, 1], dissimilarities[i, j], coordinates[j, 0], coordinates[j, 1]);
             normalization += (dissimilarities[i, j] * dissimilarities[i, j]);
Index: trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPVisualizationControl.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPVisualizationControl.cs	(revision 7410)
+++ trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPVisualizationControl.cs	(revision 7416)
@@ -205,7 +205,8 @@
         Bitmap newBitmap = null;
         stressLabel.Text = "-";
+        stressLabel.ForeColor = Color.Black;
         if (distancesRadioButton.Checked && Distances != null && Distances.Rows > 0
           && Distances.Rows == Distances.Columns) {
-          if (Distances.Rows > 35) {
+          if (Distances.Rows > 50) {
             newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
             WriteCenteredTextToBitmap(ref newBitmap, "Problem dimension is too large for visualization.");
@@ -214,5 +215,5 @@
         } else if (weightsRadioButton.Checked && Weights != null && Weights.Rows > 0
           && Weights.Rows == Weights.Columns) {
-          if (Weights.Rows > 35) {
+          if (Weights.Rows > 50) {
             newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
             WriteCenteredTextToBitmap(ref newBitmap, "Problem dimension is too large for visualization.");
@@ -228,5 +229,5 @@
           && Assignment.Length == Distances.Rows
           && Assignment.Validate()) {
-          if (Assignment.Length > 35) {
+          if (Assignment.Length > 50) {
             newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
             WriteCenteredTextToBitmap(ref newBitmap, "Problem dimension is too large for visualization.");
@@ -249,4 +250,5 @@
         Bitmap newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
         stressLabel.Text = "-";
+        stressLabel.ForeColor = Color.Black;
         WriteCenteredTextToBitmap(ref newBitmap, "Please refresh view.");
         showingMessage = false; // we're showing a message, but we should be showing the visualization, so this is false
@@ -270,8 +272,12 @@
           stress = MultidimensionalScaling.CalculateNormalizedStress(distances, coordinates);
           stressLabel.Text = stress.ToString("0.00", CultureInfo.CurrentCulture.NumberFormat);
+          if (stress < 0.1) stressLabel.ForeColor = Color.DarkGreen;
+          else if (stress < 0.2) stressLabel.ForeColor = Color.DarkOrange;
+          else stressLabel.ForeColor = Color.DarkRed;
         } catch {
           WriteCenteredTextToBitmap(ref newBitmap, "Distance matrix is not symmetric");
           showingMessage = true;
           stressLabel.Text = "-";
+          stressLabel.ForeColor = Color.Black;
           return newBitmap;
         }
@@ -349,6 +355,6 @@
         for (int i = 0; i < weights.Rows; i++)
           for (int j = i + 1; j < weights.Rows; j++) {
-            if (weights[i, j] > maxWeight)
-              maxWeight = weights[i, j] + weights[j, i];
+            if (weights[i, j] > maxWeight) maxWeight = weights[i, j];
+            if (weights[j, i] > maxWeight) maxWeight = weights[j, i];
           }
 
@@ -356,5 +362,6 @@
         for (int i = 0; i < distances.Rows; i++)
           for (int j = 0; j < distances.Columns; j++) {
-            distances[i, j] = maxWeight + 1 - weights[i, j];
+            if (weights[i, j] == 0) distances[i, j] = double.NaN;
+            else distances[i, j] = maxWeight / weights[i, j];
           }
 
@@ -365,8 +372,12 @@
           stress = MultidimensionalScaling.CalculateNormalizedStress(distances, coordinates);
           stressLabel.Text = stress.ToString("0.00", CultureInfo.CurrentCulture.NumberFormat);
+          if (stress < 0.1) stressLabel.ForeColor = Color.DarkGreen;
+          else if (stress < 0.2) stressLabel.ForeColor = Color.DarkOrange;
+          else stressLabel.ForeColor = Color.DarkRed;
         } catch {
           WriteCenteredTextToBitmap(ref newBitmap, "Weights matrix is not symmetric");
           showingMessage = true;
           stressLabel.Text = "-";
+          stressLabel.ForeColor = Color.Black;
           return newBitmap;
         }
@@ -454,8 +465,12 @@
           stress = MultidimensionalScaling.CalculateNormalizedStress(distances, coordinates);
           stressLabel.Text = stress.ToString("0.00", CultureInfo.CurrentCulture.NumberFormat);
+          if (stress < 0.1) stressLabel.ForeColor = Color.DarkGreen;
+          else if (stress < 0.2) stressLabel.ForeColor = Color.DarkOrange;
+          else stressLabel.ForeColor = Color.DarkRed;
         } catch {
           WriteCenteredTextToBitmap(ref newBitmap, "Unknown error");
           showingMessage = true;
           stressLabel.Text = "-";
+          stressLabel.ForeColor = Color.Black;
           return newBitmap;
         }
Index: trunk/sources/HeuristicLab.Problems.QuadraticAssignment/3.3/Data/els19.dat
===================================================================
--- trunk/sources/HeuristicLab.Problems.QuadraticAssignment/3.3/Data/els19.dat	(revision 7410)
+++ trunk/sources/HeuristicLab.Problems.QuadraticAssignment/3.3/Data/els19.dat	(revision 7416)
@@ -1,23 +1,3 @@
 19
-
-  0  12  36  28  52  44 110 126  94  63 130 102  65  98 132 132 126 120 126
- 12   0  24  75  82  75 108  70 124  86  93 106  58 124 161 161  70  64  70
- 36  24   0  47  71  47 110  73 126  71  95 110  46 127 163 163  73  67  73
- 28  75  47   0  42  34 148 111 160  52  94 148  49 117 104 109 111 105 111
- 52  82  71  42   0  42 125 136 102  22  73 125  32  94 130 130 136 130 136
- 44  75  47  34  42   0 148 111 162  52  96 148  49 117 152 152 111 105 111
-110 108 110 148 125 148   0  46  46 136  47  30 108  51  79  79  46  47  41
-126  70  73 111 136 111  46   0  69 141  63  46 119  68 121 121  27  24  36
- 94 124 126 160 102 162  46  69   0 102  34  45  84  23  80  80  69  64  51
- 63  86  71  52  22  52 136 141 102   0  64 118  29  95 131 131 141 135 141
-130  93  95  94  73  96  47  63  34  64   0  47  56  54  94  94  63  46  24
-102 106 110 148 125 148  30  46  45 118  47   0 100  51  89  89  46  40  36
- 65  58  46  49  32  49 108 119  84  29  56 100   0  77 113 113 119 113 119
- 98 124 127 117  94 117  51  68  23  95  54  51  77   0  79  79  68  62  51
-132 161 163 104 130 152  79 121  80 131  94  89 113  79   0  10 113 107 119
-132 161 163 109 130 152  79 121  80 131  94  89 113  79  10   0 113 107 119 
-126  70  73 111 136 111  46  27  69 141  63  46 119  68 113 113   0   6  24
-120  64  67 105 130 105  47  24  64 135  46  40 113  62 107 107   6   0  12
-126  70  73 111 136 111  41  36  51 141  24  36 119  51 119 119  24  12   0
 
     0 76687     0   415   545   819   135  1368   819  5630
@@ -59,2 +39,22 @@
  1783     0     0     0     0     0     0     0     0     0
     0     0     0     0     0     0     0     0     0
+
+  0  12  36  28  52  44 110 126  94  63 130 102  65  98 132 132 126 120 126
+ 12   0  24  75  82  75 108  70 124  86  93 106  58 124 161 161  70  64  70
+ 36  24   0  47  71  47 110  73 126  71  95 110  46 127 163 163  73  67  73
+ 28  75  47   0  42  34 148 111 160  52  94 148  49 117 104 109 111 105 111
+ 52  82  71  42   0  42 125 136 102  22  73 125  32  94 130 130 136 130 136
+ 44  75  47  34  42   0 148 111 162  52  96 148  49 117 152 152 111 105 111
+110 108 110 148 125 148   0  46  46 136  47  30 108  51  79  79  46  47  41
+126  70  73 111 136 111  46   0  69 141  63  46 119  68 121 121  27  24  36
+ 94 124 126 160 102 162  46  69   0 102  34  45  84  23  80  80  69  64  51
+ 63  86  71  52  22  52 136 141 102   0  64 118  29  95 131 131 141 135 141
+130  93  95  94  73  96  47  63  34  64   0  47  56  54  94  94  63  46  24
+102 106 110 148 125 148  30  46  45 118  47   0 100  51  89  89  46  40  36
+ 65  58  46  49  32  49 108 119  84  29  56 100   0  77 113 113 119 113 119
+ 98 124 127 117  94 117  51  68  23  95  54  51  77   0  79  79  68  62  51
+132 161 163 104 130 152  79 121  80 131  94  89 113  79   0  10 113 107 119
+132 161 163 109 130 152  79 121  80 131  94  89 113  79  10   0 113 107 119 
+126  70  73 111 136 111  46  27  69 141  63  46 119  68 113 113   0   6  24
+120  64  67 105 130 105  47  24  64 135  46  40 113  62 107 107   6   0  12
+126  70  73 111 136 111  41  36  51 141  24  36 119  51 119 119  24  12   0
