Index: branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/BinaryVectorDiversityCalculator.cs
===================================================================
--- branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/BinaryVectorDiversityCalculator.cs	(revision 7744)
+++ branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/BinaryVectorDiversityCalculator.cs	(revision 7744)
@@ -0,0 +1,53 @@
+﻿#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.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.BinaryVectorEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Algorithms.ScatterSearch.Knapsack {
+  /// <summary>
+  /// An operator that performs diversity calculation between bool-valued vectors.
+  /// </summary>
+  [Item("BinaryVectorDiversityCalculator", "An operator that performs diversity calculation between bool-valued vectors.")]
+  [StorableClass]
+  public sealed class BinaryVectorDiversityCalculator : HeuristicLab.Algorithms.ScatterSearch.DiversityCalculator {
+    [StorableConstructor]
+    private BinaryVectorDiversityCalculator(bool deserializing) : base(deserializing) { }
+    private BinaryVectorDiversityCalculator(BinaryVectorDiversityCalculator original, Cloner cloner) : base(original, cloner) { }
+    public BinaryVectorDiversityCalculator() : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new BinaryVectorDiversityCalculator(this, cloner);
+    }
+
+    protected override int CalculateDiversity(IItem left, IItem right) {
+      var v1 = left as BinaryVector;
+      var v2 = right as BinaryVector;
+      int diversity = 0;
+      if (v1 != null && v2 != null)
+        for (int i = 0; i < v1.Length; i++)
+          if (v1[i] != v2[i]) diversity++;
+      return diversity;
+    }
+  }
+}
Index: branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/DiversityCalculator.cs
===================================================================
--- branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/DiversityCalculator.cs	(revision 7740)
+++ 	(revision )
@@ -1,16 +1,0 @@
-﻿using HeuristicLab.Core;
-using HeuristicLab.Encodings.BinaryVectorEncoding;
-
-namespace HeuristicLab.Algorithms.ScatterSearch.Knapsack {
-  public sealed class DiversityCalculator {
-    public static int CalculateDiversity(IItem p, IItem r) {
-      BinaryVector pSol = p as BinaryVector;
-      BinaryVector rSol = r as BinaryVector;
-      int diversity = 0;
-      if (pSol != null && rSol != null)
-        for (int i = 0; i < pSol.Length; i++)
-          if (pSol[i] != rSol[i]) diversity++;
-      return diversity;
-    }
-  }
-}
Index: branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/KnapsackImprovementOperator.cs
===================================================================
--- branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/KnapsackImprovementOperator.cs	(revision 7744)
+++ branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/KnapsackImprovementOperator.cs	(revision 7744)
@@ -0,0 +1,177 @@
+﻿#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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.BinaryVectorEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.Knapsack;
+
+namespace HeuristicLab.Algorithms.ScatterSearch.Knapsack {
+  /// <summary>
+  /// An operator that improves knapsack solutions.
+  /// </summary>
+  [Item("KnapsackImprovementOperator", "An operator that improves knapsack solutions.")]
+  [StorableClass]
+  public sealed class KnapsackImprovementOperator : SingleSuccessorOperator, ILocalImprovementOperator, IScatterSearchTargetProcessor {
+
+    #region Problem properties
+    public Type ProblemType {
+      get { return typeof(KnapsackProblem); }
+    }
+    [Storable]
+    private KnapsackProblem problem;
+    public IProblem Problem {
+      get { return problem; }
+      set { problem = (KnapsackProblem)value; }
+    }
+    #endregion
+
+    #region Parameter properties
+    public ScopeParameter CurrentScopeParameter {
+      get { return (ScopeParameter)Parameters["CurrentScope"]; }
+    }
+    public IValueLookupParameter<IntArray> ValuesParameter {
+      get { return (IValueLookupParameter<IntArray>)Parameters["Values"]; }
+    }
+    public IValueLookupParameter<IntArray> WeightsParameter {
+      get { return (IValueLookupParameter<IntArray>)Parameters["Weights"]; }
+    }
+    public IValueLookupParameter<IntValue> KnapsackCapacityParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["KnapsackCapacity"]; }
+    }
+    public IValueLookupParameter<IItem> TargetParameter {
+      get { return (IValueLookupParameter<IItem>)Parameters["Target"]; }
+    }
+    #region ILocalImprovementOperator Parameters
+    public IValueLookupParameter<IntValue> MaximumIterationsParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["MaximumIterations"]; }
+    }
+    public ILookupParameter<IntValue> EvaluatedSolutionsParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; }
+    }
+    public ILookupParameter<ResultCollection> ResultsParameter {
+      get { return (ILookupParameter<ResultCollection>)Parameters["Results"]; }
+    }
+    #endregion
+    #endregion
+
+    #region Properties
+    private IScope CurrentScope {
+      get { return CurrentScopeParameter.ActualValue; }
+    }
+    private IntArray Values {
+      get { return ValuesParameter.ActualValue; }
+      set { ValuesParameter.ActualValue = value; }
+    }
+    private IntArray Weights {
+      get { return WeightsParameter.ActualValue; }
+      set { WeightsParameter.ActualValue = value; }
+    }
+    private IntValue KnapsackCapacity {
+      get { return KnapsackCapacityParameter.ActualValue; }
+      set { KnapsackCapacityParameter.ActualValue = value; }
+    }
+    private IItem Target {
+      get { return TargetParameter.ActualValue; }
+    }
+    #endregion
+
+    [StorableConstructor]
+    private KnapsackImprovementOperator(bool deserializing) : base(deserializing) { }
+    private KnapsackImprovementOperator(KnapsackImprovementOperator original, Cloner cloner)
+      : base(original, cloner) {
+      this.problem = cloner.Clone(original.problem);
+    }
+    public KnapsackImprovementOperator()
+      : base() {
+      #region Create parameters
+      Parameters.Add(new ScopeParameter("CurrentScope"));
+      Parameters.Add(new ValueLookupParameter<IntArray>("Values"));
+      Parameters.Add(new ValueLookupParameter<IntArray>("Weights"));
+      Parameters.Add(new ValueLookupParameter<IntValue>("KnapsackCapacity"));
+      Parameters.Add(new ValueLookupParameter<IItem>("Target"));
+      #endregion
+      TargetParameter.ActualName = "KnapsackSolution"; // temporary solution for the knapsack problem
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new KnapsackImprovementOperator(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      var sol = CurrentScope.Variables[TargetParameter.ActualName].Value as BinaryVector;
+
+      // calculate value-to-weight ratio
+      double[] ratio = new double[Values.Length];
+      for (int i = 0; i < ratio.Length; i++) {
+        ratio[i] = (double)Values[i] / (double)Weights[i];
+      }
+
+      // calculate order for ratio
+      int[] order = new int[ratio.Length];
+      ratio.Select((x, index) => new { Value = x, ValueIndex = index })
+           .OrderBy(x => x.Value)
+           .Select((x, index) => new { ValueIndex = x.ValueIndex, ItemIndex = index }).ToList()
+           .ForEach(x => order[x.ItemIndex] = x.ValueIndex);
+
+      int j = sol.Length - 1;
+      while (KnapsackEvaluator.Apply(sol, KnapsackCapacity, new DoubleValue(1.0), Weights, Values).SumWeights.Value > KnapsackCapacity.Value && j >= 0) {
+        sol[order[j--]] = false;
+      }
+
+      // calculate weight
+      int lhs = 0;
+      for (int i = 0; i < sol.Length; i++) {
+        if (sol[i]) lhs += Weights[i];
+      }
+
+      // improve solution
+      bool feasible = true; j = 0;
+      while (feasible && j < sol.Length) {
+        while (sol[order[j]]) j++;
+        if (lhs + Weights[order[j]] <= KnapsackCapacity.Value) {
+          sol[order[j]] = true;
+          lhs += Weights[order[j]];
+        } else {
+          feasible = false;
+        }
+      }
+
+      CurrentScope.Variables[TargetParameter.ActualName].Value = sol;
+
+      return base.Apply();
+    }
+
+    private bool IsFeasiblse(BinaryVector sol) {
+      int sum = 0;
+      for (int i = 0; i < sol.Length; i++)
+        if (sol[i]) sum += Weights[i];
+      return sum <= KnapsackCapacity.Value;
+    }
+  }
+}
Index: branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/NBinaryVectorCrossover.cs
===================================================================
--- branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/NBinaryVectorCrossover.cs	(revision 7740)
+++ branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/NBinaryVectorCrossover.cs	(revision 7744)
@@ -71,5 +71,4 @@
 
     public sealed override IOperation Apply() {
-      //ChildrenParameter.ActualValue = Cross(RandomParameter.ActualValue, ParentsParameter.ActualValue);
       var offspringSolutions = Cross(RandomParameter.ActualValue, ParentsParameter.ActualValue);
       for (int i = 0; i < offspringSolutions.Length; i++) {
Index: branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/NChildCrossover.cs
===================================================================
--- branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/NChildCrossover.cs	(revision 7740)
+++ branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/NChildCrossover.cs	(revision 7744)
@@ -35,7 +35,9 @@
   [StorableClass]
   public sealed class NChildCrossover : NBinaryVectorCrossover {
+    #region Parameter properties
     public IValueLookupParameter<IntValue> NParameter {
       get { return (IValueLookupParameter<IntValue>)Parameters["N"]; }
     }
+    #endregion
 
     [StorableConstructor]
@@ -44,5 +46,7 @@
     public NChildCrossover()
       : base() {
+      #region Create parameters
       Parameters.Add(new ValueLookupParameter<IntValue>("N", "Number of children.", new IntValue(2)));
+      #endregion
     }
 
@@ -53,11 +57,11 @@
     public static ItemArray<BinaryVector> Apply(IRandom random, BinaryVector parent1, BinaryVector parent2, IntValue n) {
       if (parent1.Length != parent2.Length)
-        throw new ArgumentException("NPointCrossover: The parents are of different length.");
+        throw new ArgumentException("NChildCrossover: The parents are of different length.");
 
       if (n.Value > Math.Pow(2, parent1.Length) - 2)
-        throw new ArgumentException("NPointCrossover: There cannot be more breakpoints than the size of the parents.");
+        throw new ArgumentException("NChildCrossover: There cannot be more children than 2^size of parents - 2.");
 
       if (n.Value < 1)
-        throw new ArgumentException("NPointCrossover: N cannot be < 1.");
+        throw new ArgumentException("NChildCrossover: N cannot be < 1.");
 
       var solutions = new BinaryVector[n.Value];
