Index: trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs	(revision 15099)
+++ trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs	(revision 15102)
@@ -36,5 +36,5 @@
 
 namespace HeuristicLab.Algorithms.ParticleSwarmOptimization {
-  [Item("Particle Swarm Optimization (PSO)", "A particle swarm optimization algorithm based on the description in Pedersen, M.E.H. (2010). PhD thesis. University of Southampton.")]
+  [Item("Particle Swarm Optimization (PSO)", "A particle swarm optimization algorithm based on Standard PSO (SPSO) as described in Clerc, M. (2012). Standard particle swarm optimisation.")]
   [Creatable(CreatableAttribute.Categories.PopulationBasedAlgorithms, Priority = 300)]
   [StorableClass]
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/HeuristicLab.Encodings.RealVectorEncoding-3.3.csproj
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/HeuristicLab.Encodings.RealVectorEncoding-3.3.csproj	(revision 15099)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/HeuristicLab.Encodings.RealVectorEncoding-3.3.csproj	(revision 15102)
@@ -116,7 +116,14 @@
     <Compile Include="Creators\NormalDistributedRealVectorCreator.cs" />
     <Compile Include="Interfaces\IRealVectorMultiNeighborhoodShakingOperator.cs" />
+    <Compile Include="ParticleOperators\RealVectorNeighborhoodParticleUpdater.cs" />
+    <Compile Include="ParticleOperators\RealVectorParticleCreator.cs" />
+    <Compile Include="ParticleOperators\RealVectorParticleUpdater.cs" />
+    <Compile Include="ParticleOperators\RealVectorSwarmUpdater.cs" />
+    <Compile Include="ParticleOperators\RealVectorTotallyConnectedParticleUpdater.cs" />
+    <Compile Include="ParticleOperators\SPSO2007VelocityInitializer.cs" />
+    <Compile Include="ParticleOperators\SPSOVelocityInitializer.cs" />
     <Compile Include="ParticleOperators\SPSO2011ParticleUpdater.cs" />
     <Compile Include="ParticleOperators\SPSO2007ParticleUpdater.cs" />
-    <Compile Include="ParticleOperators\RealVectorParticleCreator.cs" />
+    <Compile Include="ParticleOperators\SPSOParticleCreator.cs" />
     <Compile Include="Crossovers\BlendAlphaBetaCrossover.cs" />
     <Compile Include="Interfaces\IRealVectorManipulator.cs" />
@@ -130,9 +137,7 @@
     <Compile Include="Interfaces\IRealVectorSwarmUpdater.cs" />
     <Compile Include="Manipulators\SelfAdaptiveNormalAllPositionsManipulator.cs" />
-    <Compile Include="ParticleOperators\RealVectorNeighborhoodParticleUpdater.cs" />
-    <Compile Include="ParticleOperators\RealVectorParticleUpdater.cs" />
-    <Compile Include="ParticleOperators\RealVectorSwarmUpdater.cs" />
-    <Compile Include="ParticleOperators\RealVectorTotallyConnectedParticleUpdater.cs" />
-    <Compile Include="ParticleOperators\RealVectorVelocityInitializer.cs" />
+    <Compile Include="ParticleOperators\SPSOParticleUpdater.cs" />
+    <Compile Include="ParticleOperators\SPSO2011VelocityInitializer.cs" />
+    <Compile Include="ParticleOperators\SPSOSwarmUpdater.cs" />
     <Compile Include="Plugin.cs" />
     <Compile Include="RealVectorCreator.cs" />
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorNeighborhoodParticleUpdater.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorNeighborhoodParticleUpdater.cs	(revision 15099)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorNeighborhoodParticleUpdater.cs	(revision 15102)
@@ -30,5 +30,5 @@
   [StorableClass]
   [NonDiscoverableType]
-  [Obsolete("Replaced by SPSO2007ParticleUpdater")]
+  [Obsolete("Use SPSO2011ParticleUpdater")]
   internal sealed class RealVectorNeighborhoodParticleUpdater : RealVectorParticleUpdater {
 
@@ -43,59 +43,22 @@
     #endregion
 
-    private void UpdateVelocity() {
-      var velocity = VelocityParameter.ActualValue;
-      var position = RealVectorParameter.ActualValue;
-      var inertia = CurrentInertiaParameter.ActualValue.Value;
-      var personalBest = PersonalBestParameter.ActualValue;
-      var personalBestAttraction = PersonalBestAttractionParameter.ActualValue.Value;
-      var neighborBest = NeighborBestParameter.ActualValue;
-      var neighborBestAttraction = NeighborBestAttractionParameter.ActualValue.Value;
+    public override IOperation Apply() {
+      double inertia = Inertia.Value;
+      double personalBestAttraction = PersonalBestAttraction.Value;
+      double neighborBestAttraction = NeighborBestAttraction.Value;
 
-      var random = RandomParameter.ActualValue;
+      RealVector velocity = new RealVector(Velocity.Length);
+      RealVector position = new RealVector(RealVector.Length);
+      double r_p = Random.NextDouble();
+      double r_g = Random.NextDouble();
 
       for (int i = 0; i < velocity.Length; i++) {
-        double r_p = random.NextDouble();
-        double r_g = random.NextDouble();
         velocity[i] =
-          velocity[i] * inertia +
-          (personalBest[i] - position[i]) * personalBestAttraction * r_p +
-          (neighborBest[i] - position[i]) * neighborBestAttraction * r_g;
+          Velocity[i] * inertia +
+          (PersonalBest[i] - RealVector[i]) * personalBestAttraction * r_p +
+          (BestPoint[i] - RealVector[i]) * neighborBestAttraction * r_g;
       }
 
-      var maxVelocity = CurrentMaxVelocityParameter.ActualValue.Value;
-      var speed = Math.Sqrt(velocity.DotProduct(velocity));
-      if (speed > maxVelocity) {
-        for (var i = 0; i < velocity.Length; i++) {
-          velocity[i] *= maxVelocity / speed;
-        }
-      }
-    }
-
-    private void UpdatePosition() {
-      var velocity = VelocityParameter.ActualValue;
-      var position = RealVectorParameter.ActualValue;
-
-      for (int i = 0; i < velocity.Length; i++) {
-        position[i] += velocity[i];
-      }
-
-      var bounds = BoundsParameter.ActualValue;
-      for (int i = 0; i < position.Length; i++) {
-        double min = bounds[i % bounds.Rows, 0];
-        double max = bounds[i % bounds.Rows, 1];
-        if (position[i] < min) {
-          position[i] = min;
-          velocity[i] = -0.5 * velocity[i]; // SPSO 2011
-        }
-        if (position[i] > max) {
-          position[i] = max;
-          velocity[i] = -0.5 * velocity[i]; // SPSO 2011
-        }
-      }
-    }
-
-    public override IOperation Apply() {
-      UpdateVelocity();
-      UpdatePosition();
+      MoveParticle(velocity, position);
 
       return base.Apply();
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleCreator.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleCreator.cs	(revision 15099)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleCreator.cs	(revision 15102)
@@ -20,4 +20,5 @@
 #endregion
 
+using System;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -27,13 +28,16 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.PluginInfrastructure;
 
 namespace HeuristicLab.Encodings.RealVectorEncoding {
   [Item("RealVectorParticleCreator", "Creates a particle with position, zero velocity vector and personal best.")]
   [StorableClass]
-  public class RealVectorParticleCreator : AlgorithmOperator, IRealVectorParticleCreator, IStochasticOperator {
+  [NonDiscoverableType]
+  [Obsolete("Use SPSOParticleCreator")]
+  internal class RealVectorParticleCreator : AlgorithmOperator, IRealVectorParticleCreator {
 
     #region Parameters
-    public ILookupParameter<IRandom> RandomParameter {
-      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
+    public ILookupParameter<IntValue> ProblemSizeParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["ProblemSize"]; }
     }
     public IValueLookupParameter<DoubleMatrix> BoundsParameter {
@@ -53,5 +57,14 @@
     }
     #endregion
-    
+
+    #region Parameter Values
+    protected int ProblemSize {
+      get { return ProblemSizeParameter.ActualValue.Value; }
+    }
+    protected RealVector Velocity {
+      set { VelocityParameter.ActualValue = value; }
+    }
+    #endregion
+
     #region Construction & Cloning
     [StorableConstructor]
@@ -60,5 +73,5 @@
     public RealVectorParticleCreator()
       : base() {
-      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));
+      Parameters.Add(new LookupParameter<IntValue>("ProblemSize", "The dimension of the problem."));
       Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds in each dimension."));
       Parameters.Add(new LookupParameter<RealVector>("RealVector", "Particle's current solution"));
@@ -67,22 +80,17 @@
       Parameters.Add(new LookupParameter<ISolutionCreator>("SolutionCreator", "The operator that creates the initial position."));
 
-      Placeholder realVectorCreater = new Placeholder();
+      UniformRandomRealVectorCreator realVectorCreater = new UniformRandomRealVectorCreator();
       Assigner personalBestPositionAssigner = new Assigner();
-      RealVectorVelocityInitializer velocityInitializer = new RealVectorVelocityInitializer();
 
       OperatorGraph.InitialOperator = realVectorCreater;
 
-      realVectorCreater.OperatorParameter.ActualName = SolutionCreatorParameter.Name;
+      realVectorCreater.RealVectorParameter.ActualName = RealVectorParameter.Name;
+      realVectorCreater.LengthParameter.ActualName = ProblemSizeParameter.Name;
+      realVectorCreater.BoundsParameter.ActualName = BoundsParameter.Name;
       realVectorCreater.Successor = personalBestPositionAssigner;
 
       personalBestPositionAssigner.LeftSideParameter.ActualName = PersonalBestParameter.Name;
       personalBestPositionAssigner.RightSideParameter.ActualName = RealVectorParameter.Name;
-      personalBestPositionAssigner.Successor = velocityInitializer;
-
-      velocityInitializer.BoundsParameter.ActualName = BoundsParameter.Name;
-      velocityInitializer.RandomParameter.ActualName = RandomParameter.Name;
-      velocityInitializer.RealVectorParameter.ActualName = RealVectorParameter.Name;
-      velocityInitializer.VelocityParameter.ActualName = VelocityParameter.Name;
-      velocityInitializer.Successor = null;
+      personalBestPositionAssigner.Successor = null;
     }
     public override IDeepCloneable Clone(Cloner cloner) {
@@ -90,4 +98,15 @@
     }
     #endregion
+
+    public override IOperation Apply() {
+      Velocity = new RealVector(ProblemSize);
+      return base.Apply();
+    }
+    
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      if (!Parameters.ContainsKey("SolutionCreator"))
+        Parameters.Add(new LookupParameter<ISolutionCreator>("SolutionCreator", "The operator that creates the initial position."));
+    }
   }
 }
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleUpdater.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleUpdater.cs	(revision 15099)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleUpdater.cs	(revision 15102)
@@ -19,12 +19,13 @@
  */
 #endregion
- 
+
+using System;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Data;
 using HeuristicLab.Operators;
-using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.PluginInfrastructure;
 
 namespace HeuristicLab.Encodings.RealVectorEncoding {
@@ -32,5 +33,7 @@
   [Item("RealVectorParticleUpdater", "Updates a certain particle taking the current position and velocity into account, as well as the best point and the best point in a local neighborhood.")]
   [StorableClass]
-  public abstract class RealVectorParticleUpdater : SingleSuccessorOperator, IRealVectorParticleUpdater {
+  [NonDiscoverableType]
+  [Obsolete("Use SPSO2011ParticleUpdater")]
+  internal abstract class RealVectorParticleUpdater : SingleSuccessorOperator, IRealVectorParticleUpdater {
 
     public override bool CanChangeName {
@@ -51,4 +54,7 @@
       get { return (ILookupParameter<RealVector>)Parameters["NeighborBest"]; }
     }
+    public LookupParameter<RealVector> BestRealVectorParameter {
+      get { return (LookupParameter<RealVector>)Parameters["BestRealVector"]; }
+    }
     public ILookupParameter<RealVector> RealVectorParameter {
       get { return (ILookupParameter<RealVector>)Parameters["RealVector"]; }
@@ -57,12 +63,13 @@
       get { return (ILookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
     }
+    public ILookupParameter<DoubleMatrix> CurrentVelocityBoundsParameter {
+      get { return (ILookupParameter<DoubleMatrix>)Parameters["CurrentVelocityBounds"]; }
+    }
     public ILookupParameter<DoubleValue> CurrentMaxVelocityParameter {
       get { return (ILookupParameter<DoubleValue>)Parameters["CurrentMaxVelocity"]; }
     }
-    public ILookupParameter<DoubleValue> CurrentInertiaParameter {
+    public ILookupParameter<DoubleValue> InertiaParameter {
       get { return (ILookupParameter<DoubleValue>)Parameters["CurrentInertia"]; }
     }
-    ILookupParameter<DoubleValue> IParticleUpdater.InertiaParameter { get { return CurrentInertiaParameter; } }
-
     public ILookupParameter<DoubleValue> PersonalBestAttractionParameter {
       get { return (ILookupParameter<DoubleValue>)Parameters["PersonalBestAttraction"]; }
@@ -72,5 +79,43 @@
     }
     #endregion
-    
+
+    #region Parameter Values
+    protected IRandom Random {
+      get { return RandomParameter.ActualValue; }
+    }
+    protected RealVector Velocity {
+      get { return VelocityParameter.ActualValue; }
+      set { VelocityParameter.ActualValue = value; }
+    }
+    protected RealVector PersonalBest {
+      get { return PersonalBestParameter.ActualValue; }
+    }
+    protected RealVector BestPoint {
+      get { return BestRealVectorParameter.ActualValue; }
+    }
+    protected RealVector RealVector {
+      get { return RealVectorParameter.ActualValue; }
+      set { RealVectorParameter.ActualValue = value; }
+    }
+    protected RealVector NeighborBest {
+      get { return NeighborBestParameter.ActualValue; }
+    }
+    protected DoubleMatrix Bounds {
+      get { return BoundsParameter.ActualValue; }
+    }
+    protected DoubleMatrix CurrentVelocityBounds {
+      get { return CurrentVelocityBoundsParameter.ActualValue; }
+    }
+    protected DoubleValue Inertia {
+      get { return InertiaParameter.ActualValue; }
+    }
+    protected DoubleValue PersonalBestAttraction {
+      get { return PersonalBestAttractionParameter.ActualValue; }
+    }
+    protected DoubleValue NeighborBestAttraction {
+      get { return NeighborBestAttractionParameter.ActualValue; }
+    }
+    #endregion
+
     #region Construction & Cloning
     [StorableConstructor]
@@ -83,6 +128,8 @@
       Parameters.Add(new LookupParameter<RealVector>("Velocity", "Particle's current velocity."));
       Parameters.Add(new LookupParameter<RealVector>("PersonalBest", "Particle's personal best solution."));
+      Parameters.Add(new LookupParameter<RealVector>("BestRealVector", "Global best position."));
       Parameters.Add(new LookupParameter<RealVector>("NeighborBest", "Best neighboring solution."));
       Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds for each dimension of the position vector for the current problem."));
+      Parameters.Add(new LookupParameter<DoubleMatrix>("CurrentVelocityBounds", "Upper and lower bounds for the particle's velocity vector."));
       Parameters.Add(new LookupParameter<DoubleValue>("CurrentMaxVelocity", "Maximum for the particle's velocity vector."));
       Parameters.Add(new LookupParameter<DoubleValue>("CurrentInertia", "The weight for the particle's velocity vector."));
@@ -91,4 +138,49 @@
     }
     #endregion
+    
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      if (!Parameters.ContainsKey("CurrentMaxVelocity"))
+        Parameters.Add(new LookupParameter<DoubleValue>("CurrentMaxVelocity", "Maximum for the particle's velocity vector."));
+    }
+
+    protected void MoveParticle(RealVector velocity, RealVector position) {
+      BoundsChecker.Apply(velocity, CurrentVelocityBounds);
+      for (int i = 0; i < velocity.Length; i++) {
+        position[i] = RealVector[i] + velocity[i];
+      }
+      for (int i = 0; i < position.Length; i++) {
+        double min = Bounds[i % Bounds.Rows, 0];
+        double max = Bounds[i % Bounds.Rows, 1];
+        if (position[i] < min) {
+          int reflectionCount = (int)Math.Truncate((min - position[i]) / (max - min)) + 1;
+          double reflection = (min - position[i]) % (max - min);
+          if (IsOdd(reflectionCount)) {
+            position[i] = min + reflection;
+            velocity[i] = -velocity[i];
+
+          } else {
+            position[i] = max - reflection;
+          }
+        }
+        if (position[i] > max) {
+          int reflectionCount = (int)Math.Truncate((position[i] - max) / (max - min)) + 1;
+          double reflection = (position[i] - max) % (max - min);
+          if (IsOdd(reflectionCount)) {
+            position[i] = max - reflection;
+            velocity[i] = -velocity[i];
+          } else {
+            position[i] = min + reflection;
+          }
+        }
+      }
+
+      RealVector = position;
+      Velocity = velocity;
+    }
+
+    private static bool IsOdd(int number) {
+      return number % 2 == 1;
+    }
   }
 }
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorSwarmUpdater.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorSwarmUpdater.cs	(revision 15099)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorSwarmUpdater.cs	(revision 15102)
@@ -21,5 +21,4 @@
 
 using System;
-using System.Collections.Generic;
 using System.Linq;
 using HeuristicLab.Common;
@@ -36,5 +35,7 @@
   [Item("RealVectorSwarmUpdater", "Updates personal best point and quality as well as global best point and quality.")]
   [StorableClass]
-  public sealed class RealVectorSwarmUpdater : SingleSuccessorOperator, IRealVectorSwarmUpdater, ISingleObjectiveOperator {
+  [NonDiscoverableType]
+  [Obsolete("Use SPSOSwarmUpdater")]
+  internal sealed class RealVectorSwarmUpdater : SingleSuccessorOperator, IRealVectorSwarmUpdater, ISingleObjectiveOperator {
 
     [Storable]
@@ -76,9 +77,9 @@
       get { return (IScopeTreeLookupParameter<IntArray>)Parameters["Neighbors"]; }
     }
-    public IValueLookupParameter<DoubleValue> MaxVelocityParameter {
-      get { return (ValueLookupParameter<DoubleValue>)Parameters["MaxVelocity"]; }
-    }
-    public ILookupParameter<DoubleValue> CurrentMaxVelocityParameter {
-      get { return (ILookupParameter<DoubleValue>)Parameters["CurrentMaxVelocity"]; }
+    public IValueLookupParameter<DoubleMatrix> VelocityBoundsParameter {
+      get { return (ValueLookupParameter<DoubleMatrix>)Parameters["VelocityBounds"]; }
+    }
+    public ILookupParameter<DoubleMatrix> CurrentVelocityBoundsParameter {
+      get { return (ILookupParameter<DoubleMatrix>)Parameters["CurrentVelocityBounds"]; }
     }
     public LookupParameter<ResultCollection> ResultsParameter {
@@ -86,24 +87,90 @@
     }
 
-    #region Max Velocity Updating
-    public IConstrainedValueParameter<IDiscreteDoubleValueModifier> MaxVelocityScalingOperatorParameter {
-      get { return (IConstrainedValueParameter<IDiscreteDoubleValueModifier>)Parameters["MaxVelocityScalingOperator"]; }
-    }
-    public IValueLookupParameter<DoubleValue> FinalMaxVelocityParameter {
-      get { return (IValueLookupParameter<DoubleValue>)Parameters["FinalMaxVelocity"]; }
-    }
-    public ILookupParameter<IntValue> MaxVelocityIndexParameter {
-      get { return (ILookupParameter<IntValue>)Parameters["MaxVelocityIndex"]; }
-    }
-    public IValueLookupParameter<IntValue> MaxVelocityStartIndexParameter {
-      get { return (IValueLookupParameter<IntValue>)Parameters["MaxVelocityStartIndex"]; }
-    }
-    public IValueLookupParameter<IntValue> MaxVelocityEndIndexParameter {
-      get { return (IValueLookupParameter<IntValue>)Parameters["MaxVelocityEndIndex"]; }
+    #region Velocity Bounds Updating
+    public ILookupParameter<DoubleValue> VelocityBoundsScaleParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["VelocityBoundsScale"]; }
+    }
+    public IConstrainedValueParameter<IDiscreteDoubleValueModifier> VelocityBoundsScalingOperatorParameter {
+      get { return (IConstrainedValueParameter<IDiscreteDoubleValueModifier>)Parameters["VelocityBoundsScalingOperator"]; }
+    }
+    public IValueLookupParameter<DoubleValue> VelocityBoundsStartValueParameter {
+      get { return (IValueLookupParameter<DoubleValue>)Parameters["VelocityBoundsStartValue"]; }
+    }
+    public IValueLookupParameter<DoubleValue> VelocityBoundsEndValueParameter {
+      get { return (IValueLookupParameter<DoubleValue>)Parameters["VelocityBoundsEndValue"]; }
+    }
+    public ILookupParameter<IntValue> VelocityBoundsIndexParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["VelocityBoundsIndex"]; }
+    }
+    public IValueLookupParameter<IntValue> VelocityBoundsStartIndexParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["VelocityBoundsStartIndex"]; }
+    }
+    public IValueLookupParameter<IntValue> VelocityBoundsEndIndexParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["VelocityBoundsEndIndex"]; }
     }
     #endregion
 
     #endregion
-    
+
+    #region Parameter values
+    private DoubleValue SwarmBestQuality {
+      get { return SwarmBestQualityParameter.ActualValue; }
+      set { SwarmBestQualityParameter.ActualValue = value; }
+    }
+    private RealVector BestRealVector {
+      get { return BestRealVectorParameter.ActualValue; }
+      set { BestRealVectorParameter.ActualValue = value; }
+    }
+    private ItemArray<DoubleValue> Quality {
+      get { return QualityParameter.ActualValue; }
+    }
+    private ItemArray<DoubleValue> PersonalBestQuality {
+      get { return PersonalBestQualityParameter.ActualValue; }
+      set { PersonalBestQualityParameter.ActualValue = value; }
+    }
+    private ItemArray<DoubleValue> NeighborBestQuality {
+      get { return NeighborBestQualityParameter.ActualValue; }
+      set { NeighborBestQualityParameter.ActualValue = value; }
+    }
+    private ItemArray<RealVector> RealVector {
+      get { return RealVectorParameter.ActualValue; }
+    }
+    private ItemArray<RealVector> PersonalBest {
+      get { return PersonalBestParameter.ActualValue; }
+      set { PersonalBestParameter.ActualValue = value; }
+    }
+    private ItemArray<RealVector> NeighborBest {
+      get { return NeighborBestParameter.ActualValue; }
+      set { NeighborBestParameter.ActualValue = value; }
+    }
+    private bool Maximization {
+      get { return MaximizationParameter.ActualValue.Value; }
+    }
+    private ItemArray<IntArray> Neighbors {
+      get { return NeighborsParameter.ActualValue; }
+    }
+    private DoubleMatrix VelocityBounds {
+      get { return VelocityBoundsParameter.ActualValue; }
+    }
+    private DoubleMatrix CurrentVelocityBounds {
+      get { return CurrentVelocityBoundsParameter.ActualValue; }
+      set { CurrentVelocityBoundsParameter.ActualValue = value; }
+    }
+    private DoubleValue VelocityBoundsScale {
+      get { return VelocityBoundsScaleParameter.ActualValue; }
+      set { VelocityBoundsScaleParameter.ActualValue = value; }
+    }
+    private DoubleValue VelocityBoundsStartValue {
+      get { return VelocityBoundsStartValueParameter.ActualValue; }
+    }
+    public IDiscreteDoubleValueModifier VelocityBoundsScalingOperator {
+      get { return VelocityBoundsScalingOperatorParameter.Value; }
+      set { VelocityBoundsScalingOperatorParameter.Value = value; }
+    }
+    private ResultCollection Results {
+      get { return ResultsParameter.ActualValue; }
+    }
+    #endregion
+
     #region Construction & Cloning
 
@@ -126,19 +193,22 @@
       Parameters.Add(new ScopeTreeLookupParameter<IntArray>("Neighbors", "The list of neighbors for each particle."));
       Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
-      Parameters.Add(new ValueLookupParameter<DoubleValue>("MaxVelocity", "Speed limit for each particle.", new DoubleValue(1000000)));
-      Parameters.Add(new LookupParameter<DoubleValue>("CurrentMaxVelocity", "Current value of the speed limit."));
+      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("VelocityBounds", "Maximum velocity for each dimension.", new DoubleMatrix(new double[,] { { -1, 1 } })));
+      Parameters.Add(new LookupParameter<DoubleMatrix>("CurrentVelocityBounds", "Current value of velocity bounds."));
       Parameters.Add(new LookupParameter<ResultCollection>("Results", "Results"));
 
       #region Velocity Bounds Updating
-      Parameters.Add(new OptionalConstrainedValueParameter<IDiscreteDoubleValueModifier>("MaxVelocityScalingOperator", "Modifies the value"));
-      Parameters.Add(new ValueLookupParameter<DoubleValue>("FinalMaxVelocity", "The value of maximum velocity if PSO has reached maximum iterations.", new DoubleValue(1E-10)));
-      Parameters.Add(new LookupParameter<IntValue>("MaxVelocityIndex", "The current index.", "Iterations"));
-      Parameters.Add(new ValueLookupParameter<IntValue>("MaxVelocityStartIndex", "The start index at which to start modifying 'Value'.", new IntValue(0)));
-      Parameters.Add(new ValueLookupParameter<IntValue>("MaxVelocityEndIndex", "The end index by which 'Value' should have reached 'EndValue'.", "MaxIterations"));
-      MaxVelocityStartIndexParameter.Hidden = true;
-      MaxVelocityEndIndexParameter.Hidden = true;
+      Parameters.Add(new LookupParameter<DoubleValue>("VelocityBoundsScale", "Scale parameter."));
+      Parameters.Add(new OptionalConstrainedValueParameter<IDiscreteDoubleValueModifier>("VelocityBoundsScalingOperator", "Modifies the value"));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("VelocityBoundsStartValue", "The start value of 'Value'.", new DoubleValue(1)));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("VelocityBoundsEndValue", "The end value of 'Value'.", new DoubleValue(1E-10)));
+      Parameters.Add(new LookupParameter<IntValue>("VelocityBoundsIndex", "The current index.", "Iterations"));
+      Parameters.Add(new ValueLookupParameter<IntValue>("VelocityBoundsStartIndex", "The start index at which to start modifying 'Value'.", new IntValue(0)));
+      Parameters.Add(new ValueLookupParameter<IntValue>("VelocityBoundsEndIndex", "The end index by which 'Value' should have reached 'EndValue'.", "MaxIterations"));
+      VelocityBoundsStartIndexParameter.Hidden = true;
+      VelocityBoundsEndIndexParameter.Hidden = true;
       #endregion
 
       Initialize();
+      RegisterEvents();
     }
 
@@ -158,84 +228,128 @@
         Parameters.Remove("BestQuality");
       }
-    }
+      RegisterEvents();
+    }
+
+    private void RegisterEvents() {
+      VelocityBoundsStartValueParameter.ValueChanged += new EventHandler(VelocityBoundsStartValueParameter_ValueChanged);
+      VelocityBoundsStartValueParameter.Value.ValueChanged += new EventHandler(VelocityBoundsStartValueParameter_Value_ValueChanged);
+    }
+
+    void VelocityBoundsStartValueParameter_Value_ValueChanged(object sender, EventArgs e) {
+      UpdateVelocityBoundsParamater();
+    }
+
+    void UpdateVelocityBoundsParamater() {
+      if (VelocityBoundsParameter.Value == null) {
+        VelocityBoundsParameter.Value = new DoubleMatrix(1, 2);
+      } else if (VelocityBoundsParameter.Value.Columns != 2) {
+        VelocityBoundsParameter.Value = new DoubleMatrix(VelocityBoundsParameter.Value.Rows, 2);
+      }
+      if (VelocityBoundsStartValueParameter.Value != null) {
+        DoubleMatrix matrix = VelocityBoundsParameter.Value;
+        for (int i = 0; i < matrix.Rows; i++) {
+          matrix[i, 0] = (-1) * VelocityBoundsStartValueParameter.Value.Value;
+          matrix[i, 1] = VelocityBoundsStartValueParameter.Value.Value;
+        }
+      }
+    }
+
+    void VelocityBoundsStartValueParameter_ValueChanged(object sender, EventArgs e) {
+      if (VelocityBoundsStartValueParameter.Value != null) {
+        VelocityBoundsStartValueParameter.Value.ValueChanged += new EventHandler(VelocityBoundsStartValueParameter_Value_ValueChanged);
+      }
+      UpdateVelocityBoundsParamater();
+    }
+
     private void Initialize() {
       ResultsCollector = new ResultsCollector();
-      ResultsCollector.CollectedValues.Add(CurrentMaxVelocityParameter);
-      ResultsCollector.CollectedValues.Add(MaxVelocityParameter);
+      ResultsCollector.CollectedValues.Add(CurrentVelocityBoundsParameter);
+      ResultsCollector.CollectedValues.Add(VelocityBoundsParameter);
 
       foreach (IDiscreteDoubleValueModifier op in ApplicationManager.Manager.GetInstances<IDiscreteDoubleValueModifier>()) {
-        MaxVelocityScalingOperatorParameter.ValidValues.Add(op);
-        op.ValueParameter.ActualName = CurrentMaxVelocityParameter.Name;
-        op.StartValueParameter.ActualName = MaxVelocityParameter.Name;
-        op.EndValueParameter.ActualName = FinalMaxVelocityParameter.Name;
-        op.IndexParameter.ActualName = MaxVelocityIndexParameter.Name;
-        op.StartIndexParameter.ActualName = MaxVelocityStartIndexParameter.Name;
-        op.EndIndexParameter.ActualName = MaxVelocityEndIndexParameter.Name;
-      }
-      MaxVelocityScalingOperatorParameter.Value = null;
+        VelocityBoundsScalingOperatorParameter.ValidValues.Add(op);
+        op.ValueParameter.ActualName = VelocityBoundsScaleParameter.Name;
+        op.StartValueParameter.ActualName = VelocityBoundsStartValueParameter.Name;
+        op.EndValueParameter.ActualName = VelocityBoundsEndValueParameter.Name;
+        op.IndexParameter.ActualName = VelocityBoundsIndexParameter.Name;
+        op.StartIndexParameter.ActualName = VelocityBoundsStartIndexParameter.Name;
+        op.EndIndexParameter.ActualName = VelocityBoundsEndIndexParameter.Name;
+      }
+      VelocityBoundsScalingOperatorParameter.Value = null;
     }
 
     public override IOperation Apply() {
-      var max = MaximizationParameter.ActualValue.Value;
-      // Update of the personal bests
-      var points = RealVectorParameter.ActualValue;
-      var qualities = QualityParameter.ActualValue;
-      var particles = points.Select((p, i) => new { Particle = p, Index = i })
-        .Zip(qualities, (p, q) => Tuple.Create(p.Index, p.Particle, q.Value)).ToList();
-      UpdatePersonalBest(max, particles);
-
-      // SPSO: update of the neighbor bests from the personal bests
-      var personalBestPoints = PersonalBestParameter.ActualValue;
-      var personalBestQualities = PersonalBestQualityParameter.ActualValue;
-      particles = personalBestPoints.Select((p, i) => new { Particle = p, Index = i })
-        .Zip(personalBestQualities, (p, q) => Tuple.Create(p.Index, p.Particle, q.Value)).ToList();
-      UpdateNeighborBest(max, particles);
-
-      var next = new OperationCollection() { base.Apply() };
-      next.Insert(0, ExecutionContext.CreateChildOperation(ResultsCollector));
-      if (MaxVelocityScalingOperatorParameter.Value != null) {
-        next.Insert(0, ExecutionContext.CreateChildOperation(MaxVelocityScalingOperatorParameter.Value));
-      } else CurrentMaxVelocityParameter.ActualValue = new DoubleValue(MaxVelocityParameter.ActualValue.Value);
-      return next;
-    }
-
-    private void UpdateNeighborBest(bool maximization, IList<Tuple<int, RealVector, double>> particles) {
-      var neighbors = NeighborsParameter.ActualValue;
-      if (neighbors.Length > 0) {
-        var neighborBest = new ItemArray<RealVector>(neighbors.Length);
-        var neighborBestQuality = new ItemArray<DoubleValue>(neighbors.Length);
-        for (int n = 0; n < neighbors.Length; n++) {
-          var pairs = particles.Where(x => x.Item1 == n || neighbors[n].Contains(x.Item1));
-          var bestNeighbor = (maximization ? pairs.MaxItems(p => p.Item3)
-                                           : pairs.MinItems(p => p.Item3)).First();
-          neighborBest[n] = bestNeighbor.Item2;
-          neighborBestQuality[n] = new DoubleValue(bestNeighbor.Item3);
+      UpdateGlobalBest();
+      UpdateNeighborBest();
+      UpdatePersonalBest();
+      return UpdateVelocityBounds();
+    }
+
+    private void UpdateGlobalBest() {
+      if (SwarmBestQuality == null)
+        SwarmBestQuality = new DoubleValue();
+      SwarmBestQuality.Value = Maximization ? Quality.Max(v => v.Value) : Quality.Min(v => v.Value);
+      BestRealVector = (RealVector)RealVector[Quality.FindIndex(v => v.Value == SwarmBestQuality.Value)].Clone();
+    }
+
+    private void UpdateNeighborBest() {
+      if (Neighbors.Length > 0) {
+        var neighborBest = new ItemArray<RealVector>(Neighbors.Length);
+        var neighborBestQuality = new ItemArray<DoubleValue>(Neighbors.Length);
+        for (int n = 0; n < Neighbors.Length; n++) {
+          var pairs = Quality.Zip(RealVector, (q, p) => new { Quality = q, Point = p })
+            .Where((p, i) => i == n || Neighbors[n].Contains(i));
+          var bestNeighbor = Maximization ?
+            pairs.OrderByDescending(p => p.Quality.Value).First() :
+            pairs.OrderBy(p => p.Quality.Value).First();
+          neighborBest[n] = bestNeighbor.Point;
+          neighborBestQuality[n] = bestNeighbor.Quality;
         }
-        NeighborBestParameter.ActualValue = neighborBest;
-        NeighborBestQualityParameter.ActualValue = neighborBestQuality;
-      } else {
-        // Neighbor best = Global best
-        var best = maximization ? particles.MaxItems(x => x.Item3).First() : particles.MinItems(x => x.Item3).First();
-        NeighborBestParameter.ActualValue = new ItemArray<RealVector>(particles.Select(x => best.Item2));
-        NeighborBestQualityParameter.ActualValue = new ItemArray<DoubleValue>(particles.Select(x => new DoubleValue(best.Item3)));
-      }
-    }
-
-    private void UpdatePersonalBest(bool maximization, IList<Tuple<int, RealVector, double>> particles) {
-      var personalBest = PersonalBestParameter.ActualValue;
-      var personalBestQuality = PersonalBestQualityParameter.ActualValue;
-
-      if (personalBestQuality.Length == 0) {
-        personalBestQuality = new ItemArray<DoubleValue>(particles.Select(x => new DoubleValue(x.Item3)));
-        PersonalBestQualityParameter.ActualValue = personalBestQuality;
-      }
-      foreach (var p in particles) {
-        if (maximization && p.Item3 > personalBestQuality[p.Item1].Value ||
-          !maximization && p.Item3 < personalBestQuality[p.Item1].Value) {
-          personalBestQuality[p.Item1].Value = p.Item3;
-          personalBest[p.Item1] = (RealVector)p.Item2.Clone();
+        NeighborBest = neighborBest;
+        NeighborBestQuality = neighborBestQuality;
+      }
+    }
+
+    private void UpdatePersonalBest() {
+      if (PersonalBestQuality.Length == 0)
+        PersonalBestQuality = (ItemArray<DoubleValue>)Quality.Clone();
+      for (int i = 0; i < RealVector.Length; i++) {
+        if (Maximization && Quality[i].Value > PersonalBestQuality[i].Value ||
+          !Maximization && Quality[i].Value < PersonalBestQuality[i].Value) {
+          PersonalBestQuality[i].Value = Quality[i].Value;
+          PersonalBest[i] = RealVector[i];
         }
       }
-      PersonalBestParameter.ActualValue = personalBest;
+    }
+
+    private IOperation UpdateVelocityBounds() {
+      if (CurrentVelocityBounds == null)
+        CurrentVelocityBounds = (DoubleMatrix)VelocityBounds.Clone();
+
+      if (VelocityBoundsScalingOperator == null)
+        return new OperationCollection() {
+          ExecutionContext.CreateChildOperation(ResultsCollector),        
+          base.Apply()
+        };
+
+      DoubleMatrix matrix = CurrentVelocityBounds;
+      if (VelocityBoundsScale == null && VelocityBoundsStartValue != null) {
+        VelocityBoundsScale = new DoubleValue(VelocityBoundsStartValue.Value);
+      }
+      for (int i = 0; i < matrix.Rows; i++) {
+        for (int j = 0; j < matrix.Columns; j++) {
+          if (matrix[i, j] >= 0) {
+            matrix[i, j] = VelocityBoundsScale.Value;
+          } else {
+            matrix[i, j] = (-1) * VelocityBoundsScale.Value;
+          }
+        }
+      }
+
+      return new OperationCollection() {
+        ExecutionContext.CreateChildOperation(ResultsCollector),
+        ExecutionContext.CreateChildOperation(VelocityBoundsScalingOperator),        
+        base.Apply()
+      };
     }
   }
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorTotallyConnectedParticleUpdater.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorTotallyConnectedParticleUpdater.cs	(revision 15099)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorTotallyConnectedParticleUpdater.cs	(revision 15102)
@@ -30,5 +30,5 @@
   [StorableClass]
   [NonDiscoverableType]
-  [Obsolete("Replaced by SPSO2007ParticleUpdater")]
+  [Obsolete("Use SPSO2011ParticleUpdater")]
   internal sealed class RealVectorTotallyConnectedParticleUpdater : RealVectorParticleUpdater {
 
@@ -43,59 +43,22 @@
     #endregion
 
-    private void UpdateVelocity() {
-      var velocity = VelocityParameter.ActualValue;
-      var position = RealVectorParameter.ActualValue;
-      var inertia = CurrentInertiaParameter.ActualValue.Value;
-      var personalBest = PersonalBestParameter.ActualValue;
-      var personalBestAttraction = PersonalBestAttractionParameter.ActualValue.Value;
-      var neighborBest = NeighborBestParameter.ActualValue;
-      var neighborBestAttraction = NeighborBestAttractionParameter.ActualValue.Value;
+    public override IOperation Apply() {
+      double inertia = Inertia.Value;
+      double personalBestAttraction = PersonalBestAttraction.Value;
+      double neighborBestAttraction = NeighborBestAttraction.Value;
 
-      var random = RandomParameter.ActualValue;
+      RealVector velocity = new RealVector(Velocity.Length);
+      RealVector position = new RealVector(RealVector.Length);
+      double r_p = Random.NextDouble();
+      double r_g = Random.NextDouble();
 
       for (int i = 0; i < velocity.Length; i++) {
-        double r_p = random.NextDouble();
-        double r_g = random.NextDouble();
         velocity[i] =
-          velocity[i] * inertia +
-          (personalBest[i] - position[i]) * personalBestAttraction * r_p +
-          (neighborBest[i] - position[i]) * neighborBestAttraction * r_g;
+          Velocity[i] * inertia +
+          (PersonalBest[i] - RealVector[i]) * personalBestAttraction * r_p +
+          (BestPoint[i] - RealVector[i]) * neighborBestAttraction * r_g;
       }
 
-      var maxVelocity = CurrentMaxVelocityParameter.ActualValue.Value;
-      var speed = Math.Sqrt(velocity.DotProduct(velocity));
-      if (speed > maxVelocity) {
-        for (var i = 0; i < velocity.Length; i++) {
-          velocity[i] *= maxVelocity / speed;
-        }
-      }
-    }
-
-    private void UpdatePosition() {
-      var velocity = VelocityParameter.ActualValue;
-      var position = RealVectorParameter.ActualValue;
-
-      for (int i = 0; i < velocity.Length; i++) {
-        position[i] += velocity[i];
-      }
-
-      var bounds = BoundsParameter.ActualValue;
-      for (int i = 0; i < position.Length; i++) {
-        double min = bounds[i % bounds.Rows, 0];
-        double max = bounds[i % bounds.Rows, 1];
-        if (position[i] < min) {
-          position[i] = min;
-          velocity[i] = -0.5 * velocity[i]; // SPSO 2011
-        }
-        if (position[i] > max) {
-          position[i] = max;
-          velocity[i] = -0.5 * velocity[i]; // SPSO 2011
-        }
-      }
-    }
-
-    public override IOperation Apply() {
-      UpdateVelocity();
-      UpdatePosition();
+      MoveParticle(velocity, position);
 
       return base.Apply();
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorVelocityInitializer.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorVelocityInitializer.cs	(revision 15099)
+++ 	(revision )
@@ -1,84 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2017 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 System.Text;
-using System.Threading.Tasks;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Operators;
-using HeuristicLab.Optimization;
-using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.Encodings.RealVectorEncoding {
-  [Item("RealVectorVelocityInitializer", "Initializes the velocity vector.")]
-  [StorableClass]
-  public class RealVectorVelocityInitializer : SingleSuccessorOperator, IStochasticOperator {
-    #region Parameters
-    public ILookupParameter<IRandom> RandomParameter {
-      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
-    }
-    public IValueLookupParameter<DoubleMatrix> BoundsParameter {
-      get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
-    }
-    public ILookupParameter<RealVector> RealVectorParameter {
-      get { return (ILookupParameter<RealVector>)Parameters["RealVector"]; }
-    }
-    public ILookupParameter<RealVector> VelocityParameter {
-      get { return (ILookupParameter<RealVector>)Parameters["Velocity"]; }
-    }
-    #endregion
-    
-    #region Construction & Cloning
-    [StorableConstructor]
-    protected RealVectorVelocityInitializer(bool deserializing) : base(deserializing) { }
-    protected RealVectorVelocityInitializer(RealVectorVelocityInitializer original, Cloner cloner) : base(original, cloner) { }
-    public RealVectorVelocityInitializer()
-      : base() {
-      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));
-      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds in each dimension."));
-      Parameters.Add(new LookupParameter<RealVector>("RealVector", "Particle's current solution"));
-      Parameters.Add(new LookupParameter<RealVector>("Velocity", "Particle's current velocity."));
-    }
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new RealVectorVelocityInitializer(this, cloner);
-    }
-    #endregion
-
-    public override IOperation Apply() {
-      var random = RandomParameter.ActualValue;
-      var bounds = BoundsParameter.ActualValue;
-      var position = RealVectorParameter.ActualValue;
-      var velocity = new RealVector(position.Length);
-      for (var i = 0; i < velocity.Length; i++) {
-        var lower = (bounds[i % bounds.Rows, 0] - position[i]);
-        var upper = (bounds[i % bounds.Rows, 1] - position[i]);
-        velocity[i] = lower + random.NextDouble() * (upper - lower); // SPSO 2011
-      }
-      VelocityParameter.ActualValue = velocity;
-      return base.Apply();
-    }
-  }
-}
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSO2007ParticleUpdater.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSO2007ParticleUpdater.cs	(revision 15099)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSO2007ParticleUpdater.cs	(revision 15102)
@@ -24,4 +24,5 @@
 using HeuristicLab.Core;
 using HeuristicLab.Data;
+using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
@@ -29,5 +30,5 @@
   [Item("SPSO 2007 Particle Updater", "Updates the particle's position according to the formulae described in SPSO 2007.")]
   [StorableClass]
-  public sealed class SPSO2007ParticleUpdater : RealVectorParticleUpdater {
+  public sealed class SPSO2007ParticleUpdater : SPSOParticleUpdater {
 
     #region Construction & Cloning
@@ -41,8 +42,8 @@
     #endregion
     
-    public static void UpdateVelocity(IRandom random, RealVector velocity, double maxVelocity, RealVector position, double inertia, RealVector personalBest, double personalBestAttraction, RealVector neighborBest, double neighborBestAttraction) {
+    public static void UpdateVelocity(IRandom random, RealVector velocity, double maxVelocity, RealVector position, double inertia, RealVector personalBest, double personalBestAttraction, RealVector neighborBest, double neighborBestAttraction, double c = 1.193) {
       for (int i = 0; i < velocity.Length; i++) {
-        double r_p = random.NextDouble() * 1.193;
-        double r_g = random.NextDouble() * 1.193;
+        double r_p = random.NextDouble() * c;
+        double r_g = random.NextDouble() * c;
         velocity[i] =
           velocity[i] * inertia +
@@ -69,9 +70,9 @@
         if (position[i] < min) {
           position[i] = min;
-          velocity[i] = 0;
+          velocity[i] = 0; // SPSO 2007
         }
         if (position[i] > max) {
           position[i] = max;
-          velocity[i] = 0;
+          velocity[i] = 0; // SPSO 2007
         }
       }
@@ -90,6 +91,7 @@
       var neighborBest = NeighborBestParameter.ActualValue;
       var neighborBestAttraction = NeighborBestAttractionParameter.ActualValue.Value;
-      
-      UpdateVelocity(random, velocity, maxVelocity, position, inertia, personalBest, personalBestAttraction, neighborBest, neighborBestAttraction);
+      var maxBeyond = MaxBeyondBestParameter.ActualValue.Value;
+
+      UpdateVelocity(random, velocity, maxVelocity, position, inertia, personalBest, personalBestAttraction, neighborBest, neighborBestAttraction, maxBeyond);
       UpdatePosition(bounds, velocity, position);
 
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSO2007VelocityInitializer.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSO2007VelocityInitializer.cs	(revision 15102)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSO2007VelocityInitializer.cs	(revision 15102)
@@ -0,0 +1,55 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2017 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.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.RealVectorEncoding {
+  [Item("Velocity Initializer (SPSO 2007)", "Initializes the velocity vector.")]
+  [StorableClass]
+  public class SPSO2007VelocityInitializer : SPSOVelocityInitializer {
+    
+    #region Construction & Cloning
+    [StorableConstructor]
+    protected SPSO2007VelocityInitializer(bool deserializing) : base(deserializing) { }
+    protected SPSO2007VelocityInitializer(SPSO2007VelocityInitializer original, Cloner cloner) : base(original, cloner) { }
+    public SPSO2007VelocityInitializer() : base() { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SPSO2007VelocityInitializer(this, cloner);
+    }
+    #endregion
+
+    public override IOperation Apply() {
+      var random = RandomParameter.ActualValue;
+      var bounds = BoundsParameter.ActualValue;
+      var position = RealVectorParameter.ActualValue;
+      var velocity = new RealVector(position.Length);
+      for (var i = 0; i < velocity.Length; i++) {
+        var lower = bounds[i % bounds.Rows, 0];
+        var upper = bounds[i % bounds.Rows, 1];
+        velocity[i] = (lower + random.NextDouble() * (upper - lower) - position[i]) / 2.0; // SPSO 2007
+      }
+      VelocityParameter.ActualValue = velocity;
+      return base.Apply();
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSO2011ParticleUpdater.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSO2011ParticleUpdater.cs	(revision 15099)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSO2011ParticleUpdater.cs	(revision 15102)
@@ -29,6 +29,5 @@
   [Item("SPSO 2011 Particle Updater", "Updates the particle's position according to the formulae described in SPSO 2011.")]
   [StorableClass]
-  public sealed class SPSO2011ParticleUpdater : RealVectorParticleUpdater {
-
+  public sealed class SPSO2011ParticleUpdater : SPSOParticleUpdater {
     #region Construction & Cloning
     [StorableConstructor]
@@ -41,5 +40,5 @@
     #endregion
     
-    public static void UpdateVelocity(IRandom random, RealVector velocity, double maxVelocity, RealVector position, double inertia, RealVector personalBest, double personalBestAttraction, RealVector neighborBest, double neighborBestAttraction) {
+    public static void UpdateVelocity(IRandom random, RealVector velocity, double maxVelocity, RealVector position, double inertia, RealVector personalBest, double personalBestAttraction, RealVector neighborBest, double neighborBestAttraction, double c = 1.193) {
       var gravity = new double[velocity.Length];
       var direct = new RealVector(velocity.Length);
@@ -47,5 +46,5 @@
 
       for (int i = 0; i < velocity.Length; i++) {
-        var g_id = 1.193 * ((personalBest[i] + neighborBest[i] - 2 * position[i]) / 3.0);
+        var g_id = c * ((personalBest[i] + neighborBest[i] - 2 * position[i]) / 3.0);
         gravity[i] = g_id + position[i];
         direct[i] = (random.NextDouble() - 0.5) * 2;
@@ -101,6 +100,7 @@
       var neighborBest = NeighborBestParameter.ActualValue;
       var neighborBestAttraction = NeighborBestAttractionParameter.ActualValue.Value;
-      
-      UpdateVelocity(random, velocity, maxVelocity, position, inertia, personalBest, personalBestAttraction, neighborBest, neighborBestAttraction);
+      var maxBeyond = MaxBeyondBestParameter.ActualValue.Value;
+
+      UpdateVelocity(random, velocity, maxVelocity, position, inertia, personalBest, personalBestAttraction, neighborBest, neighborBestAttraction, maxBeyond);
       UpdatePosition(bounds, velocity, position);
 
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSO2011VelocityInitializer.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSO2011VelocityInitializer.cs	(revision 15102)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSO2011VelocityInitializer.cs	(revision 15102)
@@ -0,0 +1,55 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2017 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.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.RealVectorEncoding {
+  [Item("Velocity Initializer (SPSO 2011)", "Initializes the velocity vector.")]
+  [StorableClass]
+  public class SPSO2011VelocityInitializer : SPSOVelocityInitializer {
+    
+    #region Construction & Cloning
+    [StorableConstructor]
+    protected SPSO2011VelocityInitializer(bool deserializing) : base(deserializing) { }
+    protected SPSO2011VelocityInitializer(SPSO2011VelocityInitializer original, Cloner cloner) : base(original, cloner) { }
+    public SPSO2011VelocityInitializer() : base() { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SPSO2011VelocityInitializer(this, cloner);
+    }
+    #endregion
+
+    public override IOperation Apply() {
+      var random = RandomParameter.ActualValue;
+      var bounds = BoundsParameter.ActualValue;
+      var position = RealVectorParameter.ActualValue;
+      var velocity = new RealVector(position.Length);
+      for (var i = 0; i < velocity.Length; i++) {
+        var lower = (bounds[i % bounds.Rows, 0] - position[i]);
+        var upper = (bounds[i % bounds.Rows, 1] - position[i]);
+        velocity[i] = lower + random.NextDouble() * (upper - lower); // SPSO 2011
+      }
+      VelocityParameter.ActualValue = velocity;
+      return base.Apply();
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSOParticleCreator.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSOParticleCreator.cs	(revision 15102)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSOParticleCreator.cs	(revision 15102)
@@ -0,0 +1,105 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 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.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.RealVectorEncoding {
+  [Item("Particle Creator (SPSO)", "Creates a particle with position, velocity vector and personal best.")]
+  [StorableClass]
+  public class SPSOParticleCreator : AlgorithmOperator, IRealVectorParticleCreator, IStochasticOperator {
+
+    #region Parameters
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
+    }
+    public IValueLookupParameter<DoubleMatrix> BoundsParameter {
+      get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
+    }
+    public ILookupParameter<RealVector> RealVectorParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["RealVector"]; }
+    }
+    public ILookupParameter<RealVector> PersonalBestParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["PersonalBest"]; }
+    }
+    public ILookupParameter<RealVector> VelocityParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["Velocity"]; }
+    }
+    public ILookupParameter<ISolutionCreator> SolutionCreatorParameter {
+      get { return (ILookupParameter<ISolutionCreator>)Parameters["SolutionCreator"]; }
+    }
+    public IConstrainedValueParameter<SPSOVelocityInitializer> VelocityInitializerParameter {
+      get { return (IConstrainedValueParameter<SPSOVelocityInitializer>)Parameters["VelocityInitializer"]; }
+    }
+    #endregion
+    
+    #region Construction & Cloning
+    [StorableConstructor]
+    protected SPSOParticleCreator(bool deserializing) : base(deserializing) { }
+    protected SPSOParticleCreator(SPSOParticleCreator original, Cloner cloner) : base(original, cloner) { }
+    public SPSOParticleCreator()
+      : base() {
+      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));
+      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds in each dimension."));
+      Parameters.Add(new LookupParameter<RealVector>("RealVector", "Particle's current solution"));
+      Parameters.Add(new LookupParameter<RealVector>("PersonalBest", "Particle's personal best solution."));
+      Parameters.Add(new LookupParameter<RealVector>("Velocity", "Particle's current velocity."));
+      Parameters.Add(new LookupParameter<ISolutionCreator>("SolutionCreator", "The operator that creates the initial position."));
+      Parameters.Add(new ConstrainedValueParameter<SPSOVelocityInitializer>("VelocityInitializer", "The initialization of the velocity vector."));
+
+      VelocityInitializerParameter.ValidValues.Add(new SPSO2011VelocityInitializer());
+      VelocityInitializerParameter.ValidValues.Add(new SPSO2007VelocityInitializer());
+
+      foreach (var init in VelocityInitializerParameter.ValidValues) {
+        init.BoundsParameter.ActualName = BoundsParameter.Name;
+        init.BoundsParameter.Hidden = true;
+        init.RandomParameter.ActualName = RandomParameter.Name;
+        init.RealVectorParameter.ActualName = RealVectorParameter.Name;
+        init.VelocityParameter.ActualName = VelocityParameter.Name;
+      }
+
+      Placeholder realVectorCreater = new Placeholder();
+      Assigner personalBestPositionAssigner = new Assigner();
+      Placeholder velocityInitializer = new Placeholder();
+
+      OperatorGraph.InitialOperator = realVectorCreater;
+
+      realVectorCreater.OperatorParameter.ActualName = SolutionCreatorParameter.Name;
+      realVectorCreater.Successor = personalBestPositionAssigner;
+
+      personalBestPositionAssigner.LeftSideParameter.ActualName = PersonalBestParameter.Name;
+      personalBestPositionAssigner.RightSideParameter.ActualName = RealVectorParameter.Name;
+      personalBestPositionAssigner.Successor = velocityInitializer;
+
+      velocityInitializer.OperatorParameter.ActualName = VelocityInitializerParameter.Name;
+      velocityInitializer.Successor = null;
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SPSOParticleCreator(this, cloner);
+    }
+    #endregion
+  }
+}
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSOParticleUpdater.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSOParticleUpdater.cs	(revision 15102)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSOParticleUpdater.cs	(revision 15102)
@@ -0,0 +1,99 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 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.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.RealVectorEncoding {
+
+  [Item("Particle Updater (SPSO)", "Updates a certain particle taking the current position and velocity into account, as well as the best point and the best point in a local neighborhood.")]
+  [StorableClass]
+  public abstract class SPSOParticleUpdater : SingleSuccessorOperator, IRealVectorParticleUpdater {
+
+    public override bool CanChangeName {
+      get { return false; }
+    }
+
+    #region Parameter properties
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
+    }
+    public ILookupParameter<RealVector> VelocityParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["Velocity"]; }
+    }
+    public ILookupParameter<RealVector> PersonalBestParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["PersonalBest"]; }
+    }
+    public ILookupParameter<RealVector> NeighborBestParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["NeighborBest"]; }
+    }
+    public ILookupParameter<RealVector> RealVectorParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["RealVector"]; }
+    }
+    public ILookupParameter<DoubleMatrix> BoundsParameter {
+      get { return (ILookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
+    }
+    public ILookupParameter<DoubleValue> CurrentMaxVelocityParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["CurrentMaxVelocity"]; }
+    }
+    public ILookupParameter<DoubleValue> CurrentInertiaParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["CurrentInertia"]; }
+    }
+    ILookupParameter<DoubleValue> IParticleUpdater.InertiaParameter { get { return CurrentInertiaParameter; } }
+
+    public ILookupParameter<DoubleValue> PersonalBestAttractionParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["PersonalBestAttraction"]; }
+    }
+    public ILookupParameter<DoubleValue> NeighborBestAttractionParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["NeighborBestAttraction"]; }
+    }
+
+    public IValueLookupParameter<DoubleValue> MaxBeyondBestParameter {
+      get { return (IValueLookupParameter<DoubleValue>)Parameters["MaxBeyondBest"]; }
+    }
+    #endregion
+
+    #region Construction & Cloning
+    [StorableConstructor]
+    protected SPSOParticleUpdater(bool deserializing) : base(deserializing) { }
+    protected SPSOParticleUpdater(SPSOParticleUpdater original, Cloner cloner) : base(original, cloner) { }
+    public SPSOParticleUpdater()
+      : base() {
+      Parameters.Add(new LookupParameter<IRandom>("Random", "Random number generator."));
+      Parameters.Add(new LookupParameter<RealVector>("RealVector", "Particle's current solution"));
+      Parameters.Add(new LookupParameter<RealVector>("Velocity", "Particle's current velocity."));
+      Parameters.Add(new LookupParameter<RealVector>("PersonalBest", "Particle's personal best solution."));
+      Parameters.Add(new LookupParameter<RealVector>("NeighborBest", "Best neighboring solution."));
+      Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds for each dimension of the position vector for the current problem."));
+      Parameters.Add(new LookupParameter<DoubleValue>("CurrentMaxVelocity", "Maximum for the particle's velocity vector."));
+      Parameters.Add(new LookupParameter<DoubleValue>("CurrentInertia", "The weight for the particle's velocity vector."));
+      Parameters.Add(new LookupParameter<DoubleValue>("PersonalBestAttraction", "The weight for the particle's personal best position."));
+      Parameters.Add(new LookupParameter<DoubleValue>("NeighborBestAttraction", "The weight for the global best position."));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("MaxBeyondBest", "A factor of how much the velocity update may maximally aim beyond the personal and neighbor best.", new DoubleValue(1.193)));
+    }
+    #endregion
+  }
+}
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSOSwarmUpdater.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSOSwarmUpdater.cs	(revision 15102)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSOSwarmUpdater.cs	(revision 15102)
@@ -0,0 +1,232 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 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;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Optimization.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Encodings.RealVectorEncoding {
+  [Item("Swarm Updater (SPSO)", "Updates personal best point and quality as well as global best point and quality.")]
+  [StorableClass]
+  public sealed class SPSOSwarmUpdater : SingleSuccessorOperator, IRealVectorSwarmUpdater, ISingleObjectiveOperator {
+
+    [Storable]
+    private ResultsCollector ResultsCollector;
+
+    public override bool CanChangeName {
+      get { return false; }
+    }
+
+    #region Parameter properties
+    public IScopeTreeLookupParameter<DoubleValue> QualityParameter {
+      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
+    }
+    public IScopeTreeLookupParameter<DoubleValue> PersonalBestQualityParameter {
+      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["PersonalBestQuality"]; }
+    }
+    public IScopeTreeLookupParameter<DoubleValue> NeighborBestQualityParameter {
+      get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["NeighborBestQuality"]; }
+    }
+    public IScopeTreeLookupParameter<RealVector> RealVectorParameter {
+      get { return (IScopeTreeLookupParameter<RealVector>)Parameters["RealVector"]; }
+    }
+    public IScopeTreeLookupParameter<RealVector> PersonalBestParameter {
+      get { return (IScopeTreeLookupParameter<RealVector>)Parameters["PersonalBest"]; }
+    }
+    public IScopeTreeLookupParameter<RealVector> NeighborBestParameter {
+      get { return (IScopeTreeLookupParameter<RealVector>)Parameters["NeighborBest"]; }
+    }
+    public ILookupParameter<BoolValue> MaximizationParameter {
+      get { return (ILookupParameter<BoolValue>)Parameters["Maximization"]; }
+    }
+    public ILookupParameter<DoubleValue> SwarmBestQualityParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["SwarmBestQuality"]; }
+    }
+    public ILookupParameter<RealVector> BestRealVectorParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["BestRealVector"]; }
+    }
+    public IScopeTreeLookupParameter<IntArray> NeighborsParameter {
+      get { return (IScopeTreeLookupParameter<IntArray>)Parameters["Neighbors"]; }
+    }
+    public IValueLookupParameter<DoubleValue> MaxVelocityParameter {
+      get { return (ValueLookupParameter<DoubleValue>)Parameters["MaxVelocity"]; }
+    }
+    public ILookupParameter<DoubleValue> CurrentMaxVelocityParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["CurrentMaxVelocity"]; }
+    }
+    public LookupParameter<ResultCollection> ResultsParameter {
+      get { return (LookupParameter<ResultCollection>)Parameters["Results"]; }
+    }
+
+    #region Max Velocity Updating
+    public IConstrainedValueParameter<IDiscreteDoubleValueModifier> MaxVelocityScalingOperatorParameter {
+      get { return (IConstrainedValueParameter<IDiscreteDoubleValueModifier>)Parameters["MaxVelocityScalingOperator"]; }
+    }
+    public IValueLookupParameter<DoubleValue> FinalMaxVelocityParameter {
+      get { return (IValueLookupParameter<DoubleValue>)Parameters["FinalMaxVelocity"]; }
+    }
+    public ILookupParameter<IntValue> MaxVelocityIndexParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["MaxVelocityIndex"]; }
+    }
+    public IValueLookupParameter<IntValue> MaxVelocityStartIndexParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["MaxVelocityStartIndex"]; }
+    }
+    public IValueLookupParameter<IntValue> MaxVelocityEndIndexParameter {
+      get { return (IValueLookupParameter<IntValue>)Parameters["MaxVelocityEndIndex"]; }
+    }
+    #endregion
+
+    #endregion
+    
+    #region Construction & Cloning
+
+    [StorableConstructor]
+    private SPSOSwarmUpdater(bool deserializing) : base(deserializing) { }
+    private SPSOSwarmUpdater(SPSOSwarmUpdater original, Cloner cloner)
+      : base(original, cloner) {
+      ResultsCollector = cloner.Clone(original.ResultsCollector);
+    }
+    public SPSOSwarmUpdater()
+      : base() {
+      Parameters.Add(new LookupParameter<DoubleValue>("SwarmBestQuality", "Swarm's best quality."));
+      Parameters.Add(new LookupParameter<RealVector>("BestRealVector", "Global best particle position."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "Particles' qualities."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("PersonalBestQuality", "Particles' personal best qualities."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("NeighborBestQuality", "Best neighbor particles' qualities."));
+      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("RealVector", "Particles' positions."));
+      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("PersonalBest", "Particles' personal best positions."));
+      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("NeighborBest", "Neighborhood (or global in case of totally connected neighborhood) best particle positions."));
+      Parameters.Add(new ScopeTreeLookupParameter<IntArray>("Neighbors", "The list of neighbors for each particle."));
+      Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("MaxVelocity", "Speed limit for each particle.", new DoubleValue(1000000)));
+      Parameters.Add(new LookupParameter<DoubleValue>("CurrentMaxVelocity", "Current value of the speed limit."));
+      Parameters.Add(new LookupParameter<ResultCollection>("Results", "Results"));
+
+      #region Max Velocity Updating
+      Parameters.Add(new OptionalConstrainedValueParameter<IDiscreteDoubleValueModifier>("MaxVelocityScalingOperator", "Modifies the value"));
+      Parameters.Add(new ValueLookupParameter<DoubleValue>("FinalMaxVelocity", "The value of maximum velocity if PSO has reached maximum iterations.", new DoubleValue(1E-10)));
+      Parameters.Add(new LookupParameter<IntValue>("MaxVelocityIndex", "The current index.", "Iterations"));
+      Parameters.Add(new ValueLookupParameter<IntValue>("MaxVelocityStartIndex", "The start index at which to start modifying 'Value'.", new IntValue(0)));
+      Parameters.Add(new ValueLookupParameter<IntValue>("MaxVelocityEndIndex", "The end index by which 'Value' should have reached 'EndValue'.", "MaxIterations"));
+      MaxVelocityStartIndexParameter.Hidden = true;
+      MaxVelocityEndIndexParameter.Hidden = true;
+      #endregion
+
+      Initialize();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SPSOSwarmUpdater(this, cloner);
+    }
+
+    #endregion
+
+    private void Initialize() {
+      ResultsCollector = new ResultsCollector();
+      ResultsCollector.CollectedValues.Add(CurrentMaxVelocityParameter);
+      ResultsCollector.CollectedValues.Add(MaxVelocityParameter);
+
+      foreach (IDiscreteDoubleValueModifier op in ApplicationManager.Manager.GetInstances<IDiscreteDoubleValueModifier>()) {
+        MaxVelocityScalingOperatorParameter.ValidValues.Add(op);
+        op.ValueParameter.ActualName = CurrentMaxVelocityParameter.Name;
+        op.StartValueParameter.ActualName = MaxVelocityParameter.Name;
+        op.EndValueParameter.ActualName = FinalMaxVelocityParameter.Name;
+        op.IndexParameter.ActualName = MaxVelocityIndexParameter.Name;
+        op.StartIndexParameter.ActualName = MaxVelocityStartIndexParameter.Name;
+        op.EndIndexParameter.ActualName = MaxVelocityEndIndexParameter.Name;
+      }
+      MaxVelocityScalingOperatorParameter.Value = null;
+    }
+
+    public override IOperation Apply() {
+      var max = MaximizationParameter.ActualValue.Value;
+      // Update of the personal bests
+      var points = RealVectorParameter.ActualValue;
+      var qualities = QualityParameter.ActualValue;
+      var particles = points.Select((p, i) => new { Particle = p, Index = i })
+        .Zip(qualities, (p, q) => Tuple.Create(p.Index, p.Particle, q.Value)).ToList();
+      UpdatePersonalBest(max, particles);
+
+      // SPSO: update of the neighbor bests from the personal bests
+      var personalBestPoints = PersonalBestParameter.ActualValue;
+      var personalBestQualities = PersonalBestQualityParameter.ActualValue;
+      particles = personalBestPoints.Select((p, i) => new { Particle = p, Index = i })
+        .Zip(personalBestQualities, (p, q) => Tuple.Create(p.Index, p.Particle, q.Value)).ToList();
+      UpdateNeighborBest(max, particles);
+
+      var next = new OperationCollection() { base.Apply() };
+      next.Insert(0, ExecutionContext.CreateChildOperation(ResultsCollector));
+      if (MaxVelocityScalingOperatorParameter.Value != null) {
+        next.Insert(0, ExecutionContext.CreateChildOperation(MaxVelocityScalingOperatorParameter.Value));
+      } else CurrentMaxVelocityParameter.ActualValue = new DoubleValue(MaxVelocityParameter.ActualValue.Value);
+      return next;
+    }
+
+    private void UpdateNeighborBest(bool maximization, IList<Tuple<int, RealVector, double>> particles) {
+      var neighbors = NeighborsParameter.ActualValue;
+      if (neighbors.Length > 0) {
+        var neighborBest = new ItemArray<RealVector>(neighbors.Length);
+        var neighborBestQuality = new ItemArray<DoubleValue>(neighbors.Length);
+        for (int n = 0; n < neighbors.Length; n++) {
+          var pairs = particles.Where(x => x.Item1 == n || neighbors[n].Contains(x.Item1));
+          var bestNeighbor = (maximization ? pairs.MaxItems(p => p.Item3)
+                                           : pairs.MinItems(p => p.Item3)).First();
+          neighborBest[n] = bestNeighbor.Item2;
+          neighborBestQuality[n] = new DoubleValue(bestNeighbor.Item3);
+        }
+        NeighborBestParameter.ActualValue = neighborBest;
+        NeighborBestQualityParameter.ActualValue = neighborBestQuality;
+      } else {
+        // Neighbor best = Global best
+        var best = maximization ? particles.MaxItems(x => x.Item3).First() : particles.MinItems(x => x.Item3).First();
+        NeighborBestParameter.ActualValue = new ItemArray<RealVector>(particles.Select(x => best.Item2));
+        NeighborBestQualityParameter.ActualValue = new ItemArray<DoubleValue>(particles.Select(x => new DoubleValue(best.Item3)));
+      }
+    }
+
+    private void UpdatePersonalBest(bool maximization, IList<Tuple<int, RealVector, double>> particles) {
+      var personalBest = PersonalBestParameter.ActualValue;
+      var personalBestQuality = PersonalBestQualityParameter.ActualValue;
+
+      if (personalBestQuality.Length == 0) {
+        personalBestQuality = new ItemArray<DoubleValue>(particles.Select(x => new DoubleValue(x.Item3)));
+        PersonalBestQualityParameter.ActualValue = personalBestQuality;
+      }
+      foreach (var p in particles) {
+        if (maximization && p.Item3 > personalBestQuality[p.Item1].Value ||
+          !maximization && p.Item3 < personalBestQuality[p.Item1].Value) {
+          personalBestQuality[p.Item1].Value = p.Item3;
+          personalBest[p.Item1] = (RealVector)p.Item2.Clone();
+        }
+      }
+      PersonalBestParameter.ActualValue = personalBest;
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSOVelocityInitializer.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSOVelocityInitializer.cs	(revision 15102)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/SPSOVelocityInitializer.cs	(revision 15102)
@@ -0,0 +1,62 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2017 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.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.RealVectorEncoding {
+  [Item("Velocity Initializer (SPSO)", "Initializes the velocity vector.")]
+  [StorableClass]
+  public abstract class SPSOVelocityInitializer : SingleSuccessorOperator, IStochasticOperator {
+    #region Parameters
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
+    }
+    public IValueLookupParameter<DoubleMatrix> BoundsParameter {
+      get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
+    }
+    public ILookupParameter<RealVector> RealVectorParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["RealVector"]; }
+    }
+    public ILookupParameter<RealVector> VelocityParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["Velocity"]; }
+    }
+    #endregion
+    
+    #region Construction & Cloning
+    [StorableConstructor]
+    protected SPSOVelocityInitializer(bool deserializing) : base(deserializing) { }
+    protected SPSOVelocityInitializer(SPSOVelocityInitializer original, Cloner cloner) : base(original, cloner) { }
+    protected SPSOVelocityInitializer()
+      : base() {
+      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use."));
+      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds in each dimension."));
+      Parameters.Add(new LookupParameter<RealVector>("RealVector", "Particle's current solution"));
+      Parameters.Add(new LookupParameter<RealVector>("Velocity", "Particle's current velocity."));
+    }
+    #endregion
+  }
+}
