Index: branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPVisualizationControl.cs
===================================================================
--- branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPVisualizationControl.cs	(revision 7268)
+++ branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPVisualizationControl.cs	(revision 7460)
@@ -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;
         }
