Index: branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/HeuristicLab.Problems.QuadraticAssignment.Views-3.3.csproj
===================================================================
--- branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/HeuristicLab.Problems.QuadraticAssignment.Views-3.3.csproj	(revision 7752)
+++ branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/HeuristicLab.Problems.QuadraticAssignment.Views-3.3.csproj	(revision 7752)
@@ -0,0 +1,272 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{997F018D-AEA2-4F21-9301-82FAF6A5612D}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.Problems.QuadraticAssignment.Views</RootNamespace>
+    <AssemblyName>HeuristicLab.Problems.QuadraticAssignment.Views-3.3</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup>
+    <SignAssembly>true</SignAssembly>
+  </PropertyGroup>
+  <PropertyGroup>
+    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisLogFile>bin\Debug\Plugin.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+    <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
+    <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+    <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisLogFile>$(SolutionDir)\bin\Plugin.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+    <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+    <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <CodeAnalysisLogFile>bin\Debug\Plugin.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+    <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
+    <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+    <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+    <OutputPath>$(SolutionDir)\bin\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <CodeAnalysisLogFile>$(SolutionDir)\bin\Plugin.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+    <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
+    <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+    <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
+    <CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Views-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.ServiceModel" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Windows.Forms.DataVisualization" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="QAPAssignmentView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="QAPAssignmentView.Designer.cs">
+      <DependentUpon>QAPAssignmentView.cs</DependentUpon>
+    </Compile>
+    <Compile Include="QAPVisualizationControl.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="QAPVisualizationControl.Designer.cs">
+      <DependentUpon>QAPVisualizationControl.cs</DependentUpon>
+    </Compile>
+    <Compile Include="QuadraticAssignmentProblemView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="QuadraticAssignmentProblemView.Designer.cs">
+      <DependentUpon>QuadraticAssignmentProblemView.cs</DependentUpon>
+    </Compile>
+    <None Include="Plugin.cs.frame" />
+    <Compile Include="Plugin.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <None Include="Properties\AssemblyInfo.cs.frame" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="HeuristicLab.snk" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
+      <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
+      <Name>HeuristicLab.Analysis-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
+      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
+      <Name>HeuristicLab.Collections-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj">
+      <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project>
+      <Name>HeuristicLab.Common.Resources-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
+      <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
+      <Name>HeuristicLab.Common-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Core.Views\3.3\HeuristicLab.Core.Views-3.3.csproj">
+      <Project>{E226881D-315F-423D-B419-A766FE0D8685}</Project>
+      <Name>HeuristicLab.Core.Views-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
+      <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
+      <Name>HeuristicLab.Core-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Data.Views\3.3\HeuristicLab.Data.Views-3.3.csproj">
+      <Project>{72104A0B-90E7-42F3-9ABE-9BBBADD4B943}</Project>
+      <Name>HeuristicLab.Data.Views-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
+      <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
+      <Name>HeuristicLab.Data-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Encodings.PermutationEncoding\3.3\HeuristicLab.Encodings.PermutationEncoding-3.3.csproj">
+      <Project>{DBECB8B0-B166-4133-BAF1-ED67C3FD7FCA}</Project>
+      <Name>HeuristicLab.Encodings.PermutationEncoding-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.3\HeuristicLab.MainForm.WindowsForms-3.3.csproj">
+      <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project>
+      <Name>HeuristicLab.MainForm.WindowsForms-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.MainForm\3.3\HeuristicLab.MainForm-3.3.csproj">
+      <Project>{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}</Project>
+      <Name>HeuristicLab.MainForm-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj">
+      <Project>{662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}</Project>
+      <Name>HeuristicLab.Optimization.Views-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
+      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
+      <Name>HeuristicLab.Optimization-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
+      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
+      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views-3.4.csproj">
+      <Project>{BF1E4DF4-A4CC-451F-9D50-303F405E265E}</Project>
+      <Name>HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views-3.4</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj">
+      <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project>
+      <Name>HeuristicLab.Problems.Instances-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Problems.QuadraticAssignment\3.3\HeuristicLab.Problems.QuadraticAssignment-3.3.csproj">
+      <Project>{79271BC8-4446-40E2-BB89-9BE4E17174FE}</Project>
+      <Name>HeuristicLab.Problems.QuadraticAssignment-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.Visualization.ChartControlsExtensions\3.3\HeuristicLab.Visualization.ChartControlsExtensions-3.3.csproj">
+      <Project>{315BDA09-3F4F-49B3-9790-B37CFC1C5750}</Project>
+      <Name>HeuristicLab.Visualization.ChartControlsExtensions-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd
+SubWCRev "%25ProjectDir%25\" "%25ProjectDir%25\Plugin.cs.frame" "%25ProjectDir%25\Plugin.cs"
+</PreBuildEvent>
+  </PropertyGroup>
+  <PropertyGroup>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
Index: branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/MultidimensionalScaling.cs
===================================================================
--- branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/MultidimensionalScaling.cs	(revision 7752)
+++ branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/MultidimensionalScaling.cs	(revision 7752)
@@ -0,0 +1,130 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Problems.QuadraticAssignment.Views {
+  public static class MultidimensionalScaling {
+
+    /// <summary>
+    /// Performs the Kruskal-Shepard algorithm and applies a gradient descent method
+    /// to fit the coordinates such that the difference between the fit distances
+    /// and the actual distances is minimal.
+    /// </summary>
+    /// <param name="distances">A symmetric NxN matrix that specifies the distances between each element i and j. Diagonal elements are ignored.</param>
+    /// <param name="stress">Returns the stress between the fit distances and the actual distances.</param>
+    /// <returns>A Nx2 matrix where the first column represents the x- and the second column the y coordinates.</returns>
+    public static DoubleMatrix MetricByDistance(DoubleMatrix distances, out double stress) {
+      if (distances == null) throw new ArgumentNullException("distances");
+      if (distances.Rows != distances.Columns) throw new ArgumentException("Distance matrix must be a square matrix.", "distances");
+      stress = 0.0;
+
+      int dimension = distances.Rows;
+      if (dimension == 1) return new DoubleMatrix(new double[,] { { 0, 0 } });
+      else if (dimension == 2) return new DoubleMatrix(new double[,] { { 0, distances[0, 1] } });
+
+      DoubleMatrix coordinates = new DoubleMatrix(dimension, 2);
+      double rad = (2 * Math.PI) / coordinates.Rows;
+      for (int i = 0; i < dimension; i++) {
+        coordinates[i, 0] = 10 * Math.Cos(rad * i);
+        coordinates[i, 1] = 10 * Math.Sin(rad * i);
+      }
+
+      double epsg = 1e-7;
+      double epsf = 0;
+      double epsx = 0;
+      int maxits = 0;
+      alglib.mincgstate state = null;
+      alglib.mincgreport rep;
+
+      for (int iterations = 0; iterations < 10; iterations++) {
+        for (int i = 0; i < dimension; i++) {
+          double[] c = new double[] { coordinates[i, 0], coordinates[i, 1] };
+
+          if (iterations == 0 && i == 0) {
+            alglib.mincgcreate(c, out state);
+            alglib.mincgsetcond(state, epsg, epsf, epsx, maxits);
+          } else {
+            alglib.mincgrestartfrom(state, c);
+          }
+          alglib.mincgoptimize(state, StressGradient, null, new Info(coordinates, distances, i));
+          alglib.mincgresults(state, out c, out rep);
+
+          coordinates[i, 0] = c[0];
+          coordinates[i, 1] = c[1];
+        }
+      }
+      stress = CalculateNormalizedStress(dimension, distances, coordinates);
+      return coordinates;
+    }
+
+    private static void StressGradient(double[] x, ref double func, double[] grad, object obj) {
+      func = 0; grad[0] = 0; grad[1] = 0;
+      Info info = (obj as Info);
+      for (int i = 0; i < info.Coordinates.Rows; i++) {
+        double c = info.Distances[info.Row, i];
+        if (i != info.Row) {
+          double a = info.Coordinates[i, 0];
+          double b = info.Coordinates[i, 1];
+          func += Stress(x, c, a, b);
+          grad[0] += ((2 * x[0] - 2 * a) * Math.Sqrt(x[1] * x[1] - 2 * b * x[1] + x[0] * x[0] - 2 * a * x[0] + b * b + a * a) - 2 * c * x[0] + 2 * a * c) / Math.Sqrt(x[1] * x[1] - 2 * b * x[1] + x[0] * x[0] - 2 * a * x[0] + b * b + a * a);
+          grad[1] += ((2 * x[1] - 2 * b) * Math.Sqrt(x[1] * x[1] - 2 * b * x[1] + x[0] * x[0] - 2 * a * x[0] + b * b + a * a) - 2 * c * x[1] + 2 * b * c) / Math.Sqrt(x[1] * x[1] - 2 * b * x[1] + x[0] * x[0] - 2 * a * x[0] + b * b + a * a);
+        }
+      }
+    }
+
+    private static double Stress(double[] x, double distance, double xCoord, double yCoord) {
+      return Stress(x[0], x[1], distance, xCoord, yCoord);
+    }
+
+    private static double Stress(double x, double y, double distance, double otherX, double otherY) {
+      double d = Math.Sqrt((x - otherX) * (x - otherX)
+                         + (y - otherY) * (y - otherY));
+      return (d - distance) * (d - distance);
+    }
+
+    public static double CalculateNormalizedStress(int dimension, DoubleMatrix distances, DoubleMatrix coordinates) {
+      double stress = 0;
+      for (int i = 0; i < dimension - 1; i++) {
+        for (int j = i + 1; j < dimension; j++) {
+          if (distances[i, j] != 0) {
+            stress += Stress(coordinates[i, 0], coordinates[i, 1], distances[i, j], coordinates[j, 0], coordinates[j, 1])
+              / (distances[i, j] * distances[i, j]);
+          }
+        }
+      }
+      return stress;
+    }
+
+    private class Info {
+      public DoubleMatrix Coordinates { get; set; }
+      public DoubleMatrix Distances { get; set; }
+      public int Row { get; set; }
+
+      public Info(DoubleMatrix c, DoubleMatrix d, int r) {
+        Coordinates = c;
+        Distances = d;
+        Row = r;
+      }
+    }
+  }
+}
Index: branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/Plugin.cs.frame
===================================================================
--- branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/Plugin.cs.frame	(revision 7752)
+++ branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/Plugin.cs.frame	(revision 7752)
@@ -0,0 +1,41 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Problems.QuadraticAssignment.Views {
+  [Plugin("HeuristicLab.Problems.QuadraticAssignment.Views", "3.3.6.$WCREV$")]
+  [PluginFile("HeuristicLab.Problems.QuadraticAssignment.Views-3.3.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.Analysis", "3.3")]
+  [PluginDependency("HeuristicLab.Common", "3.3")]
+  [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
+  [PluginDependency("HeuristicLab.Core", "3.3")]
+  [PluginDependency("HeuristicLab.Core.Views", "3.3")]
+  [PluginDependency("HeuristicLab.Data", "3.3")]
+  [PluginDependency("HeuristicLab.Encodings.PermutationEncoding", "3.3")]
+  [PluginDependency("HeuristicLab.MainForm", "3.3")]
+  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
+  [PluginDependency("HeuristicLab.Optimization", "3.3")]
+  [PluginDependency("HeuristicLab.Optimization.Views", "3.3")]
+  [PluginDependency("HeuristicLab.Problems.QuadraticAssignment", "3.3")]
+  public class HeuristicLabProblemsQuadraticAssignmentViewsPlugin : PluginBase {
+  }
+}
Index: branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/Properties/AssemblyInfo.cs.frame
===================================================================
--- branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/Properties/AssemblyInfo.cs.frame	(revision 7752)
+++ branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/Properties/AssemblyInfo.cs.frame	(revision 7752)
@@ -0,0 +1,57 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.Problems.QuadraticAssignment.Views")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("HEAL")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(c) 2002-2012 HEAL")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7c14407e-6980-465b-ba3a-4a916d48989b")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("3.3.0.0")]
+[assembly: AssemblyFileVersion("3.3.6.$WCREV$")]
Index: branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPAssignmentView.Designer.cs
===================================================================
--- branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPAssignmentView.Designer.cs	(revision 7752)
+++ branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPAssignmentView.Designer.cs	(revision 7752)
@@ -0,0 +1,224 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+namespace HeuristicLab.Problems.QuadraticAssignment.Views {
+  partial class QAPAssignmentView {
+    /// <summary> 
+    /// Required designer variable.
+    /// </summary>
+    private System.ComponentModel.IContainer components = null;
+
+    /// <summary> 
+    /// Clean up any resources being used.
+    /// </summary>
+    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+    protected override void Dispose(bool disposing) {
+      if (disposing && (components != null)) {
+        components.Dispose();
+      }
+      base.Dispose(disposing);
+    }
+
+    #region Component Designer generated code
+
+    /// <summary> 
+    /// Required method for Designer support - do not modify 
+    /// the contents of this method with the code editor.
+    /// </summary>
+    private void InitializeComponent() {
+      this.splitContainer = new System.Windows.Forms.SplitContainer();
+      this.qualityGroupBox = new System.Windows.Forms.GroupBox();
+      this.qualityViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
+      this.tabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl();
+      this.visualizationTabPage = new System.Windows.Forms.TabPage();
+      this.valueTabPage = new System.Windows.Forms.TabPage();
+      this.assignmentGroupBox = new System.Windows.Forms.GroupBox();
+      this.assignmentViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
+      this.qapView = new HeuristicLab.Problems.QuadraticAssignment.Views.QAPVisualizationControl();
+      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
+      this.splitContainer.Panel1.SuspendLayout();
+      this.splitContainer.Panel2.SuspendLayout();
+      this.splitContainer.SuspendLayout();
+      this.qualityGroupBox.SuspendLayout();
+      this.tabControl.SuspendLayout();
+      this.visualizationTabPage.SuspendLayout();
+      this.valueTabPage.SuspendLayout();
+      this.assignmentGroupBox.SuspendLayout();
+      this.SuspendLayout();
+      // 
+      // splitContainer
+      // 
+      this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.splitContainer.Location = new System.Drawing.Point(0, 0);
+      this.splitContainer.Name = "splitContainer";
+      this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
+      // 
+      // splitContainer.Panel1
+      // 
+      this.splitContainer.Panel1.Controls.Add(this.qualityGroupBox);
+      // 
+      // splitContainer.Panel2
+      // 
+      this.splitContainer.Panel2.Controls.Add(this.tabControl);
+      this.splitContainer.Size = new System.Drawing.Size(536, 378);
+      this.splitContainer.SplitterDistance = 64;
+      this.splitContainer.TabIndex = 1;
+      // 
+      // qualityGroupBox
+      // 
+      this.qualityGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+                  | System.Windows.Forms.AnchorStyles.Left)
+                  | System.Windows.Forms.AnchorStyles.Right)));
+      this.qualityGroupBox.Controls.Add(this.qualityViewHost);
+      this.qualityGroupBox.Location = new System.Drawing.Point(0, 0);
+      this.qualityGroupBox.Name = "qualityGroupBox";
+      this.qualityGroupBox.Size = new System.Drawing.Size(536, 61);
+      this.qualityGroupBox.TabIndex = 0;
+      this.qualityGroupBox.TabStop = false;
+      this.qualityGroupBox.Text = "Quality";
+      // 
+      // qualityViewHost
+      // 
+      this.qualityViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+                  | System.Windows.Forms.AnchorStyles.Left)
+                  | System.Windows.Forms.AnchorStyles.Right)));
+      this.qualityViewHost.Caption = "View";
+      this.qualityViewHost.Content = null;
+      this.qualityViewHost.Enabled = false;
+      this.qualityViewHost.Location = new System.Drawing.Point(6, 19);
+      this.qualityViewHost.Name = "qualityViewHost";
+      this.qualityViewHost.ReadOnly = false;
+      this.qualityViewHost.Size = new System.Drawing.Size(524, 36);
+      this.qualityViewHost.TabIndex = 0;
+      this.qualityViewHost.ViewsLabelVisible = true;
+      this.qualityViewHost.ViewType = null;
+      // 
+      // tabControl
+      // 
+      this.tabControl.AllowDrop = true;
+      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+                  | System.Windows.Forms.AnchorStyles.Left)
+                  | System.Windows.Forms.AnchorStyles.Right)));
+      this.tabControl.Controls.Add(this.visualizationTabPage);
+      this.tabControl.Controls.Add(this.valueTabPage);
+      this.tabControl.Location = new System.Drawing.Point(0, 3);
+      this.tabControl.Name = "tabControl";
+      this.tabControl.SelectedIndex = 0;
+      this.tabControl.Size = new System.Drawing.Size(536, 307);
+      this.tabControl.TabIndex = 0;
+      // 
+      // visualizationTabPage
+      // 
+      this.visualizationTabPage.Controls.Add(this.qapView);
+      this.visualizationTabPage.Location = new System.Drawing.Point(4, 22);
+      this.visualizationTabPage.Name = "visualizationTabPage";
+      this.visualizationTabPage.Padding = new System.Windows.Forms.Padding(3);
+      this.visualizationTabPage.Size = new System.Drawing.Size(528, 281);
+      this.visualizationTabPage.TabIndex = 0;
+      this.visualizationTabPage.Text = "Visualization";
+      this.visualizationTabPage.UseVisualStyleBackColor = true;
+      // 
+      // valueTabPage
+      // 
+      this.valueTabPage.Controls.Add(this.assignmentGroupBox);
+      this.valueTabPage.Location = new System.Drawing.Point(4, 22);
+      this.valueTabPage.Name = "valueTabPage";
+      this.valueTabPage.Padding = new System.Windows.Forms.Padding(3);
+      this.valueTabPage.Size = new System.Drawing.Size(528, 281);
+      this.valueTabPage.TabIndex = 1;
+      this.valueTabPage.Text = "Value";
+      this.valueTabPage.UseVisualStyleBackColor = true;
+      // 
+      // assignmentGroupBox
+      // 
+      this.assignmentGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+                  | System.Windows.Forms.AnchorStyles.Left)
+                  | System.Windows.Forms.AnchorStyles.Right)));
+      this.assignmentGroupBox.Controls.Add(this.assignmentViewHost);
+      this.assignmentGroupBox.Location = new System.Drawing.Point(6, 6);
+      this.assignmentGroupBox.Name = "assignmentGroupBox";
+      this.assignmentGroupBox.Size = new System.Drawing.Size(516, 269);
+      this.assignmentGroupBox.TabIndex = 0;
+      this.assignmentGroupBox.TabStop = false;
+      this.assignmentGroupBox.Text = "Assignment";
+      // 
+      // assignmentViewHost
+      // 
+      this.assignmentViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+                  | System.Windows.Forms.AnchorStyles.Left)
+                  | System.Windows.Forms.AnchorStyles.Right)));
+      this.assignmentViewHost.Caption = "View";
+      this.assignmentViewHost.Content = null;
+      this.assignmentViewHost.Enabled = false;
+      this.assignmentViewHost.Location = new System.Drawing.Point(6, 19);
+      this.assignmentViewHost.Name = "assignmentViewHost";
+      this.assignmentViewHost.ReadOnly = false;
+      this.assignmentViewHost.Size = new System.Drawing.Size(504, 244);
+      this.assignmentViewHost.TabIndex = 0;
+      this.assignmentViewHost.ViewsLabelVisible = true;
+      this.assignmentViewHost.ViewType = null;
+      // 
+      // qapView
+      // 
+      this.qapView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+                  | System.Windows.Forms.AnchorStyles.Left)
+                  | System.Windows.Forms.AnchorStyles.Right)));
+      this.qapView.Assignment = null;
+      this.qapView.Distances = null;
+      this.qapView.Location = new System.Drawing.Point(0, 3);
+      this.qapView.Name = "qapView";
+      this.qapView.Size = new System.Drawing.Size(526, 278);
+      this.qapView.TabIndex = 0;
+      this.qapView.Weights = null;
+      // 
+      // QAPAssignmentView
+      // 
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.splitContainer);
+      this.Name = "QAPAssignmentView";
+      this.Size = new System.Drawing.Size(536, 378);
+      this.splitContainer.Panel1.ResumeLayout(false);
+      this.splitContainer.Panel2.ResumeLayout(false);
+      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
+      this.splitContainer.ResumeLayout(false);
+      this.qualityGroupBox.ResumeLayout(false);
+      this.tabControl.ResumeLayout(false);
+      this.visualizationTabPage.ResumeLayout(false);
+      this.valueTabPage.ResumeLayout(false);
+      this.assignmentGroupBox.ResumeLayout(false);
+      this.ResumeLayout(false);
+
+    }
+
+    #endregion
+
+    private System.Windows.Forms.SplitContainer splitContainer;
+    private System.Windows.Forms.GroupBox qualityGroupBox;
+    private MainForm.WindowsForms.ViewHost qualityViewHost;
+    private MainForm.WindowsForms.DragOverTabControl tabControl;
+    private System.Windows.Forms.TabPage visualizationTabPage;
+    private System.Windows.Forms.TabPage valueTabPage;
+    private System.Windows.Forms.GroupBox assignmentGroupBox;
+    private MainForm.WindowsForms.ViewHost assignmentViewHost;
+    private QAPVisualizationControl qapView;
+  }
+}
Index: branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPAssignmentView.cs
===================================================================
--- branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPAssignmentView.cs	(revision 7752)
+++ branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPAssignmentView.cs	(revision 7752)
@@ -0,0 +1,104 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.ComponentModel;
+using System.Windows.Forms;
+using HeuristicLab.Core.Views;
+using HeuristicLab.MainForm;
+
+namespace HeuristicLab.Problems.QuadraticAssignment.Views {
+  /// <summary>
+  /// The base class for visual representations of a path tour for a TSP.
+  /// </summary>
+  [View("QAPAssignment View")]
+  [Content(typeof(QAPAssignment), true)]
+  public sealed partial class QAPAssignmentView : ItemView {
+    public new QAPAssignment Content {
+      get { return (QAPAssignment)base.Content; }
+      set { base.Content = value; }
+    }
+
+    /// <summary>
+    /// Initializes a new instance of <see cref="PathTSPTourView"/>.
+    /// </summary>
+    public QAPAssignmentView() {
+      InitializeComponent();
+    }
+
+    protected override void DeregisterContentEvents() {
+      Content.PropertyChanged -= new PropertyChangedEventHandler(Content_PropertyChanged);
+      base.DeregisterContentEvents();
+    }
+    protected override void RegisterContentEvents() {
+      base.RegisterContentEvents();
+      Content.PropertyChanged += new PropertyChangedEventHandler(Content_PropertyChanged);
+    }
+
+    protected override void OnContentChanged() {
+      base.OnContentChanged();
+      if (Content == null) {
+        qualityViewHost.Content = null;
+        assignmentViewHost.Content = null;
+        qapView.Distances = null;
+        qapView.Weights = null;
+        qapView.Assignment = null;
+      } else {
+        qualityViewHost.Content = Content.Quality;
+        assignmentViewHost.Content = Content.Assignment;
+        qapView.Distances = Content.Distances;
+        qapView.Weights = Content.Weights;
+        qapView.Assignment = Content.Assignment;
+      }
+    }
+
+    protected override void SetEnabledStateOfControls() {
+      base.SetEnabledStateOfControls();
+      qualityGroupBox.Enabled = Content != null;
+      assignmentGroupBox.Enabled = Content != null;
+      qapView.Enabled = Content != null;
+    }
+
+    private void Content_PropertyChanged(object sender, PropertyChangedEventArgs e) {
+      if (InvokeRequired)
+        Invoke(new PropertyChangedEventHandler(Content_PropertyChanged), sender, e);
+      else {
+        switch (e.PropertyName) {
+          case "Coordinates":
+            break;
+          case "Distances":
+            qapView.Distances = Content.Distances;
+            break;
+          case "Weights":
+            qapView.Weights = Content.Weights;
+            break;
+          case "Quality":
+            break;
+          case "Assignment":
+            assignmentViewHost.Content = Content.Assignment;
+            qapView.Assignment = Content.Assignment;
+            break;
+          default:
+            break;
+        }
+      }
+    }
+  }
+}
Index: branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPVisualizationControl.Designer.cs
===================================================================
--- branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPVisualizationControl.Designer.cs	(revision 7752)
+++ branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPVisualizationControl.Designer.cs	(revision 7752)
@@ -0,0 +1,165 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+namespace HeuristicLab.Problems.QuadraticAssignment.Views {
+  partial class QAPVisualizationControl {
+    /// <summary> 
+    /// Required designer variable.
+    /// </summary>
+    private System.ComponentModel.IContainer components = null;
+
+    /// <summary> 
+    /// Clean up any resources being used.
+    /// </summary>
+    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+    protected override void Dispose(bool disposing) {
+      CustomDispose(disposing);
+      if (disposing && (components != null)) {
+        components.Dispose();
+      }
+      base.Dispose(disposing);
+    }
+
+    #region Component Designer generated code
+
+    /// <summary> 
+    /// Required method for Designer support - do not modify 
+    /// the contents of this method with the code editor.
+    /// </summary>
+    private void InitializeComponent() {
+      this.redrawButton = new System.Windows.Forms.Button();
+      this.distancesRadioButton = new System.Windows.Forms.RadioButton();
+      this.weightsRadioButton = new System.Windows.Forms.RadioButton();
+      this.pictureBox = new System.Windows.Forms.PictureBox();
+      this.stressLabel = new System.Windows.Forms.Label();
+      this.assignmentRadioButton = new System.Windows.Forms.RadioButton();
+      this.label1 = new System.Windows.Forms.Label();
+      ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
+      this.SuspendLayout();
+      // 
+      // redrawButton
+      // 
+      this.redrawButton.Location = new System.Drawing.Point(3, 3);
+      this.redrawButton.Name = "redrawButton";
+      this.redrawButton.Size = new System.Drawing.Size(26, 23);
+      this.redrawButton.TabIndex = 7;
+      this.redrawButton.Text = "Redraw";
+      this.redrawButton.UseVisualStyleBackColor = true;
+      this.redrawButton.Click += new System.EventHandler(this.redrawButton_Click);
+      // 
+      // distancesRadioButton
+      // 
+      this.distancesRadioButton.AutoSize = true;
+      this.distancesRadioButton.Checked = true;
+      this.distancesRadioButton.Location = new System.Drawing.Point(35, 6);
+      this.distancesRadioButton.Name = "distancesRadioButton";
+      this.distancesRadioButton.Size = new System.Drawing.Size(72, 17);
+      this.distancesRadioButton.TabIndex = 6;
+      this.distancesRadioButton.TabStop = true;
+      this.distancesRadioButton.Text = "Distances";
+      this.distancesRadioButton.UseVisualStyleBackColor = true;
+      this.distancesRadioButton.CheckedChanged += new System.EventHandler(this.radio_CheckedChanged);
+      // 
+      // weightsRadioButton
+      // 
+      this.weightsRadioButton.AutoSize = true;
+      this.weightsRadioButton.Location = new System.Drawing.Point(113, 6);
+      this.weightsRadioButton.Name = "weightsRadioButton";
+      this.weightsRadioButton.Size = new System.Drawing.Size(64, 17);
+      this.weightsRadioButton.TabIndex = 5;
+      this.weightsRadioButton.Text = "Weights";
+      this.weightsRadioButton.UseVisualStyleBackColor = true;
+      this.weightsRadioButton.CheckedChanged += new System.EventHandler(this.radio_CheckedChanged);
+      // 
+      // pictureBox
+      // 
+      this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+                  | System.Windows.Forms.AnchorStyles.Left)
+                  | System.Windows.Forms.AnchorStyles.Right)));
+      this.pictureBox.BackColor = System.Drawing.Color.White;
+      this.pictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+      this.pictureBox.Location = new System.Drawing.Point(0, 32);
+      this.pictureBox.Name = "pictureBox";
+      this.pictureBox.Size = new System.Drawing.Size(574, 422);
+      this.pictureBox.TabIndex = 4;
+      this.pictureBox.TabStop = false;
+      this.pictureBox.SizeChanged += new System.EventHandler(this.pictureBox_SizeChanged);
+      // 
+      // stressLabel
+      // 
+      this.stressLabel.AutoSize = true;
+      this.stressLabel.Location = new System.Drawing.Point(393, 8);
+      this.stressLabel.Name = "stressLabel";
+      this.stressLabel.Size = new System.Drawing.Size(10, 13);
+      this.stressLabel.TabIndex = 8;
+      this.stressLabel.Text = "-";
+      // 
+      // assignmentRadioButton
+      // 
+      this.assignmentRadioButton.AutoSize = true;
+      this.assignmentRadioButton.Location = new System.Drawing.Point(183, 6);
+      this.assignmentRadioButton.Name = "assignmentRadioButton";
+      this.assignmentRadioButton.Size = new System.Drawing.Size(79, 17);
+      this.assignmentRadioButton.TabIndex = 5;
+      this.assignmentRadioButton.Text = "Assignment";
+      this.assignmentRadioButton.UseVisualStyleBackColor = true;
+      this.assignmentRadioButton.CheckedChanged += new System.EventHandler(this.radio_CheckedChanged);
+      // 
+      // label1
+      // 
+      this.label1.AutoSize = true;
+      this.label1.Location = new System.Drawing.Point(293, 8);
+      this.label1.Name = "label1";
+      this.label1.Size = new System.Drawing.Size(94, 13);
+      this.label1.TabIndex = 8;
+      this.label1.Text = "Normalized Stress:";
+      // 
+      // QAPVisualizationControl
+      // 
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Controls.Add(this.label1);
+      this.Controls.Add(this.stressLabel);
+      this.Controls.Add(this.redrawButton);
+      this.Controls.Add(this.distancesRadioButton);
+      this.Controls.Add(this.assignmentRadioButton);
+      this.Controls.Add(this.weightsRadioButton);
+      this.Controls.Add(this.pictureBox);
+      this.Name = "QAPVisualizationControl";
+      this.Size = new System.Drawing.Size(574, 454);
+      ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
+      this.ResumeLayout(false);
+      this.PerformLayout();
+
+    }
+
+    #endregion
+
+    private System.Windows.Forms.Button redrawButton;
+    private System.Windows.Forms.RadioButton distancesRadioButton;
+    private System.Windows.Forms.RadioButton weightsRadioButton;
+    private System.Windows.Forms.PictureBox pictureBox;
+    private System.Windows.Forms.Label stressLabel;
+    private System.Windows.Forms.RadioButton assignmentRadioButton;
+    private System.Windows.Forms.Label label1;
+
+  }
+}
Index: branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPVisualizationControl.cs
===================================================================
--- branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPVisualizationControl.cs	(revision 7752)
+++ branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QAPVisualizationControl.cs	(revision 7752)
@@ -0,0 +1,551 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Drawing;
+using System.Globalization;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Windows.Forms;
+using HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Common.Resources;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.PermutationEncoding;
+
+namespace HeuristicLab.Problems.QuadraticAssignment.Views {
+  public partial class QAPVisualizationControl : UserControl {
+    private Bitmap bitmap;
+    private Bitmap defaultBitmap;
+    private bool showingMessage;
+
+    #region Properties
+    private DoubleMatrix distances;
+    public DoubleMatrix Distances {
+      get { return distances; }
+      set {
+        DeregisterDistancesEvents();
+        distances = value;
+        RegisterDistancesEvents();
+        OnRedraw();
+      }
+    }
+
+    private DoubleMatrix weights;
+    public DoubleMatrix Weights {
+      get { return weights; }
+      set {
+        DeregisterWeightsEvents();
+        weights = value;
+        RegisterWeightsEvents();
+        OnRedraw();
+      }
+    }
+
+    private Permutation assignment;
+    public Permutation Assignment {
+      get { return assignment; }
+      set {
+        DeregisterAssignmentEvents();
+        assignment = value;
+        RegisterAssignmentEvents();
+        OnRedraw();
+      }
+    }
+    #endregion
+
+    #region Event Handling
+    private void DeregisterDistancesEvents() {
+      if (Distances != null) {
+        Distances.Reset -= new EventHandler(RedrawNecessary);
+        Distances.RowsChanged -= new EventHandler(RedrawNecessary);
+        Distances.ColumnsChanged -= new EventHandler(RedrawNecessary);
+        Distances.ItemChanged -= new EventHandler<EventArgs<int, int>>(RedrawNecessary);
+      }
+    }
+
+    private void RegisterDistancesEvents() {
+      if (Distances != null) {
+        Distances.Reset += new EventHandler(RedrawNecessary);
+        Distances.RowsChanged += new EventHandler(RedrawNecessary);
+        Distances.ColumnsChanged += new EventHandler(RedrawNecessary);
+        Distances.ItemChanged += new EventHandler<EventArgs<int, int>>(RedrawNecessary);
+      }
+    }
+
+    private void DeregisterWeightsEvents() {
+      if (Weights != null) {
+        Weights.Reset -= new EventHandler(RedrawNecessary);
+        Weights.RowsChanged -= new EventHandler(RedrawNecessary);
+        Weights.ColumnsChanged -= new EventHandler(RedrawNecessary);
+        Weights.ItemChanged -= new EventHandler<EventArgs<int, int>>(RedrawNecessary);
+      }
+    }
+
+    private void RegisterWeightsEvents() {
+      if (Weights != null) {
+        Weights.Reset += new EventHandler(RedrawNecessary);
+        Weights.RowsChanged += new EventHandler(RedrawNecessary);
+        Weights.ColumnsChanged += new EventHandler(RedrawNecessary);
+        Weights.ItemChanged += new EventHandler<EventArgs<int, int>>(RedrawNecessary);
+      }
+    }
+
+    private void DeregisterAssignmentEvents() {
+      if (Assignment != null) {
+        Assignment.Reset -= new EventHandler(RedrawNecessary);
+        Assignment.ItemChanged -= new EventHandler<EventArgs<int>>(RedrawNecessary);
+      }
+    }
+
+    private void RegisterAssignmentEvents() {
+      if (Assignment != null) {
+        Assignment.Reset += new EventHandler(RedrawNecessary);
+        Assignment.ItemChanged += new EventHandler<EventArgs<int>>(RedrawNecessary);
+      }
+    }
+
+    private void redrawButton_Click(object sender, EventArgs e) {
+      OnRedraw();
+    }
+
+    private void radio_CheckedChanged(object sender, EventArgs e) {
+      RadioButton rb = (sender as RadioButton);
+      if (rb != null && !rb.Checked) return;
+      else OnRedraw();
+    }
+
+    private void RedrawNecessary(object sender, EventArgs e) {
+      MarkRedrawNecessary();
+    }
+
+    private void RedrawNecessary(object sender, EventArgs<int, int> e) {
+      MarkRedrawNecessary();
+    }
+
+    private void pictureBox_SizeChanged(object sender, EventArgs e) {
+      SetupDefaultBitmap();
+      if (!showingMessage) MarkRedrawNecessary();
+      else OnRedraw();
+    }
+    #endregion
+
+    public QAPVisualizationControl() {
+      InitializeComponent();
+      showingMessage = false;
+      redrawButton.Text = String.Empty;
+      redrawButton.Image = VSImageLibrary.Refresh;
+      SetupDefaultBitmap();
+    }
+
+    private void SetupDefaultBitmap() {
+      if (defaultBitmap != null) {
+        defaultBitmap.Dispose();
+        defaultBitmap = null;
+      }
+      if (pictureBox.Width > 0 && pictureBox.Height > 0) {
+        defaultBitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
+        WriteCenteredTextToBitmap(ref defaultBitmap, "No visualization available");
+      }
+    }
+
+    private void WriteCenteredTextToBitmap(ref Bitmap bitmap, string text) {
+      if (bitmap == null) return;
+      using (Graphics g = Graphics.FromImage(bitmap)) {
+        g.Clear(Color.White);
+
+        Font font = new Font(FontFamily.GenericSansSerif, 12, FontStyle.Regular);
+        SizeF strSize = g.MeasureString(text, font);
+        if (strSize.Width + 50 > pictureBox.Width) {
+          Match m = Regex.Match(text, @"\b\w+[.,]*\b*");
+          StringBuilder builder = new StringBuilder();
+          while (m.Success) {
+            builder.Append(m.Value + " ");
+            Match next = m.NextMatch();
+            if (g.MeasureString(builder.ToString() + " " + next.Value, font).Width + 50 > pictureBox.Width)
+              builder.AppendLine();
+            m = next;
+          }
+          builder.Remove(builder.Length - 1, 1);
+          text = builder.ToString();
+          strSize = g.MeasureString(text, font);
+        }
+        g.DrawString(text, font, Brushes.Black, (float)(pictureBox.Width - strSize.Width) / 2.0f, (float)(pictureBox.Height - strSize.Height) / 2.0f);
+      }
+    }
+
+    private void OnRedraw() {
+      if (InvokeRequired) {
+        Invoke((Action)OnRedraw, null);
+      } else {
+        GenerateImage();
+      }
+    }
+
+    private void GenerateImage() {
+      if (pictureBox.Width > 0 && pictureBox.Height > 0) {
+        Bitmap newBitmap = null;
+        stressLabel.Text = "-";
+        stressLabel.ForeColor = Color.Black;
+        if (distancesRadioButton.Checked && Distances != null && Distances.Rows > 0
+          && Distances.Rows == Distances.Columns) {
+          if (Distances.Rows > 50) {
+            newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
+            WriteCenteredTextToBitmap(ref newBitmap, "Problem dimension is too large for visualization.");
+            showingMessage = true;
+          } else newBitmap = GenerateDistanceImage();
+        } else if (weightsRadioButton.Checked && Weights != null && Weights.Rows > 0
+          && Weights.Rows == Weights.Columns) {
+          if (Weights.Rows > 50) {
+            newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
+            WriteCenteredTextToBitmap(ref newBitmap, "Problem dimension is too large for visualization.");
+            showingMessage = true;
+          } else newBitmap = GenerateWeightsImage();
+        } else if (assignmentRadioButton.Checked
+          && Assignment != null && Assignment.Length > 0
+          && Weights != null && Weights.Rows > 0
+          && Distances != null && Distances.Rows > 0
+          && Weights.Rows == Weights.Columns
+          && Distances.Rows == Distances.Columns
+          && Assignment.Length == Weights.Rows
+          && Assignment.Length == Distances.Rows
+          && Assignment.Validate()) {
+          if (Assignment.Length > 50) {
+            newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
+            WriteCenteredTextToBitmap(ref newBitmap, "Problem dimension is too large for visualization.");
+            showingMessage = true;
+          } else newBitmap = GenerateAssignmentImage();
+        }
+
+        pictureBox.Image = newBitmap != null ? newBitmap : defaultBitmap;
+        if (bitmap != null) bitmap.Dispose();
+        if (newBitmap != null) bitmap = newBitmap;
+        else {
+          bitmap = null;
+          showingMessage = true;
+        }
+      }
+    }
+
+    private void MarkRedrawNecessary() {
+      if (pictureBox.Width > 0 && pictureBox.Height > 0) {
+        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
+
+        pictureBox.Image = newBitmap != null ? newBitmap : defaultBitmap;
+        if (bitmap != null) bitmap.Dispose();
+        if (newBitmap != null) bitmap = newBitmap;
+        else bitmap = null;
+      }
+    }
+
+    #region Draw distances
+    private Bitmap GenerateDistanceImage() {
+      if ((pictureBox.Width > 0) && (pictureBox.Height > 0)) {
+        Bitmap newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
+
+        DoubleMatrix coordinates;
+        double stress = double.NaN;
+        try {
+          coordinates = MultidimensionalScaling.KruskalShepard(distances);
+          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;
+        }
+        double xMin = double.MaxValue, yMin = double.MaxValue, xMax = double.MinValue, yMax = double.MinValue;
+        double maxDistance = double.MinValue;
+        for (int i = 0; i < coordinates.Rows; i++) {
+          if (xMin > coordinates[i, 0]) xMin = coordinates[i, 0];
+          if (yMin > coordinates[i, 1]) yMin = coordinates[i, 1];
+          if (xMax < coordinates[i, 0]) xMax = coordinates[i, 0];
+          if (yMax < coordinates[i, 1]) yMax = coordinates[i, 1];
+
+          for (int j = i + 1; j < coordinates.Rows; j++) {
+            if (distances[i, j] > maxDistance) maxDistance = distances[i, j];
+            if (distances[j, i] > maxDistance) maxDistance = distances[j, i];
+          }
+        }
+
+        int border = 20;
+        double xStep = xMax != xMin ? (pictureBox.Width - 2 * border) / (xMax - xMin) : 1;
+        double yStep = yMax != yMin ? (pictureBox.Height - 2 * border) / (yMax - yMin) : 1;
+
+        Point[] points = new Point[coordinates.Rows];
+        for (int i = 0; i < coordinates.Rows; i++)
+          points[i] = new Point(border + ((int)((coordinates[i, 0] - xMin) * xStep)),
+                                newBitmap.Height - (border + ((int)((coordinates[i, 1] - yMin) * yStep))));
+
+        Random rand = new Random();
+        using (Graphics graphics = Graphics.FromImage(newBitmap)) {
+          graphics.Clear(Color.White);
+          graphics.DrawString("Showing locations spaced out according to their distances", Font, Brushes.Black, 5, 2);
+
+          for (int i = 0; i < coordinates.Rows - 1; i++) {
+            for (int j = i + 1; j < coordinates.Rows; j++) {
+              Point start = points[i], end = points[j];
+              string caption = String.Empty;
+              double d = Math.Max(distances[i, j], distances[j, i]);
+              float width = (float)Math.Ceiling(5.0 * d / maxDistance);
+              if (d > 0) {
+                graphics.DrawLine(new Pen(Color.IndianRed, width), start, end);
+                if (distances[i, j] != distances[j, i])
+                  caption = distances[i, j].ToString(CultureInfo.InvariantCulture.NumberFormat)
+                    + " / " + distances[j, i].ToString(CultureInfo.InvariantCulture.NumberFormat);
+                else
+                  caption = distances[i, j].ToString(CultureInfo.InvariantCulture.NumberFormat);
+              }
+              if (!String.IsNullOrEmpty(caption)) {
+                double r = rand.NextDouble();
+                while (r < 0.2 || r > 0.8) r = rand.NextDouble();
+                float x = (float)(start.X + (end.X - start.X) * r + 5);
+                float y = (float)(start.Y + (end.Y - start.Y) * r + 5);
+                graphics.DrawString(caption, Font, Brushes.Black, x, y);
+              }
+            }
+          }
+
+          for (int i = 0; i < points.Length; i++) {
+            Point p = new Point(points[i].X - 3, points[i].Y - 3);
+            graphics.FillRectangle(Brushes.Black, p.X, p.Y, 8, 8);
+            graphics.DrawString(i.ToString(), Font, Brushes.Black, p.X, p.Y + 10);
+          }
+        }
+        showingMessage = false;
+        return newBitmap;
+      }
+      return null;
+    }
+    #endregion
+
+    #region Draw weights
+    private Bitmap GenerateWeightsImage() {
+      if ((pictureBox.Width > 0) && (pictureBox.Height > 0)) {
+        Bitmap newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
+
+        double maxWeight = double.MinValue;
+        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];
+            if (weights[j, i] > maxWeight) maxWeight = weights[j, i];
+          }
+
+        DoubleMatrix distances = new DoubleMatrix(weights.Rows, weights.Columns);
+        for (int i = 0; i < distances.Rows; i++)
+          for (int j = 0; j < distances.Columns; j++) {
+            if (weights[i, j] == 0) distances[i, j] = double.NaN;
+            else distances[i, j] = maxWeight / weights[i, j];
+          }
+
+        DoubleMatrix coordinates;
+        double stress = double.NaN;
+        try {
+          coordinates = MultidimensionalScaling.KruskalShepard(distances);
+          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;
+        }
+        double xMin = double.MaxValue, yMin = double.MaxValue, xMax = double.MinValue, yMax = double.MinValue;
+        for (int i = 0; i < coordinates.Rows; i++) {
+          if (xMin > coordinates[i, 0]) xMin = coordinates[i, 0];
+          if (yMin > coordinates[i, 1]) yMin = coordinates[i, 1];
+          if (xMax < coordinates[i, 0]) xMax = coordinates[i, 0];
+          if (yMax < coordinates[i, 1]) yMax = coordinates[i, 1];
+        }
+
+        int border = 20;
+        double xStep = xMax != xMin ? (pictureBox.Width - 2 * border) / (xMax - xMin) : 1;
+        double yStep = yMax != yMin ? (pictureBox.Height - 2 * border) / (yMax - yMin) : 1;
+
+        Point[] points = new Point[coordinates.Rows];
+        for (int i = 0; i < coordinates.Rows; i++)
+          points[i] = new Point(border + ((int)((coordinates[i, 0] - xMin) * xStep)),
+                                newBitmap.Height - (border + ((int)((coordinates[i, 1] - yMin) * yStep))));
+
+        Random rand = new Random();
+        using (Graphics graphics = Graphics.FromImage(newBitmap)) {
+          graphics.Clear(Color.White);
+          graphics.DrawString("Showing facilities spaced out according to their weights", Font, Brushes.Black, 5, 2);
+
+          for (int i = 0; i < coordinates.Rows - 1; i++) {
+            for (int j = i + 1; j < coordinates.Rows; j++) {
+              Point start = points[i], end = points[j];
+              string caption = String.Empty;
+              double d = Math.Max(distances[i, j], distances[j, i]);
+              double w = weights[i, j];
+              if (w > 0) {
+                float width = (float)Math.Ceiling(3.0 * w / maxWeight);
+                graphics.DrawLine(new Pen(Color.MediumBlue, width), start, end);
+                caption = w.ToString(CultureInfo.InvariantCulture.NumberFormat);
+              }
+              if (!String.IsNullOrEmpty(caption)) {
+                double r = rand.NextDouble();
+                while (r < 0.2 || r > 0.8) r = rand.NextDouble();
+                float x = (float)(start.X + (end.X - start.X) * r + 5);
+                float y = (float)(start.Y + (end.Y - start.Y) * r + 5);
+                graphics.DrawString(caption, Font, Brushes.Black, x, y);
+              }
+            }
+          }
+          for (int i = 0; i < points.Length; i++) {
+            Point p = new Point(points[i].X - 3, points[i].Y - 3);
+            graphics.FillRectangle(Brushes.Black, p.X, p.Y, 8, 8);
+            graphics.DrawString(i.ToString(), Font, Brushes.Black, p.X, p.Y + 10);
+          }
+        }
+        showingMessage = false;
+        return newBitmap;
+      }
+      return null;
+    }
+    #endregion
+
+    #region Draw assignment
+    private Bitmap GenerateAssignmentImage() {
+      if ((pictureBox.Width > 0) && (pictureBox.Height > 0)) {
+        Bitmap newBitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
+
+        for (int i = 0; i < distances.Rows; i++) {
+          for (int j = i + 1; j < distances.Rows; j++) {
+            if (distances[i, j] != distances[j, i]) {
+              WriteCenteredTextToBitmap(ref newBitmap, "Distance matrix is not symmetric");
+              stressLabel.Text = "-";
+              showingMessage = true;
+              return newBitmap;
+            }
+            if (weights[i, j] != weights[j, i]) {
+              WriteCenteredTextToBitmap(ref newBitmap, "Weights matrix is not symmetric");
+              stressLabel.Text = "-";
+              showingMessage = true;
+              return newBitmap;
+            }
+          }
+        }
+
+        DoubleMatrix coordinates = null;
+        double stress = double.NaN;
+        try {
+          coordinates = MultidimensionalScaling.KruskalShepard(distances);
+          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;
+        }
+
+        double xMin = double.MaxValue, yMin = double.MaxValue, xMax = double.MinValue, yMax = double.MinValue;
+        double maxWeight = double.MinValue;
+        for (int i = 0; i < coordinates.Rows; i++) {
+          if (xMin > coordinates[i, 0]) xMin = coordinates[i, 0];
+          if (yMin > coordinates[i, 1]) yMin = coordinates[i, 1];
+          if (xMax < coordinates[i, 0]) xMax = coordinates[i, 0];
+          if (yMax < coordinates[i, 1]) yMax = coordinates[i, 1];
+
+          for (int j = i + 1; j < coordinates.Rows; j++) {
+            if (weights[i, j] > maxWeight) maxWeight = weights[i, j];
+          }
+        }
+
+        int border = 20;
+        double xStep = xMax != xMin ? (pictureBox.Width - 2 * border) / (xMax - xMin) : 1;
+        double yStep = yMax != yMin ? (pictureBox.Height - 2 * border) / (yMax - yMin) : 1;
+
+        Point[] points = new Point[coordinates.Rows];
+        for (int i = 0; i < coordinates.Rows; i++)
+          points[i] = new Point(border + ((int)((coordinates[i, 0] - xMin) * xStep)),
+                                newBitmap.Height - (border + ((int)((coordinates[i, 1] - yMin) * yStep))));
+
+        Random rand = new Random();
+        using (Graphics graphics = Graphics.FromImage(newBitmap)) {
+          graphics.Clear(Color.White);
+          for (int i = 0; i < assignment.Length - 1; i++) {
+            for (int j = i + 1; j < assignment.Length; j++) {
+              Point start, end;
+              string caption = String.Empty;
+              double d = distances[i, j];
+              start = points[assignment[i]];
+              end = points[assignment[j]];
+              double w = weights[i, j];
+              if (w > 0) {
+                float width = (float)Math.Ceiling(4.0 * w / maxWeight);
+                graphics.DrawLine(new Pen(Color.MediumBlue, width), start, end);
+                caption = w.ToString(CultureInfo.InvariantCulture.NumberFormat);
+              }
+              if (!String.IsNullOrEmpty(caption)) {
+                double r = rand.NextDouble();
+                while (r < 0.2 || r > 0.8) r = rand.NextDouble();
+                float x = (float)(start.X + (end.X - start.X) * r + 5);
+                float y = (float)(start.Y + (end.Y - start.Y) * r + 5);
+                graphics.DrawString(caption, Font, Brushes.Black, x, y);
+              }
+            }
+          }
+
+          for (int i = 0; i < points.Length; i++) {
+            Point p = new Point(points[i].X - 3, points[i].Y - 3);
+            graphics.FillRectangle(Brushes.Black, p.X, p.Y, 8, 8);
+            graphics.DrawString(i.ToString(), Font, Brushes.Black, p.X, p.Y + 10);
+          }
+        }
+        showingMessage = false;
+        return newBitmap;
+      }
+      return null;
+    }
+    #endregion
+
+    private void CustomDispose(bool disposing) {
+      DeregisterDistancesEvents();
+      DeregisterWeightsEvents();
+      DeregisterAssignmentEvents();
+      if (bitmap != null) bitmap.Dispose();
+      bitmap = null;
+      if (defaultBitmap != null) {
+        defaultBitmap.Dispose();
+        defaultBitmap = null;
+      }
+    }
+  }
+}
Index: branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.Designer.cs
===================================================================
--- branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.Designer.cs	(revision 7752)
+++ branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.Designer.cs	(revision 7752)
@@ -0,0 +1,154 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+namespace HeuristicLab.Problems.QuadraticAssignment.Views {
+  partial class QuadraticAssignmentProblemView {
+    /// <summary> 
+    /// Required designer variable.
+    /// </summary>
+    private System.ComponentModel.IContainer components = null;
+
+    /// <summary> 
+    /// Clean up any resources being used.
+    /// </summary>
+    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+    protected override void Dispose(bool disposing) {
+      if (disposing && (components != null)) {
+        components.Dispose();
+      }
+      base.Dispose(disposing);
+    }
+
+    #region Component Designer generated code
+
+    /// <summary> 
+    /// Required method for Designer support - do not modify 
+    /// the contents of this method with the code editor.
+    /// </summary>
+    private void InitializeComponent() {
+      this.tabControl = new System.Windows.Forms.TabControl();
+      this.problemTabPage = new System.Windows.Forms.TabPage();
+      this.visualizationTabPage = new System.Windows.Forms.TabPage();
+      this.qapView = new HeuristicLab.Problems.QuadraticAssignment.Views.QAPVisualizationControl();
+      ((System.ComponentModel.ISupportInitialize)(this.problemInstanceSplitContainer)).BeginInit();
+      this.problemInstanceSplitContainer.Panel1.SuspendLayout();
+      this.problemInstanceSplitContainer.Panel2.SuspendLayout();
+      this.problemInstanceSplitContainer.SuspendLayout();
+      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
+      this.tabControl.SuspendLayout();
+      this.problemTabPage.SuspendLayout();
+      this.visualizationTabPage.SuspendLayout();
+      this.SuspendLayout();
+      // 
+      // libraryInfoButton
+      // 
+      this.libraryInfoButton.Location = new System.Drawing.Point(224, 1);
+      // 
+      // problemInstanceSplitContainer
+      // 
+      // 
+      // problemInstanceSplitContainer.Panel2
+      // 
+      this.problemInstanceSplitContainer.Panel2.Controls.Add(this.tabControl);
+      // 
+      // parameterCollectionView
+      // 
+      this.parameterCollectionView.Location = new System.Drawing.Point(0, 3);
+      this.parameterCollectionView.Size = new System.Drawing.Size(497, 269);
+      // 
+      // nameTextBox
+      // 
+      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
+      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
+      // 
+      // tabControl
+      // 
+      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+                  | System.Windows.Forms.AnchorStyles.Left)
+                  | System.Windows.Forms.AnchorStyles.Right)));
+      this.tabControl.Controls.Add(this.problemTabPage);
+      this.tabControl.Controls.Add(this.visualizationTabPage);
+      this.tabControl.Location = new System.Drawing.Point(0, 29);
+      this.tabControl.Name = "tabControl";
+      this.tabControl.SelectedIndex = 0;
+      this.tabControl.Size = new System.Drawing.Size(511, 304);
+      this.tabControl.TabIndex = 8;
+      // 
+      // problemTabPage
+      // 
+      this.problemTabPage.Controls.Add(this.parameterCollectionView);
+      this.problemTabPage.Location = new System.Drawing.Point(4, 22);
+      this.problemTabPage.Name = "problemTabPage";
+      this.problemTabPage.Padding = new System.Windows.Forms.Padding(3);
+      this.problemTabPage.Size = new System.Drawing.Size(503, 278);
+      this.problemTabPage.TabIndex = 0;
+      this.problemTabPage.Text = "Problem";
+      this.problemTabPage.UseVisualStyleBackColor = true;
+      // 
+      // visualizationTabPage
+      // 
+      this.visualizationTabPage.Controls.Add(this.qapView);
+      this.visualizationTabPage.Location = new System.Drawing.Point(4, 22);
+      this.visualizationTabPage.Name = "visualizationTabPage";
+      this.visualizationTabPage.Padding = new System.Windows.Forms.Padding(3);
+      this.visualizationTabPage.Size = new System.Drawing.Size(503, 278);
+      this.visualizationTabPage.TabIndex = 1;
+      this.visualizationTabPage.Text = "Visualization";
+      this.visualizationTabPage.UseVisualStyleBackColor = true;
+      // 
+      // qapView
+      // 
+      this.qapView.Assignment = null;
+      this.qapView.Distances = null;
+      this.qapView.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.qapView.Location = new System.Drawing.Point(3, 3);
+      this.qapView.Name = "qapView";
+      this.qapView.Size = new System.Drawing.Size(497, 272);
+      this.qapView.TabIndex = 0;
+      this.qapView.Weights = null;
+      // 
+      // QuadraticAssignmentProblemView
+      // 
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.Name = "QuadraticAssignmentProblemView";
+      this.problemInstanceSplitContainer.Panel1.ResumeLayout(false);
+      this.problemInstanceSplitContainer.Panel1.PerformLayout();
+      this.problemInstanceSplitContainer.Panel2.ResumeLayout(false);
+      this.problemInstanceSplitContainer.Panel2.PerformLayout();
+      ((System.ComponentModel.ISupportInitialize)(this.problemInstanceSplitContainer)).EndInit();
+      this.problemInstanceSplitContainer.ResumeLayout(false);
+      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
+      this.tabControl.ResumeLayout(false);
+      this.problemTabPage.ResumeLayout(false);
+      this.visualizationTabPage.ResumeLayout(false);
+      this.ResumeLayout(false);
+
+    }
+
+    #endregion
+
+    private System.Windows.Forms.TabControl tabControl;
+    private System.Windows.Forms.TabPage problemTabPage;
+    private System.Windows.Forms.TabPage visualizationTabPage;
+    private QAPVisualizationControl qapView;
+  }
+}
Index: branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.cs
===================================================================
--- branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.cs	(revision 7752)
+++ branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.cs	(revision 7752)
@@ -0,0 +1,87 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Windows.Forms;
+using HeuristicLab.MainForm;
+using HeuristicLab.MainForm.WindowsForms;
+using HeuristicLab.Optimization.Views;
+
+namespace HeuristicLab.Problems.QuadraticAssignment.Views {
+  [View("Quadratic Assignment Problem View")]
+  [Content(typeof(QuadraticAssignmentProblem), IsDefaultView = true)]
+  public sealed partial class QuadraticAssignmentProblemView : ProblemView {
+    public new QuadraticAssignmentProblem Content {
+      get { return (QuadraticAssignmentProblem)base.Content; }
+      set { base.Content = value; }
+    }
+
+    public QuadraticAssignmentProblemView() {
+      InitializeComponent();
+      Controls.Remove(parameterCollectionView);
+      parameterCollectionView.Dock = DockStyle.Fill;
+      problemTabPage.Controls.Add(parameterCollectionView);
+    }
+
+    protected override void RegisterContentEvents() {
+      base.RegisterContentEvents();
+      Content.DistancesParameter.ValueChanged += new EventHandler(DistanceMatrixParameter_ValueChanged);
+      Content.WeightsParameter.ValueChanged += new EventHandler(WeightsParameter_ValueChanged);
+      Content.BestKnownSolutionParameter.ValueChanged += new EventHandler(BestKnownSolutionParameter_ValueChanged);
+    }
+
+    protected override void DeregisterContentEvents() {
+      Content.DistancesParameter.ValueChanged -= new EventHandler(DistanceMatrixParameter_ValueChanged);
+      Content.WeightsParameter.ValueChanged -= new EventHandler(WeightsParameter_ValueChanged);
+      Content.BestKnownSolutionParameter.ValueChanged -= new EventHandler(BestKnownSolutionParameter_ValueChanged);
+      base.DeregisterContentEvents();
+    }
+
+    private void DistanceMatrixParameter_ValueChanged(object sender, System.EventArgs e) {
+      qapView.Distances = Content.Distances;
+    }
+
+    private void WeightsParameter_ValueChanged(object sender, System.EventArgs e) {
+      qapView.Weights = Content.Weights;
+    }
+
+    private void BestKnownSolutionParameter_ValueChanged(object sender, System.EventArgs e) {
+      qapView.Assignment = Content.BestKnownSolution;
+    }
+
+    protected override void OnContentChanged() {
+      base.OnContentChanged();
+      if (Content != null) {
+        qapView.Distances = Content.Distances;
+        qapView.Weights = Content.Weights;
+        qapView.Assignment = Content.BestKnownSolution;
+      } else {
+        qapView.Distances = null;
+        qapView.Weights = null;
+        qapView.Assignment = null;
+      }
+    }
+
+    protected override void SetEnabledStateOfControls() {
+      base.SetEnabledStateOfControls();
+    }
+  }
+}
