Index: /branches/histogram/HeuristicLab.Problems.QuadraticAssignment/3.3/Analyzers/QAPAlleleFrequencyAnalyzer.cs
===================================================================
--- /branches/histogram/HeuristicLab.Problems.QuadraticAssignment/3.3/Analyzers/QAPAlleleFrequencyAnalyzer.cs	(revision 5996)
+++ /branches/histogram/HeuristicLab.Problems.QuadraticAssignment/3.3/Analyzers/QAPAlleleFrequencyAnalyzer.cs	(revision 5996)
@@ -0,0 +1,76 @@
+#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 HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.QuadraticAssignment {
+  /// <summary>
+  /// An operator for analyzing the frequency of alleles in solutions of Quadratic Assignment Problems.
+  /// </summary>
+  [Item("QAPAlleleFrequencyAnalyzer", "An operator for analyzing the frequency of alleles in solutions of Quadratic Assignment Problems.")]
+  [StorableClass]
+  public sealed class QAPAlleleFrequencyAnalyzer : AlleleFrequencyAnalyzer<Permutation> {
+    public LookupParameter<DoubleMatrix> WeightsParameter {
+      get { return (LookupParameter<DoubleMatrix>)Parameters["Weights"]; }
+    }
+    public LookupParameter<DoubleMatrix> DistancesParameter {
+      get { return (LookupParameter<DoubleMatrix>)Parameters["Distances"]; }
+    }
+
+    [StorableConstructor]
+    private QAPAlleleFrequencyAnalyzer(bool deserializing) : base(deserializing) { }
+    private QAPAlleleFrequencyAnalyzer(QAPAlleleFrequencyAnalyzer original, Cloner cloner) : base(original, cloner) { }
+    public QAPAlleleFrequencyAnalyzer()
+      : base() {
+      Parameters.Add(new LookupParameter<DoubleMatrix>("Weights", "The matrix contains the weights between the facilities."));
+      Parameters.Add(new LookupParameter<DoubleMatrix>("Distances", "The matrix which contains the distances between the locations."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new QAPAlleleFrequencyAnalyzer(this, cloner);
+    }
+
+    protected override Allele[] CalculateAlleles(Permutation solution) {
+      Allele[] alleles = new Allele[solution.Length];
+      DoubleMatrix weights = WeightsParameter.ActualValue;
+      DoubleMatrix distances = DistancesParameter.ActualValue;
+      int source, target;
+      double impact;
+
+      for (int i = 0; i < solution.Length; i++) {
+        source = i;
+        target = solution[i];
+        impact = 0;
+        for (int j = 0; j < solution.Length; j++)
+          impact += weights[source, j] * distances[target, solution[j]];
+        alleles[i] = new Allele(source.ToString() + "-" + target.ToString(), impact);
+      }
+
+      return alleles;
+    }
+  }
+}
Index: /branches/histogram/HeuristicLab.Problems.QuadraticAssignment/3.3/Analyzers/QAPPopulationDiversityAnalyzer.cs
===================================================================
--- /branches/histogram/HeuristicLab.Problems.QuadraticAssignment/3.3/Analyzers/QAPPopulationDiversityAnalyzer.cs	(revision 5996)
+++ /branches/histogram/HeuristicLab.Problems.QuadraticAssignment/3.3/Analyzers/QAPPopulationDiversityAnalyzer.cs	(revision 5996)
@@ -0,0 +1,67 @@
+#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 HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.QuadraticAssignment {
+  /// <summary>
+  /// An operator for analyzing the diversity of solutions of Quadratic Assignment Problems regarding their structural identity (number of equal facilty->location assignments).
+  /// </summary>
+  [Item("QAPPopulationDiversityAnalyzer", "An operator for analyzing the diversity of solutions of Quadratic Assignment Problems regarding their structural identity (number of equal facilty->location assignments).")]
+  [StorableClass]
+  public sealed class QAPPopulationDiversityAnalyzer : PopulationDiversityAnalyzer<Permutation> {
+    [StorableConstructor]
+    private QAPPopulationDiversityAnalyzer(bool deserializing) : base(deserializing) { }
+    private QAPPopulationDiversityAnalyzer(QAPPopulationDiversityAnalyzer original, Cloner cloner) : base(original, cloner) { }
+    public QAPPopulationDiversityAnalyzer() : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new QAPPopulationDiversityAnalyzer(this, cloner);
+    }
+
+    protected override double[,] CalculateSimilarities(Permutation[] solutions) {
+      int count = solutions.Length;
+      double[,] similarities = new double[count, count];
+
+      for (int i = 0; i < count; i++) {
+        similarities[i, i] = 1;
+        for (int j = i + 1; j < count; j++) {
+          similarities[i, j] = CalculateSimilarity(solutions[i], solutions[j]);
+          similarities[j, i] = similarities[i, j];
+        }
+      }
+      return similarities;
+    }
+
+    private double CalculateSimilarity(Permutation assignment1, Permutation assignment2) {
+      int identicalAssignments = 0;
+      for (int i = 0; i < assignment1.Length; i++) {
+        if (assignment1[i] == assignment2[i])
+          identicalAssignments++;
+      }
+      return ((double)identicalAssignments) / assignment1.Length;
+    }
+  }
+}
Index: /branches/histogram/HeuristicLab.Problems.QuadraticAssignment/3.3/HeuristicLab.Problems.QuadraticAssignment-3.3.csproj
===================================================================
--- /branches/histogram/HeuristicLab.Problems.QuadraticAssignment/3.3/HeuristicLab.Problems.QuadraticAssignment-3.3.csproj	(revision 5995)
+++ /branches/histogram/HeuristicLab.Problems.QuadraticAssignment/3.3/HeuristicLab.Problems.QuadraticAssignment-3.3.csproj	(revision 5996)
@@ -109,4 +109,6 @@
   <ItemGroup>
     <Compile Include="Analyzers\BestQAPSolutionAnalyzer.cs" />
+    <Compile Include="Analyzers\QAPAlleleFrequencyAnalyzer.cs" />
+    <Compile Include="Analyzers\QAPPopulationDiversityAnalyzer.cs" />
     <Compile Include="Evaluators\QAPSwap2MoveEvaluator.cs" />
     <Compile Include="Evaluators\QAPEvaluator.cs" />
@@ -386,4 +388,8 @@
   </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>
+    </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
       <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
Index: /branches/histogram/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs
===================================================================
--- /branches/histogram/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs	(revision 5995)
+++ /branches/histogram/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs	(revision 5996)
@@ -88,4 +88,12 @@
       get { return Operators.OfType<BestQAPSolutionAnalyzer>().FirstOrDefault(); }
     }
+
+    private QAPAlleleFrequencyAnalyzer QAPAlleleFrequencyAnalyzer {
+      get { return Operators.OfType<QAPAlleleFrequencyAnalyzer>().FirstOrDefault(); }
+    }
+
+    private QAPPopulationDiversityAnalyzer QAPPopulationDiversityAnalyzer {
+      get { return Operators.OfType<QAPPopulationDiversityAnalyzer>().FirstOrDefault(); }
+    }
     #endregion
 
@@ -236,4 +244,6 @@
       Operators.AddRange(ApplicationManager.Manager.GetInstances<IPermutationOperator>());
       Operators.Add(new BestQAPSolutionAnalyzer());
+      Operators.Add(new QAPAlleleFrequencyAnalyzer());
+      Operators.Add(new QAPPopulationDiversityAnalyzer());
       ParameterizeAnalyzers();
       ParameterizeOperators();
@@ -262,4 +272,19 @@
         BestQAPSolutionAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name;
         BestQAPSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;
+      }
+      if (QAPAlleleFrequencyAnalyzer != null) {
+        QAPAlleleFrequencyAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
+        QAPAlleleFrequencyAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name;
+        QAPAlleleFrequencyAnalyzer.DistancesParameter.ActualName = DistancesParameter.Name;
+        QAPAlleleFrequencyAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;
+        QAPAlleleFrequencyAnalyzer.ResultsParameter.ActualName = "Results";
+        QAPAlleleFrequencyAnalyzer.SolutionParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
+        QAPAlleleFrequencyAnalyzer.WeightsParameter.ActualName = WeightsParameter.Name;
+      }
+      if (QAPPopulationDiversityAnalyzer != null) {
+        QAPPopulationDiversityAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;
+        QAPPopulationDiversityAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
+        QAPPopulationDiversityAnalyzer.ResultsParameter.ActualName = "Results";
+        QAPPopulationDiversityAnalyzer.SolutionParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;
       }
     }
