Index: branches/ALPS/HeuristicLab.Analysis/3.3/BestScopeSolutionAnalyzer.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/BestScopeSolutionAnalyzer.cs	(revision 11507)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/BestScopeSolutionAnalyzer.cs	(revision 11677)
@@ -20,4 +20,5 @@
 #endregion
 
+using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -37,8 +38,8 @@
   [StorableClass]
   public class BestScopeSolutionAnalyzer : SingleSuccessorOperator, IAnalyzer {
+
     public virtual bool EnabledByDefault {
       get { return true; }
     }
-
     public LookupParameter<BoolValue> MaximizationParameter {
       get { return (LookupParameter<BoolValue>)Parameters["Maximization"]; }
@@ -47,9 +48,6 @@
       get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
     }
-    public ILookupParameter<IScope> BestSolutionParameter {
-      get { return (ILookupParameter<IScope>)Parameters["BestSolution"]; }
-    }
-    public ILookupParameter<IScope> BestKnownSolutionParameter {
-      get { return (ILookupParameter<IScope>)Parameters["BestKnownSolution"]; }
+    public IFixedValueParameter<StringValue> BestSolutionResultNameParameter {
+      get { return (IFixedValueParameter<StringValue>)Parameters["BestSolution ResultName"]; }
     }
     public ILookupParameter<DoubleValue> BestKnownQualityParameter {
@@ -58,4 +56,9 @@
     public IValueLookupParameter<ResultCollection> ResultsParameter {
       get { return (IValueLookupParameter<ResultCollection>)Parameters["Results"]; }
+    }
+
+    public string BestSolutionResultName {
+      get { return BestSolutionResultNameParameter.Value.Value; }
+      set { BestSolutionResultNameParameter.Value.Value = value; }
     }
 
@@ -67,4 +70,10 @@
       return new BestScopeSolutionAnalyzer(this, cloner);
     }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      if (!Parameters.ContainsKey("BestSolution ResultName"))
+        Parameters.Add(new FixedValueParameter<StringValue>("BestSolution ResultName", "The name of the result for storing the best solution.", new StringValue("Best Solution")));
+    }
     #endregion
     public BestScopeSolutionAnalyzer()
@@ -72,6 +81,5 @@
       Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem."));
       Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the solutions."));
-      Parameters.Add(new LookupParameter<IScope>("BestSolution", "The best solution."));
-      Parameters.Add(new LookupParameter<IScope>("BestKnownSolution", "The best known solution."));
+      Parameters.Add(new FixedValueParameter<StringValue>("BestSolution ResultName", "The name of the result for storing the best solution.", new StringValue("Best Solution")));
       Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution."));
       Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the solution should be stored."));
@@ -84,4 +92,8 @@
       DoubleValue bestKnownQuality = BestKnownQualityParameter.ActualValue;
 
+      if (results.ContainsKey(BestSolutionResultName) && !typeof(IScope).IsAssignableFrom(results[BestSolutionResultName].DataType)) {
+        throw new InvalidOperationException(string.Format("Could not add best solution result, because there is already a result with the name \"{0}\" present in the result collection.", BestSolutionResultName));
+      }
+
       int i = -1;
       if (!max)
@@ -91,5 +103,5 @@
       IEnumerable<IScope> scopes = new IScope[] { ExecutionContext.Scope };
       for (int j = 0; j < QualityParameter.Depth; j++)
-        scopes = scopes.Select(x => (IEnumerable<IScope>)x.SubScopes).Aggregate((a, b) => a.Concat(b));
+        scopes = scopes.SelectMany(x => x.SubScopes);
       IScope currentBestScope = scopes.ToList()[i];
 
@@ -98,25 +110,29 @@
           || !max && qualities[i].Value < bestKnownQuality.Value) {
         BestKnownQualityParameter.ActualValue = new DoubleValue(qualities[i].Value);
-        BestKnownSolutionParameter.ActualValue = (IScope)currentBestScope.Clone();
       }
 
-      IScope solution = BestSolutionParameter.ActualValue;
-      if (solution == null) {
-        solution = (IScope)currentBestScope.Clone();
-        BestSolutionParameter.ActualValue = solution;
-        results.Add(new Result("Best Solution", solution));
+      if (!results.ContainsKey(BestSolutionResultName)) {
+        var cloner = new Cloner();
+        //avoid cloning of subscopes
+        cloner.RegisterClonedObject(currentBestScope.SubScopes, new ScopeList());
+        var solution = cloner.Clone(currentBestScope);
+
+        results.Add(new Result(BestSolutionResultName, solution));
       } else {
+        var bestSolution = (IScope)results[BestSolutionResultName].Value;
         string qualityName = QualityParameter.TranslatedName;
-        if (solution.Variables.ContainsKey(qualityName)) {
-          double bestSoFarQuality = (solution.Variables[qualityName].Value as DoubleValue).Value;
-          if (max && qualities[i].Value > bestSoFarQuality
-            || !max && qualities[i].Value < bestSoFarQuality) {
-            solution = (IScope)currentBestScope.Clone();
-            BestSolutionParameter.ActualValue = solution;
-            results["Best Solution"].Value = solution;
+        if (bestSolution.Variables.ContainsKey(qualityName)) {
+          double bestQuality = ((DoubleValue)bestSolution.Variables[qualityName].Value).Value;
+          if (max && qualities[i].Value > bestQuality
+              || !max && qualities[i].Value < bestQuality) {
+            var cloner = new Cloner();
+            //avoid cloning of subscopes
+            cloner.RegisterClonedObject(currentBestScope.SubScopes, new ScopeList());
+            var solution = cloner.Clone(currentBestScope);
+
+            results[BestSolutionResultName].Value = solution;
           }
         }
       }
-
       return base.Apply();
     }
Index: branches/ALPS/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj	(revision 11507)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj	(revision 11677)
@@ -11,5 +11,5 @@
     <RootNamespace>HeuristicLab.Analysis</RootNamespace>
     <AssemblyName>HeuristicLab.Analysis-3.3</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <TargetFrameworkProfile>
     </TargetFrameworkProfile>
@@ -46,4 +46,5 @@
     <WarningLevel>4</WarningLevel>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@@ -57,4 +58,5 @@
     </DocumentationFile>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
@@ -66,4 +68,5 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
@@ -77,4 +80,5 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
@@ -86,4 +90,5 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
@@ -97,4 +102,5 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <ItemGroup>
@@ -153,4 +159,5 @@
     <Compile Include="QualityAnalysis\QualityDistributionAnalyzer.cs" />
     <Compile Include="QualityAnalysis\ScaledQualityDifferenceAnalyzer.cs" />
+    <Compile Include="Statistics\NormalDistribution.cs" />
     <Compile Include="ValueAnalysis\SingleValueAnalyzer.cs" />
     <Compile Include="ValueAnalysis\MinAverageMaxValueAnalyzer.cs" />
@@ -236,4 +243,5 @@
     </BootstrapperPackage>
   </ItemGroup>
+  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
@@ -245,5 +253,5 @@
   -->
   <PropertyGroup>
-   <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
 set ProjectDir=$(ProjectDir)
 set SolutionDir=$(SolutionDir)
@@ -252,5 +260,5 @@
 call PreBuildEvent.cmd
 </PreBuildEvent>
-<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
 export ProjectDir=$(ProjectDir)
 export SolutionDir=$(SolutionDir)
Index: branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/NormalDistribution.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/NormalDistribution.cs	(revision 11677)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/NormalDistribution.cs	(revision 11677)
@@ -0,0 +1,68 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2014 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.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+
+namespace HeuristicLab.Analysis.Statistics {
+  public static class NormalDistribution {
+    public static double[] Density(double[] x, double mean, double stdDev) {
+      double[] result = new double[x.Length];
+
+      for (int i = 0; i < x.Length; i++) {
+        result[i] = (1.0 / (stdDev * Math.Sqrt(2.0 * Math.PI))) *
+                    Math.Exp(-((Math.Pow(x[i] - mean, 2.0)) /
+                               (2.0 * Math.Pow(stdDev, 2.0))));
+      }
+
+      return result;
+    }
+
+    // based on the idea from http://www.statmethods.net/graphs/density.html
+    public static List<Tuple<double, double>> Density(double[] x, int nrOfPoints, double stepWidth) {
+      double[] newX = new double[nrOfPoints];
+      double mean = x.Average();
+      double stdDev = x.StandardDeviation();
+      double margin = stepWidth * 2;
+
+      double dataMin = x.Min() - margin;
+      double dataMax = x.Max() + margin;
+      double diff = (dataMax - dataMin) / nrOfPoints;
+      double cur = dataMin;
+      newX[0] = cur;
+      for (int i = 1; i < nrOfPoints; i++) {
+        cur += diff;
+        newX[i] = cur;
+      }
+
+      var y = Density(newX, mean, stdDev).Select(k => k * stepWidth * x.Length).ToList();
+
+      var points = new List<Tuple<double, double>>();
+      for (int i = 0; i < newX.Length; i++) {
+        points.Add(new Tuple<double, double>(newX[i], y[i]));
+      }
+
+      return points;
+    }
+  }
+}
