Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorNeighborhoodParticleUpdater.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorNeighborhoodParticleUpdater.cs	(revision 15071)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorNeighborhoodParticleUpdater.cs	(revision 15091)
@@ -22,5 +22,4 @@
 using HeuristicLab.Common;
 using HeuristicLab.Core;
-using HeuristicLab.Optimization;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
@@ -28,5 +27,5 @@
   [Item("Neighborhood Particle Updater", "Updates the particle's position using (among other things) the best neighbor's position. Point = Point + Velocity*Inertia + (PersonalBestPoint-Point)*Phi_P*r_p + (BestNeighborPoint-Point)*Phi_G*r_g.")]
   [StorableClass]
-  public sealed class RealVectorNeighborhoodParticleUpdater : RealVectorParticleUpdater, ILocalParticleUpdater {
+  public sealed class RealVectorNeighborhoodParticleUpdater : RealVectorParticleUpdater {
 
     #region Construction & Cloning
@@ -41,21 +40,6 @@
 
     public override IOperation Apply() {
-      double inertia = Inertia.Value;
-      double personalBestAttraction = PersonalBestAttraction.Value;
-      double neighborBestAttraction = NeighborBestAttraction.Value;
-
-      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++) {
-        velocity[i] =
-          Velocity[i] * inertia +
-          (PersonalBest[i] - RealVector[i]) * personalBestAttraction * r_p +
-          (BestPoint[i] - RealVector[i]) * neighborBestAttraction * r_g;
-      }
-
-      MoveParticle(velocity, position);
+      UpdateVelocity();
+      UpdatePosition();
 
       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 15071)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleCreator.cs	(revision 15091)
@@ -24,4 +24,5 @@
 using HeuristicLab.Data;
 using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
@@ -30,9 +31,9 @@
   [Item("RealVectorParticleCreator", "Creates a particle with position, zero velocity vector and personal best.")]
   [StorableClass]
-  public class RealVectorParticleCreator : AlgorithmOperator, IRealVectorParticleCreator {
+  public class RealVectorParticleCreator : AlgorithmOperator, IRealVectorParticleCreator, IStochasticOperator {
 
     #region Parameters
-    public ILookupParameter<IntValue> ProblemSizeParameter {
-      get { return (ILookupParameter<IntValue>)Parameters["ProblemSize"]; }
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
     }
     public IValueLookupParameter<DoubleMatrix> BoundsParameter {
@@ -48,15 +49,9 @@
       get { return (ILookupParameter<RealVector>)Parameters["Velocity"]; }
     }
-    #endregion
-
-    #region Parameter Values
-    protected int ProblemSize {
-      get { return ProblemSizeParameter.ActualValue.Value; }
-    }
-    protected RealVector Velocity {
-      set { VelocityParameter.ActualValue = value; }
+    public ILookupParameter<ISolutionCreator> SolutionCreatorParameter {
+      get { return (ILookupParameter<ISolutionCreator>)Parameters["SolutionCreator"]; }
     }
     #endregion
-
+    
     #region Construction & Cloning
     [StorableConstructor]
@@ -65,23 +60,29 @@
     public RealVectorParticleCreator()
       : base() {
-      Parameters.Add(new LookupParameter<IntValue>("ProblemSize", "The dimension of the problem."));
+      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."));
 
-      UniformRandomRealVectorCreator realVectorCreater = new UniformRandomRealVectorCreator();
+      Placeholder realVectorCreater = new Placeholder();
       Assigner personalBestPositionAssigner = new Assigner();
+      RealVectorVelocityInitializer velocityInitializer = new RealVectorVelocityInitializer();
 
       OperatorGraph.InitialOperator = realVectorCreater;
 
-      realVectorCreater.RealVectorParameter.ActualName = RealVectorParameter.Name;
-      realVectorCreater.LengthParameter.ActualName = ProblemSizeParameter.Name;
-      realVectorCreater.BoundsParameter.ActualName = BoundsParameter.Name;
+      realVectorCreater.OperatorParameter.ActualName = SolutionCreatorParameter.Name;
       realVectorCreater.Successor = personalBestPositionAssigner;
 
       personalBestPositionAssigner.LeftSideParameter.ActualName = PersonalBestParameter.Name;
       personalBestPositionAssigner.RightSideParameter.ActualName = RealVectorParameter.Name;
-      personalBestPositionAssigner.Successor = null;
+      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;
     }
     public override IDeepCloneable Clone(Cloner cloner) {
@@ -89,11 +90,4 @@
     }
     #endregion
-
-    public override IOperation Apply() {
-      Velocity = new RealVector(ProblemSize);
-      return base.Apply();
-    }
-
-
   }
 }
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleUpdater.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleUpdater.cs	(revision 15071)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorParticleUpdater.cs	(revision 15091)
@@ -51,7 +51,4 @@
       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"]; }
@@ -60,6 +57,6 @@
       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> InertiaParameter {
@@ -73,43 +70,5 @@
     }
     #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]
@@ -122,8 +81,7 @@
       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."));
       Parameters.Add(new LookupParameter<DoubleValue>("PersonalBestAttraction", "The weight for the particle's personal best position."));
@@ -132,41 +90,54 @@
     #endregion
 
-    protected void MoveParticle(RealVector velocity, RealVector position) {
-      BoundsChecker.Apply(velocity, CurrentVelocityBounds);
+    protected void UpdateVelocity() {
+      var velocity = VelocityParameter.ActualValue;
+      var position = RealVectorParameter.ActualValue;
+      var inertia = InertiaParameter.ActualValue.Value;
+      var personalBest = PersonalBestParameter.ActualValue;
+      var personalBestAttraction = PersonalBestAttractionParameter.ActualValue.Value;
+      var neighborBest = NeighborBestParameter.ActualValue;
+      var neighborBestAttraction = NeighborBestAttractionParameter.ActualValue.Value;
+
+      var random = RandomParameter.ActualValue;
+
       for (int i = 0; i < velocity.Length; i++) {
-        position[i] = RealVector[i] + velocity[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;
       }
+
+      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;
+        }
+      }
+    }
+
+    protected 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];
+        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;
-          }
+          position[i] = min;
+          velocity[i] = -0.5 * velocity[i]; // SPSO 2011
         }
         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;
-          }
+          position[i] = max;
+          velocity[i] = -0.5 * velocity[i]; // SPSO 2011
         }
       }
-
-      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 15071)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorSwarmUpdater.cs	(revision 15091)
@@ -76,9 +76,9 @@
       get { return (IScopeTreeLookupParameter<IntArray>)Parameters["Neighbors"]; }
     }
-    public IValueLookupParameter<DoubleMatrix> VelocityBoundsParameter {
-      get { return (ValueLookupParameter<DoubleMatrix>)Parameters["VelocityBounds"]; }
-    }
-    public ILookupParameter<DoubleMatrix> CurrentVelocityBoundsParameter {
-      get { return (ILookupParameter<DoubleMatrix>)Parameters["CurrentVelocityBounds"]; }
+    public IValueLookupParameter<DoubleValue> MaxVelocityParameter {
+      get { return (ValueLookupParameter<DoubleValue>)Parameters["MaxVelocity"]; }
+    }
+    public ILookupParameter<DoubleValue> CurrentMaxVelocityParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["CurrentMaxVelocity"]; }
     }
     public LookupParameter<ResultCollection> ResultsParameter {
@@ -86,25 +86,19 @@
     }
 
-    #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"]; }
+    #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
@@ -132,22 +126,19 @@
       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<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 ValueLookupParameter<DoubleValue>("MaxVelocity", "Speed limit for each particle.", new DoubleValue(1)));
+      Parameters.Add(new LookupParameter<DoubleValue>("CurrentMaxVelocity", "Current value of the speed limit."));
       Parameters.Add(new LookupParameter<ResultCollection>("Results", "Results"));
 
       #region Velocity Bounds Updating
-      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;
+      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();
-      RegisterEvents();
     }
 
@@ -167,74 +158,44 @@
         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(CurrentVelocityBoundsParameter);
-      ResultsCollector.CollectedValues.Add(VelocityBoundsParameter);
+      ResultsCollector.CollectedValues.Add(CurrentMaxVelocityParameter);
+      ResultsCollector.CollectedValues.Add(MaxVelocityParameter);
 
       foreach (IDiscreteDoubleValueModifier op in ApplicationManager.Manager.GetInstances<IDiscreteDoubleValueModifier>()) {
-        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;
+        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();
-      UpdateGlobalBest(max, particles);
+      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);
-      UpdatePersonalBest(max, particles);
-      return UpdateVelocityBounds();
-    }
-
-    private void UpdateGlobalBest(bool maximization, IList<Tuple<int, RealVector, double>> particles) {
-      var best = maximization ? particles.MaxItems(x => x.Item3).First() : particles.MinItems(x => x.Item3).First();
-      var bestQuality = SwarmBestQualityParameter.ActualValue;
-      if (bestQuality == null) {
-        SwarmBestQualityParameter.ActualValue = new DoubleValue(best.Item3);
-      } else bestQuality.Value = best.Item3;
-      BestRealVectorParameter.ActualValue = (RealVector)best.Item2.Clone();
+
+      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;
     }
 
@@ -253,4 +214,9 @@
         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)));
       }
     }
@@ -268,45 +234,8 @@
           !maximization && p.Item3 < personalBestQuality[p.Item1].Value) {
           personalBestQuality[p.Item1].Value = p.Item3;
-          personalBest[p.Item1] = p.Item2;
+          personalBest[p.Item1] = (RealVector)p.Item2.Clone();
         }
       }
       PersonalBestParameter.ActualValue = personalBest;
-    }
-
-    private IOperation UpdateVelocityBounds() {
-      var currentVelocityBounds = CurrentVelocityBoundsParameter.ActualValue;
-
-      if (currentVelocityBounds == null) {
-        currentVelocityBounds = (DoubleMatrix)VelocityBoundsParameter.ActualValue.Clone();
-        CurrentVelocityBoundsParameter.ActualValue = currentVelocityBounds;
-      }
-      if (VelocityBoundsScalingOperatorParameter.Value == null)
-        return new OperationCollection() {
-          ExecutionContext.CreateChildOperation(ResultsCollector),        
-          base.Apply()
-        };
-
-      var velocityBoundsScale = VelocityBoundsScaleParameter.ActualValue;
-      var velocityBoundsStartValue = VelocityBoundsStartValueParameter.ActualValue;
-
-      if (velocityBoundsScale == null && velocityBoundsStartValue != null) {
-        velocityBoundsScale = new DoubleValue(velocityBoundsStartValue.Value);
-        VelocityBoundsScaleParameter.ActualValue = velocityBoundsScale;
-      }
-      for (int i = 0; i < currentVelocityBounds.Rows; i++) {
-        for (int j = 0; j < currentVelocityBounds.Columns; j++) {
-          if (currentVelocityBounds[i, j] >= 0) {
-            currentVelocityBounds[i, j] = velocityBoundsScale.Value;
-          } else {
-            currentVelocityBounds[i, j] = (-1) * velocityBoundsScale.Value;
-          }
-        }
-      }
-
-      return new OperationCollection() {
-        ExecutionContext.CreateChildOperation(ResultsCollector),
-        ExecutionContext.CreateChildOperation(VelocityBoundsScalingOperatorParameter.Value),
-        base.Apply()
-      };
     }
   }
Index: trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorTotallyConnectedParticleUpdater.cs
===================================================================
--- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorTotallyConnectedParticleUpdater.cs	(revision 15071)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorTotallyConnectedParticleUpdater.cs	(revision 15091)
@@ -20,13 +20,17 @@
 #endregion
 
+using System;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Optimization;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.PluginInfrastructure;
 
 namespace HeuristicLab.Encodings.RealVectorEncoding {
   [Item("Totally Connected Particle Updater", "Updates the particle's position using (among other things) the global best position. Use together with the empty topology initialzer. Point = Point + Velocity*Inertia + (PersonalBestPoint-Point)*Phi_P*r_p + (BestPoint-Point)*Phi_G*r_g")]
   [StorableClass]
-  public sealed class RealVectorTotallyConnectedParticleUpdater : RealVectorParticleUpdater, IGlobalParticleUpdater {
+  [NonDiscoverableType]
+  [Obsolete("Same as the RealVectorNeighborhoodParticleUpdate")]
+  internal sealed class RealVectorTotallyConnectedParticleUpdater : RealVectorParticleUpdater {
 
     #region Construction & Cloning
@@ -41,21 +45,6 @@
 
     public override IOperation Apply() {
-      double inertia = Inertia.Value;
-      double personalBestAttraction = PersonalBestAttraction.Value;
-      double neighborBestAttraction = NeighborBestAttraction.Value;
-
-      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++) {
-        velocity[i] =
-          Velocity[i] * inertia +
-          (PersonalBest[i] - RealVector[i]) * personalBestAttraction * r_p +
-          (BestPoint[i] - RealVector[i]) * neighborBestAttraction * r_g;
-      }
-
-      MoveParticle(velocity, position);
+      UpdateVelocity();
+      UpdatePosition();
 
       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 15091)
+++ trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorVelocityInitializer.cs	(revision 15091)
@@ -0,0 +1,84 @@
+﻿#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();
+    }
+  }
+}
