Index: trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/HeuristicLab.Algorithms.ParticleSwarmOptimization-3.3.csproj
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/HeuristicLab.Algorithms.ParticleSwarmOptimization-3.3.csproj	(revision 3681)
+++ trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/HeuristicLab.Algorithms.ParticleSwarmOptimization-3.3.csproj	(revision 3682)
@@ -81,10 +81,10 @@
   <ItemGroup>
     <Compile Include="HeuristicLabAlgorithmsParticleSwarmOptimizationPlugin.cs" />
-    <Compile Include="IRealVectorEncoder.cs" />
     <Compile Include="ParticleSwarmOptimization.cs" />
     <Compile Include="ParticleSwarmOptimizationMainLoop.cs" />
     <Compile Include="PermutationToRealVectorEncoder.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="RealVectorToRealVectorEncoder.cs" />
+    <Compile Include="ParticleUpdater.cs" />
+    <Compile Include="SwarmUpdater.cs" />
   </ItemGroup>
   <ItemGroup>
@@ -94,4 +94,8 @@
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
+      <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
+      <Name>HeuristicLab.Analysis-3.3</Name>
+    </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
       <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
Index: trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs	(revision 3681)
+++ trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimization.cs	(revision 3682)
@@ -34,4 +34,5 @@
 using HeuristicLab.PluginInfrastructure;
 using HeuristicLab.Random;
+using HeuristicLab.Analysis;
 
 namespace HeuristicLab.Algorithms.ParticleSwarmOptimization {
@@ -52,4 +53,8 @@
       set { EncoderParameter.Value = value; }
     }
+    public MultiAnalyzer Analyzer {
+      get { return AnalyzerParameter.Value; }
+      set { AnalyzerParameter.Value = value; }
+    }
     #endregion 
 
@@ -69,4 +74,7 @@
     private OptionalConstrainedValueParameter<IRealVectorEncoder> EncoderParameter {
       get { return (OptionalConstrainedValueParameter<IRealVectorEncoder>)Parameters["Encoder"]; }
+    }
+    private ValueParameter<MultiAnalyzer> AnalyzerParameter {
+      get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
     }
     #endregion
@@ -78,4 +86,11 @@
       get { return mainLoop; }
     }
+    [StorableAttribute]
+    private Assigner bestLocalQualityInitalizer; // Check this !
+    private Assigner BestLocalQualityInitalizer {
+      get { return bestLocalQualityInitalizer; }
+    }
+
+    private BestAverageWorstQualityAnalyzer qualityAnalyzer;
     #endregion
 
@@ -86,14 +101,29 @@
       Parameters.Add(new ValueParameter<IntValue>("SwarmSize", "Size of the particle swarm.", new IntValue(1)));
       Parameters.Add(new ValueParameter<IntValue>("MaxIterations", "Maximal number of iterations.", new IntValue(1000)));
-      Parameters.Add(new OptionalConstrainedValueParameter<IRealVectorEncoder>("Encoder", "The operator used to encode solutions as position vector."));
-      //Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
+      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();
       SolutionsCreator solutionsCreator = new SolutionsCreator();
       UniformSubScopesProcessor uniformSubScopesProcessor = new UniformSubScopesProcessor();
+      UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor();
       VariableCreator variableCreator = new VariableCreator();
-      variableCreator.CollectedValues.Add(new ValueParameter<RealVector>("Velocity", new RealVector()));
-      //solutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreator.Name;
-      //mainLoop = new ParticleSwarmOptimizationMainLoop();
-      OperatorGraph.InitialOperator = randomCreator;
+      VariableCreator localVariableCreator = new VariableCreator();
+      Placeholder encoder = new Placeholder();
+      UniformRandomRealVectorCreator velocityVectorCreator = new UniformRandomRealVectorCreator();
+      bestLocalQualityInitalizer = new Assigner();
+      Assigner bestLocalPositionInitalizer = new Assigner();
+      Assigner bestGlobalPositionInitalizer = new Assigner();
+      mainLoop = new ParticleSwarmOptimizationMainLoop();
+      BestAverageWorstQualityCalculator bawCalculator = new BestAverageWorstQualityCalculator();
+      Comparator comparator = new Comparator();
+      ConditionalBranch branch = new ConditionalBranch();
+
+      variableCreator.CollectedValues.Add(new ValueParameter<RealVector>("CurrentBestPosition", new RealVector()));
+      variableCreator.CollectedValues.Add(new ValueParameter<DoubleMatrix>("ZeroBounds", new DoubleMatrix(new double[,] { { 0, 0 } })));
+      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Length", new IntValue(2)));
+
+      localVariableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(0)));
+      localVariableCreator.CollectedValues.Add(new ValueParameter<RealVector>("BestPosition", new RealVector()));
 
       randomCreator.RandomParameter.ActualName = "Random";
@@ -102,14 +132,53 @@
       randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
       randomCreator.SetSeedRandomlyParameter.Value = null;
+      
+      solutionsCreator.NumberOfSolutionsParameter.ActualName = SwarmSizeParameter.Name;
+      
+      encoder.OperatorParameter.ActualName = "Encoder";
+      
+      velocityVectorCreator.BoundsParameter.ActualName = "ZeroBounds";
+      velocityVectorCreator.RealVectorParameter.ActualName = "Velocity";
+
+      bestLocalQualityInitalizer.LeftSideParameter.ActualName = "BestQuality"; // cloned value
+      bestLocalQualityInitalizer.RightSideParameter.ActualName = "Quality"; // FIXME!!! Should be mapped
+
+      bestLocalPositionInitalizer.LeftSideParameter.ActualName = "BestPosition";
+      bestLocalPositionInitalizer.RightSideParameter.ActualName = "Position"; // FixMe
+
+      bestGlobalPositionInitalizer.LeftSideParameter.ActualName = "CurrentBestPosition";
+      bestGlobalPositionInitalizer.RightSideParameter.ActualName = "BestPosition";
+
+      bawCalculator.AverageQualityParameter.ActualName = "CurrentAverageBestQuality";
+      bawCalculator.BestQualityParameter.ActualName = "CurrentBestBestQuality";
+      bawCalculator.MaximizationParameter.ActualName = "Maximization"; // FIXME
+      bawCalculator.QualityParameter.ActualName = "Quality";
+      bawCalculator.WorstQualityParameter.ActualName = "CurrentWorstBestQuality";
+
+      comparator.Comparison = new Comparison(ComparisonType.Equal);
+      comparator.LeftSideParameter.ActualName = "Quality";
+      comparator.ResultParameter.ActualName = "NewGlobalBest";
+      comparator.RightSideParameter.ActualName = "CurrentBestBestQuality";
+
+      branch.ConditionParameter.ActualName = "NewGlobalBest";
+      branch.TrueBranch = bestGlobalPositionInitalizer; // copy position vector
+
+      mainLoop.MaximumGenerationsParameter.ActualName = MaxIterationsParameter.Name;
+      mainLoop.ResultsParameter.ActualName = "Results";
+      mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
+
+      OperatorGraph.InitialOperator = randomCreator;
       randomCreator.Successor = solutionsCreator;
-
-      solutionsCreator.NumberOfSolutionsParameter.ActualName = SwarmSizeParameter.Name;
       solutionsCreator.Successor = variableCreator;
       variableCreator.Successor = uniformSubScopesProcessor;
-      
-
-      //evaluator.Successor = mainLoop;
-      //mainLoop.EncoderParameter.ActualName = EncoderParameter.Name;
-
+      uniformSubScopesProcessor.Operator = encoder;
+      encoder.Successor = velocityVectorCreator;
+      velocityVectorCreator.Successor = localVariableCreator;
+      localVariableCreator.Successor = bestLocalQualityInitalizer;
+      bestLocalQualityInitalizer.Successor = bestLocalPositionInitalizer;
+      uniformSubScopesProcessor.Successor = bawCalculator; // mainLoop;
+      bawCalculator.Successor = uniformSubScopesProcessor2;
+      uniformSubScopesProcessor2.Operator = comparator;
+      comparator.Successor = branch;
+      uniformSubScopesProcessor2.Successor = mainLoop;
       Initialize();
     }
@@ -117,5 +186,10 @@
     [StorableHook(HookType.AfterDeserialization)]
     private void Initialize() {
+      InitializeAnalyzers();
+      UpdateAnalyzers();
       EncoderParameter.ValueChanged += new EventHandler(EncoderParameter_ValueChanged);
+      if (Problem != null) {
+        bestLocalQualityInitalizer.RightSideParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
+      }
     }
 
@@ -135,33 +209,65 @@
     #region Events
     protected override void OnProblemChanged() {
-      //ParameterizeStochasticOperator(Problem.SolutionCreator);
-      //ParameterizeStochasticOperator(Problem.Evaluator);
-      //ParameterizeStochasticOperator(Problem.Visualizer);
-      //foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
-      //ParameterizeSolutionsCreator();
-      //ParameterizeMainLoop();
       UpdateEncoders();
-      //UpdateMutators();
-      //Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
+      UpdateAnalyzers();
+      bestLocalQualityInitalizer.RightSideParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
+      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
+      MainLoop.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
       base.OnProblemChanged();
     }
 
     private void EncoderParameter_ValueChanged(object sender, EventArgs e) {
-      ((UniformSubScopesProcessor)((SolutionsCreator)((RandomCreator)OperatorGraph.InitialOperator).Successor).Successor).Operator = EncoderParameter.Value;
+      //IRealVectorEncoder old = (IRealVectorEncoder)((UniformSubScopesProcessor)((VariableCreator)((SolutionsCreator)((RandomCreator)OperatorGraph.InitialOperator).Successor).Successor).Successor).Operator;
+      //((UniformSubScopesProcessor)((VariableCreator)((SolutionsCreator)((RandomCreator)OperatorGraph.InitialOperator).Successor).Successor).Successor).Operator = EncoderParameter.Value;
+      //((SingleSuccessorOperator)EncoderParameter.Value).Successor = ((SingleSuccessorOperator)old).Successor;
     }
     #endregion
 
     #region Helpers
+    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
+      // 
+      //
+    }
+
+    private void ParameterizeMainLoop() {
+      //GeneticAlgorithmMainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
+    }
 
     private void UpdateEncoders() {
       IRealVectorEncoder oldEncoder = EncoderParameter.Value;
       EncoderParameter.ValidValues.Clear();
-      foreach (IRealVectorEncoder encoder in Problem.Operators.OfType<IRealVectorEncoder>().OrderBy(x => x.Name)) {
-        EncoderParameter.ValidValues.Add(encoder);
-        encoder.RealVectorParameter.ActualName = "Position"; 
-      }
-      if (oldEncoder != null) {
-        IRealVectorEncoder encoder = EncoderParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldEncoder.GetType());
-        if (encoder != null) EncoderParameter.Value = encoder;
+      List<IRealVectorEncoder> encoders = Problem.Operators.OfType<IRealVectorEncoder>().OrderBy(x => x.Name).ToList<IRealVectorEncoder>();
+      if (encoders.Count > 0) {  // ToDo: Add wiring; else: use Position Vector directly --> name matching
+        foreach (IRealVectorEncoder encoder in Problem.Operators.OfType<IRealVectorEncoder>().OrderBy(x => x.Name)) {
+          EncoderParameter.ValidValues.Add(encoder);
+          ((ILookupParameter)encoder.RealVectorParameter).ActualName = "Position";
+        }
+        if (oldEncoder != null) {
+          IRealVectorEncoder encoder = EncoderParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldEncoder.GetType());
+          if (encoder != null) EncoderParameter.Value = encoder;
+        }
+      }
+    }
+
+    private void InitializeAnalyzers() {
+      qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
+      ParameterizeAnalyzers();
+    }
+
+    private void ParameterizeAnalyzers() {
+      qualityAnalyzer.ResultsParameter.ActualName = "Results";
+      if (Problem != null) {
+        qualityAnalyzer.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
+        qualityAnalyzer.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
+        qualityAnalyzer.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
+      }
+    }
+
+    private void UpdateAnalyzers() {
+      Analyzer.Operators.Clear();
+      Analyzer.Operators.Add(qualityAnalyzer);
+      if (Problem != null) {
+        foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>().OrderBy(x => x.Name))
+          Analyzer.Operators.Add(analyzer);
       }
     }
Index: trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimizationMainLoop.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimizationMainLoop.cs	(revision 3681)
+++ trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/ParticleSwarmOptimizationMainLoop.cs	(revision 3682)
@@ -9,4 +9,7 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Data;
+using HeuristicLab.Analysis;
+using HeuristicLab.Optimization.Operators;
+using HeuristicLab.Encodings.RealVectorEncoding;
 
 namespace HeuristicLab.Algorithms.ParticleSwarmOptimization {
@@ -24,7 +27,22 @@
       get { return (ValueLookupParameter<IOperator>)Parameters["Encoder"]; }
     }
-    //public ValueLookupParameter<IOperator> EvaluatorParameter {
-    //  get { return (ValueLookupParameter<IOperator>)Parameters["Evaluator"]; }
-    //}
+    public ValueLookupParameter<IOperator> DecoderParameter {
+      get { return (ValueLookupParameter<IOperator>)Parameters["Decoder"]; }
+    }
+    public ValueLookupParameter<BoolValue> MaximizationParameter {
+      get { return (ValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
+    }
+    public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
+      get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
+    }
+    public ValueLookupParameter<IntValue> MaximumGenerationsParameter {
+      get { return (ValueLookupParameter<IntValue>)Parameters["MaximumGenerations"]; }
+    }
+    public ValueLookupParameter<IOperator> EvaluatorParameter {
+      get { return (ValueLookupParameter<IOperator>)Parameters["Evaluator"]; }
+    }
+    public ValueLookupParameter<IOperator> AnalyzerParameter {
+      get { return (ValueLookupParameter<IOperator>)Parameters["Analyzer"]; }
+    }
     #endregion
 
@@ -40,26 +58,79 @@
       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<IOperator>("Evaluator", "The operator used to evaluate solutions."));
+      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."));
+      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution."));
+      Parameters.Add(new ValueLookupParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed."));
+      Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions."));
+      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze each generation."));
       #endregion
 
       #region Create operators
       VariableCreator variableCreator = new VariableCreator();
-      //variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0)));
+      ResultsCollector resultsCollector1 = new ResultsCollector();
+      IntCounter intCounter = new IntCounter();
+      ConditionalBranch conditionalBranch = new ConditionalBranch();
+      ParticleUpdater velocityUpdater = new ParticleUpdater(); 
       UniformSubScopesProcessor uniformSubScopesProcessor = new UniformSubScopesProcessor();
-      Placeholder encoder = new Placeholder();
+      UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor();
+      Placeholder encPlaceholder = new Placeholder();
+      Placeholder decPlaceholder = new Placeholder(); 
       Placeholder evaluator = new Placeholder();
+      Comparator comparator = new Comparator();
+      SwarmUpdater swarmUpdater = new SwarmUpdater();
+      Placeholder analyzer1 = new Placeholder();
 
-      encoder.Name = "Encoder (placeholder)";
-      encoder.OperatorParameter.ActualName = EncoderParameter.Name;
+      analyzer1.Name = "Analyzer (placeholder)";
+      analyzer1.OperatorParameter.ActualName = AnalyzerParameter.Name;
 
-      //evaluator.Name = "Evaluator (placeholder)";
-      //evaluator.OperatorParameter.ActualName = EvaluatorParameter.Name;
+      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(1))); // Initial generation already built
+
+      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
+      resultsCollector1.ResultsParameter.ActualName = "Results";
+
+      intCounter.Increment = new IntValue(1);
+      intCounter.ValueParameter.ActualName = "Generations";
+
+      comparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
+      comparator.LeftSideParameter.ActualName = "Generations";
+      comparator.ResultParameter.ActualName = "Terminate";
+      comparator.RightSideParameter.ActualName = MaximumGenerationsParameter.Name;
+
+      conditionalBranch.ConditionParameter.ActualName = "Terminate";
+
+      velocityUpdater.BestGlobalParameter.ActualName = "CurrentBestPosition";
+      velocityUpdater.BestLocalParameter.ActualName = "BestPosition";
+      velocityUpdater.CurrentPositionParameter.ActualName = "Position";
+      velocityUpdater.VelocityParameter.ActualName = "Velocity";
+
+      encPlaceholder.OperatorParameter.ActualName = EncoderParameter.ActualName;
+      decPlaceholder.OperatorParameter.ActualName = DecoderParameter.ActualName; 
+
+      evaluator.Name = "Evaluator (placeholder)";
+      evaluator.OperatorParameter.ActualName = EvaluatorParameter.Name;
+
+      swarmUpdater.CurrentPositionParameter.ActualName = "Position";
+      swarmUpdater.CurrentQualityParameter.ActualName = "Quality";
+      swarmUpdater.BestGlobalParameter.ActualName = "CurrentBestPosition";
+      swarmUpdater.BestLocalParameter.ActualName = "BestPosition";
+      swarmUpdater.LocalBestQualityParameter.ActualName = "BestQuality";
+      swarmUpdater.GlobalBestQualityParameter.ActualName = "CurrentBestBestQuality";
+
       #endregion
 
       #region Create operator graph
       OperatorGraph.InitialOperator = variableCreator;
-      variableCreator.Successor = uniformSubScopesProcessor;
-      uniformSubScopesProcessor.Operator = encoder;
-      //uniformSubScopesProcessor.Successor = evaluator;
+      variableCreator.Successor = comparator;
+      comparator.Successor = conditionalBranch;
+      conditionalBranch.FalseBranch = uniformSubScopesProcessor;
+      uniformSubScopesProcessor.Operator = velocityUpdater;
+      velocityUpdater.Successor = decPlaceholder;
+      uniformSubScopesProcessor.Successor = uniformSubScopesProcessor2;
+      uniformSubScopesProcessor2.Operator = evaluator;
+      evaluator.Successor = swarmUpdater;
+      swarmUpdater.Successor = intCounter;
+      intCounter.Successor = resultsCollector1;
+      resultsCollector1.Successor = comparator; //analyzer1; 
+      //analyzer1.Successor = comparator;
       #endregion
     }
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 3682)
@@ -0,0 +1,63 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Data;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Algorithms.ParticleSwarmOptimization {
+  public class ParticleUpdater : SingleSuccessorOperator { // ParticleUpdater
+    #region Parameter properties
+
+    public ILookupParameter<RealVector> VelocityParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["Velocity"]; }
+    }
+
+    public IParameter RandomParameter {
+      get { return (IParameter)Parameters["Random"]; }
+    }
+
+    public ILookupParameter<RealVector> CurrentPositionParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["CurrentPosition"]; }
+    }
+
+    public ILookupParameter<RealVector> BestLocalParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["BestLocal"]; }
+    }
+
+    public ILookupParameter<RealVector> BestGlobalParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["BestGlobal"]; }
+    }
+    #endregion
+
+    public ParticleUpdater()
+      : base() {
+      Parameters.Add(new LookupParameter<IRandom>("Random", "Random number generator (to generate alpha an beta)."));
+      Parameters.Add(new LookupParameter<RealVector>("Velocity", "The velocity vector to update."));
+      Parameters.Add(new LookupParameter<RealVector>("CurrentPosition", "Current position"));
+      Parameters.Add(new LookupParameter<RealVector>("BestLocal", "Best local position"));
+      Parameters.Add(new LookupParameter<RealVector>("BestGlobal", "Best global position"));
+    }
+
+    public override IOperation Apply() {
+      double alpha = ((IRandom)RandomParameter.ActualValue).NextDouble();
+      double beta = ((IRandom)RandomParameter.ActualValue).NextDouble();
+      RealVector velocity = (RealVector) VelocityParameter.ActualValue; 
+      for (int i = 0; i < velocity.Length; i++) {
+        velocity[i] = velocity[i] + alpha * (BestLocalParameter.ActualValue[i] - CurrentPositionParameter.ActualValue[i]) + beta * (BestGlobalParameter.ActualValue[i] - CurrentPositionParameter.ActualValue[i]);
+      }
+      VelocityParameter.ActualValue = velocity;
+      for (int i = 0; i < CurrentPositionParameter.ActualValue.Length; i++) {
+        CurrentPositionParameter.ActualValue[i] = CurrentPositionParameter.ActualValue[i] + VelocityParameter.ActualValue[i];
+      }
+      return base.Apply();
+    }
+
+    public override bool CanChangeName {
+      get { return false; }
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/PermutationToRealVectorEncoder.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/PermutationToRealVectorEncoder.cs	(revision 3681)
+++ trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/PermutationToRealVectorEncoder.cs	(revision 3682)
@@ -11,10 +11,11 @@
 using HeuristicLab.Encodings.RealVectorEncoding;
 using HeuristicLab.Collections;
+using HeuristicLab.Optimization;
 
 namespace HeuristicLab.Algorithms.ParticleSwarmOptimization {
-  public class PermutationToRealVectorEncoder : SingleSuccessorOperator, IRealVectorEncoder, IPermutationManipulator {
+  public class PermutationToRealVectorEncoder : SingleSuccessorOperator, IRealVectorEncoder {
 
-    public ILookupParameter<RealVector> RealVectorParameter {
-      get { return (ILookupParameter<RealVector>)Parameters["RealVector"]; }
+    public IParameter RealVectorParameter {
+      get { return (IParameter)Parameters["RealVector"]; }
     }
 
@@ -23,7 +24,12 @@
     }
 
+    public ILookupParameter<IntValue> LengthParameter {
+      get { return (ILookupParameter<IntValue>)Parameters["Length"]; }
+    }
+
     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."));
     }
 
@@ -37,5 +43,6 @@
         max = max - 1; 
       }
-      RealVectorParameter.ActualValue = realVector; 
+      RealVectorParameter.ActualValue = realVector;
+      LengthParameter.ActualValue = new IntValue(realVector.Length); 
       return base.Apply();
     }
Index: trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/SwarmUpdater.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/SwarmUpdater.cs	(revision 3682)
+++ trunk/sources/HeuristicLab.Algorithms.ParticleSwarmOptimization/3.3/SwarmUpdater.cs	(revision 3682)
@@ -0,0 +1,82 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Operators;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Parameters;
+
+namespace HeuristicLab.Algorithms.ParticleSwarmOptimization {
+  public class SwarmUpdater : SingleSuccessorOperator {
+    #region Parameter properties
+
+    public ILookupParameter<DoubleValue> CurrentQualityParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["CurrentQuality"]; }
+    }
+
+    public ILookupParameter<DoubleValue> LocalBestQualityParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["LocalBestQuality"]; }
+    }
+
+    public ILookupParameter<DoubleValue> GlobalBestQualityParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["GlobalBestQuality"]; }
+    }
+
+    public ILookupParameter<RealVector> CurrentPositionParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["CurrentPosition"]; }
+    }
+
+    public ILookupParameter<RealVector> BestLocalParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["BestLocal"]; }
+    }
+
+    public ILookupParameter<RealVector> BestGlobalParameter {
+      get { return (ILookupParameter<RealVector>)Parameters["BestGlobal"]; }
+    }
+
+    public ValueLookupParameter<BoolValue> MaximizationParameter {
+      get { return (ValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
+    }
+    #endregion
+
+    public SwarmUpdater()
+      : base() {
+      Parameters.Add(new LookupParameter<RealVector>("CurrentPosition", "Current position"));
+      Parameters.Add(new LookupParameter<RealVector>("BestLocal", "Best local position"));
+      Parameters.Add(new LookupParameter<RealVector>("BestGlobal", "Best global position"));
+      Parameters.Add(new LookupParameter<DoubleValue>("LocalBestQuality", "Best local quality"));
+      Parameters.Add(new LookupParameter<DoubleValue>("GlobalBestQuality", "Best global quality"));
+      Parameters.Add(new LookupParameter<DoubleValue>("CurrentQuality", "Current quality"));
+      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false."));
+    }
+
+    public override IOperation Apply() {
+      if (MaximizationParameter.ActualValue.Value) {
+        if (CurrentQualityParameter.ActualValue.Value > LocalBestQualityParameter.ActualValue.Value) {
+          LocalBestQualityParameter.ActualValue.Value = CurrentQualityParameter.ActualValue.Value;
+          BestLocalParameter.ActualValue = (RealVector) CurrentPositionParameter.ActualValue.Clone();
+        }
+        if (CurrentQualityParameter.ActualValue.Value > GlobalBestQualityParameter.ActualValue.Value) {
+          GlobalBestQualityParameter.ActualValue.Value = CurrentQualityParameter.ActualValue.Value;
+          BestGlobalParameter.ActualValue = (RealVector)CurrentPositionParameter.ActualValue.Clone();
+        }
+      } else {
+        if (CurrentQualityParameter.ActualValue.Value < LocalBestQualityParameter.ActualValue.Value) {
+          LocalBestQualityParameter.ActualValue.Value = CurrentQualityParameter.ActualValue.Value;
+          BestLocalParameter.ActualValue = (RealVector)CurrentPositionParameter.ActualValue.Clone();
+        }
+        if (CurrentQualityParameter.ActualValue.Value < GlobalBestQualityParameter.ActualValue.Value) {
+          GlobalBestQualityParameter.ActualValue.Value = CurrentQualityParameter.ActualValue.Value;
+          BestGlobalParameter.ActualValue = (RealVector)CurrentPositionParameter.ActualValue.Clone();
+        }
+      }
+      return base.Apply();
+    }
+
+    public override bool CanChangeName {
+      get { return false; }
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
===================================================================
--- trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj	(revision 3681)
+++ trunk/sources/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj	(revision 3682)
@@ -87,4 +87,6 @@
     <Compile Include="Algorithm.cs" />
     <Compile Include="BatchRun.cs" />
+    <Compile Include="Interfaces\IRealVectorDecoder.cs" />
+    <Compile Include="Interfaces\IRealVectorEncoder.cs" />
     <Compile Include="RunCollectionConstraints\RunCollectionComparisonConstraint.cs" />
     <Compile Include="RunCollectionConstraints\RunCollectionConstraintCollection.cs" />
Index: trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IRealVectorDecoder.cs
===================================================================
--- trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IRealVectorDecoder.cs	(revision 3682)
+++ trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IRealVectorDecoder.cs	(revision 3682)
@@ -0,0 +1,13 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Optimization.Interfaces {
+  public interface IRealVectorDecoder {
+    IParameter RealVectorParameter { get; }
+    ILookupParameter<IntValue> LengthParameter { get; }
+  }
+}
Index: trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IRealVectorEncoder.cs
===================================================================
--- trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IRealVectorEncoder.cs	(revision 3682)
+++ trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IRealVectorEncoder.cs	(revision 3682)
@@ -0,0 +1,33 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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 System;
+
+namespace HeuristicLab.Optimization {
+  public interface IRealVectorEncoder : IOperator {
+    //Type DecoderType { get; }
+    IParameter RealVectorParameter { get; }
+    ILookupParameter<IntValue> LengthParameter { get; }
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/HeuristicLab.Problems.TestFunctions-3.3.csproj
===================================================================
--- trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/HeuristicLab.Problems.TestFunctions-3.3.csproj	(revision 3681)
+++ trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/HeuristicLab.Problems.TestFunctions-3.3.csproj	(revision 3682)
@@ -103,4 +103,5 @@
     <Compile Include="Interfaces\IBestSingleObjectiveTestFunctionSolutionAnalyzer.cs" />
     <Compile Include="Interfaces\IRastriginMoveEvaluator.cs" />
+    <Compile Include="Interfaces\IRealVectorPSOEncoder.cs" />
     <Compile Include="Interfaces\ISingleObjectiveTestFunctionAdditiveMoveEvaluator.cs" />
     <Compile Include="Interfaces\ISingleObjectiveTestFunctionMoveEvaluator.cs" />
@@ -122,4 +123,5 @@
     <Compile Include="MoveEvaluators\AdditiveMoveEvaluator.cs" />
     <Compile Include="MoveEvaluators\RealVectorAdditiveMoveWrapper.cs" />
+    <Compile Include="RealVectorToRealVectorEncoder.cs" />
     <Compile Include="SingleObjectiveTestFunctionSolution.cs" />
     <Compile Include="SingleObjectiveTestFunctionProblem.cs" />
Index: trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Interfaces/IRealVectorPSOEncoder.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Interfaces/IRealVectorPSOEncoder.cs	(revision 3682)
+++ trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Interfaces/IRealVectorPSOEncoder.cs	(revision 3682)
@@ -0,0 +1,12 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Optimization;
+using HeuristicLab.Core;
+
+namespace HeuristicLab.Problems.TestFunctions {
+  public interface IRealVectorPSOEncoder : IRealVectorEncoder {
+    IParameter OriginalRealVectorParameter { get; }
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs	(revision 3681)
+++ trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs	(revision 3682)
@@ -33,4 +33,5 @@
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 using HeuristicLab.PluginInfrastructure;
+using HeuristicLab.Operators;
 using HeuristicLab.Problems.TestFunctions.Analyzers;
 
@@ -353,4 +354,7 @@
         op.RealVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
       }
+      foreach (IRealVectorPSOEncoder op in Operators.OfType<IRealVectorPSOEncoder>()) {
+        ((ILookupParameter)op.OriginalRealVectorParameter).ActualName = SolutionCreator.RealVectorParameter.ActualName; 
+      }
     }
     #endregion
