Index: trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs	(revision 3682)
+++ trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs	(revision 3719)
@@ -81,15 +81,15 @@
 
     #region Properties
-    [StorableAttribute]
+    [Storable]
     private ParticleSwarmOptimizationMainLoop mainLoop; // Check this !
     private ParticleSwarmOptimizationMainLoop MainLoop {
       get { return mainLoop; }
     }
-    [StorableAttribute]
+    [Storable]
     private Assigner bestLocalQualityInitalizer; // Check this !
     private Assigner BestLocalQualityInitalizer {
       get { return bestLocalQualityInitalizer; }
     }
-
+    [Storable]
     private BestAverageWorstQualityAnalyzer qualityAnalyzer;
     #endregion
@@ -102,5 +102,4 @@
       Parameters.Add(new ValueParameter<IntValue>("MaxIterations", "Maximal number of iterations.", new IntValue(1000)));
       Parameters.Add(new ConstrainedValueParameter<IRealVectorEncoder>("Encoder", "The operator used to encode solutions as position vector."));
-      Parameters.Add(new ValueParameter<IntValue>("PositionLength", "Length of the position encoding.", new IntValue(0)));
       Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));
       RandomCreator randomCreator = new RandomCreator();
@@ -181,4 +180,6 @@
       comparator.Successor = branch;
       uniformSubScopesProcessor2.Successor = mainLoop;
+      InitializeAnalyzers();
+      UpdateAnalyzers();
       Initialize();
     }
@@ -186,6 +187,4 @@
     [StorableHook(HookType.AfterDeserialization)]
     private void Initialize() {
-      InitializeAnalyzers();
-      UpdateAnalyzers();
       EncoderParameter.ValueChanged += new EventHandler(EncoderParameter_ValueChanged);
       if (Problem != null) {
@@ -211,4 +210,5 @@
       UpdateEncoders();
       UpdateAnalyzers();
+      ParameterizeAnalyzers(); 
       bestLocalQualityInitalizer.RightSideParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
       Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
@@ -218,5 +218,5 @@
 
     private void EncoderParameter_ValueChanged(object sender, EventArgs e) {
-      //IRealVectorEncoder old = (IRealVectorEncoder)((UniformSubScopesProcessor)((VariableCreator)((SolutionsCreator)((RandomCreator)OperatorGraph.InitialOperator).Successor).Successor).Successor).Operator;
+      //MainLoop.EncoderParameter.ActualValue = (IRealVectorEncoder) EncoderParameter.ActualValue;
       //((UniformSubScopesProcessor)((VariableCreator)((SolutionsCreator)((RandomCreator)OperatorGraph.InitialOperator).Successor).Successor).Successor).Operator = EncoderParameter.Value;
       //((SingleSuccessorOperator)EncoderParameter.Value).Successor = ((SingleSuccessorOperator)old).Successor;
@@ -228,8 +228,4 @@
       // 
       //
-    }
-
-    private void ParameterizeMainLoop() {
-      //GeneticAlgorithmMainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
     }
 
Index: trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimizationMainLoop.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimizationMainLoop.cs	(revision 3682)
+++ trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimizationMainLoop.cs	(revision 3719)
@@ -12,4 +12,5 @@
 using HeuristicLab.Optimization.Operators;
 using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Optimization;
 
 namespace HeuristicLab.Algorithms.ParticleSwarmOptimization {
@@ -24,6 +25,6 @@
       get { return (ValueLookupParameter<VariableCollection>)Parameters["Results"]; }
     }
-    public ValueLookupParameter<IOperator> EncoderParameter {
-      get { return (ValueLookupParameter<IOperator>)Parameters["Encoder"]; }
+    public ValueLookupParameter<IRealVectorEncoder> EncoderParameter {
+      get { return (ValueLookupParameter<IRealVectorEncoder>)Parameters["Encoder"]; }
     }
     public ValueLookupParameter<IOperator> DecoderParameter {
@@ -47,4 +48,7 @@
     #endregion
 
+    [Storable]
+    private ParticleUpdater velocityUpdater; 
+
     [StorableConstructor]
     private ParticleSwarmOptimizationMainLoop(bool deserializing) : base() { }
@@ -57,5 +61,5 @@
       #region Create parameters
       Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
-      Parameters.Add(new ValueLookupParameter<IOperator>("Encoder", "The encoding operator that maps a solution to a position vector."));
+      Parameters.Add(new ValueLookupParameter<IRealVectorEncoder>("Encoder", "The encoding operator that maps a solution to a position vector."));
       Parameters.Add(new ValueLookupParameter<IOperator>("Decoder", "The decoding operator that maps a position vector to a solution."));
       Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
@@ -66,4 +70,6 @@
       #endregion
 
+      EncoderParameter.ActualNameChanged += new EventHandler(EncoderParameter_ActualNameChanged);
+
       #region Create operators
       VariableCreator variableCreator = new VariableCreator();
@@ -71,5 +77,5 @@
       IntCounter intCounter = new IntCounter();
       ConditionalBranch conditionalBranch = new ConditionalBranch();
-      ParticleUpdater velocityUpdater = new ParticleUpdater(); 
+      velocityUpdater = new ParticleUpdater(); 
       UniformSubScopesProcessor uniformSubScopesProcessor = new UniformSubScopesProcessor();
       UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor();
@@ -84,5 +90,5 @@
       analyzer1.OperatorParameter.ActualName = AnalyzerParameter.Name;
 
-      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(1))); // Initial generation already built
+      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Initial generation already built
 
       resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
@@ -103,4 +109,6 @@
       velocityUpdater.CurrentPositionParameter.ActualName = "Position";
       velocityUpdater.VelocityParameter.ActualName = "Velocity";
+      //
+      // ToDo: Add correctly 
 
       encPlaceholder.OperatorParameter.ActualName = EncoderParameter.ActualName;
@@ -116,5 +124,4 @@
       swarmUpdater.LocalBestQualityParameter.ActualName = "BestQuality";
       swarmUpdater.GlobalBestQualityParameter.ActualName = "CurrentBestBestQuality";
-
       #endregion
 
@@ -125,13 +132,17 @@
       conditionalBranch.FalseBranch = uniformSubScopesProcessor;
       uniformSubScopesProcessor.Operator = velocityUpdater;
+      uniformSubScopesProcessor.Successor = intCounter;
       velocityUpdater.Successor = decPlaceholder;
-      uniformSubScopesProcessor.Successor = uniformSubScopesProcessor2;
-      uniformSubScopesProcessor2.Operator = evaluator;
+      decPlaceholder.Successor = evaluator;
       evaluator.Successor = swarmUpdater;
-      swarmUpdater.Successor = intCounter;
+      swarmUpdater.Successor = null;
       intCounter.Successor = resultsCollector1;
-      resultsCollector1.Successor = comparator; //analyzer1; 
-      //analyzer1.Successor = comparator;
+      resultsCollector1.Successor = analyzer1; 
+      analyzer1.Successor = comparator;
       #endregion
+    }
+
+    private void EncoderParameter_ActualNameChanged(object sender, EventArgs e) {
+      velocityUpdater.BoundsParameter.ActualName = EncoderParameter.ActualValue.BoundsParameter.ActualName;
     }
   }
Index: trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleUpdater.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleUpdater.cs	(revision 3682)
+++ trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleUpdater.cs	(revision 3719)
@@ -32,4 +32,8 @@
       get { return (ILookupParameter<RealVector>)Parameters["BestGlobal"]; }
     }
+
+    public ILookupParameter<DoubleMatrix> BoundsParameter {
+      get { return (ILookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
+    }
     #endregion
 
@@ -41,4 +45,5 @@
       Parameters.Add(new LookupParameter<RealVector>("BestLocal", "Best local position"));
       Parameters.Add(new LookupParameter<RealVector>("BestGlobal", "Best global position"));
+      Parameters.Add(new LookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds for each dimension of the position vector."));
     }
 
@@ -53,4 +58,9 @@
       for (int i = 0; i < CurrentPositionParameter.ActualValue.Length; i++) {
         CurrentPositionParameter.ActualValue[i] = CurrentPositionParameter.ActualValue[i] + VelocityParameter.ActualValue[i];
+        if (CurrentPositionParameter.ActualValue[i] < BoundsParameter.ActualValue[0,0]) {
+          CurrentPositionParameter.ActualValue[i] = BoundsParameter.ActualValue[0, 0]; 
+        } else if (CurrentPositionParameter.ActualValue[i] > BoundsParameter.ActualValue[0,1]) {
+          CurrentPositionParameter.ActualValue[i] = BoundsParameter.ActualValue[0, 1]; 
+        }
       }
       return base.Apply();
Index: trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/PermutationToRealVectorEncoder.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/PermutationToRealVectorEncoder.cs	(revision 3682)
+++ trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/PermutationToRealVectorEncoder.cs	(revision 3719)
@@ -28,8 +28,18 @@
     }
 
+    public IValueLookupParameter<DoubleMatrix> BoundsParameter {
+      get { return (IValueLookupParameter<DoubleMatrix>)Parameters["Bounds"]; }
+    }
+
+    public DoubleMatrix Bounds {
+      get { return (DoubleMatrix)BoundsParameter.ActualValue; }
+      set { BoundsParameter.ActualValue = value; }
+    }
+
     public PermutationToRealVectorEncoder() : base() {
       Parameters.Add(new LookupParameter<Permutation>("Permutation", "The permutation to encode."));
       Parameters.Add(new LookupParameter<RealVector>("RealVector", "The resulting real vector."));
       Parameters.Add(new LookupParameter<IntValue>("Length", "Vector length."));
+      Parameters.Add(new ValueLookupParameter<DoubleMatrix>("Bounds", "The lower and upper bounds in each dimension."));
     }
 
