Index: branches/ichiriac/HeuristicLab.Algorithms.DifferentialEvolution/DifferentialEvolution.cs
===================================================================
--- branches/ichiriac/HeuristicLab.Algorithms.DifferentialEvolution/DifferentialEvolution.cs	(revision 13710)
+++ branches/ichiriac/HeuristicLab.Algorithms.DifferentialEvolution/DifferentialEvolution.cs	(revision 13770)
@@ -19,5 +19,5 @@
     [StorableClass]
     [Creatable(CreatableAttribute.Categories.PopulationBasedAlgorithms, Priority = 400)]
-    public class DifferentialEvolution : BasicAlgorithm 
+    public class DifferentialEvolution : BasicAlgorithm
     {
         public Func<IEnumerable<double>, double> Evaluation;
@@ -200,5 +200,5 @@
             var ub = Problem.Bounds[0, 1];
             var range = ub - lb;
-
+            this.evals = 0;
             double[,] populationOld = new double[PopulationSizeParameter.Value.Value, Problem.ProblemSize.Value];
             double[,] mutationPopulation = new double[PopulationSizeParameter.Value.Value, Problem.ProblemSize.Value];
@@ -222,8 +222,9 @@
             int best_index = 0;
             double[] populationRow = new double[Problem.ProblemSize.Value];
-
+            double[] qualityPopulation = new double[PopulationSizeParameter.Value.Value];
             bestPopulation = getMatrixRow(populationOld, best_index);
             RealVector bestPopulationVector = new RealVector(bestPopulation);
             double bestPopulationValue = Obj(bestPopulationVector);
+            qualityPopulation[best_index] = bestPopulationValue;
             RealVector selectionVector;
             RealVector trialVector;
@@ -231,5 +232,5 @@
 
 
-            for (var i = 0; i < PopulationSizeParameter.Value.Value; i++)
+            for (var i = 1; i < PopulationSizeParameter.Value.Value; i++)
             {
                 populationRow = getMatrixRow(populationOld, i);
@@ -237,9 +238,10 @@
 
                 qtrial = Obj(trialVector);
+                qualityPopulation[i] = qtrial;
 
                 if (qtrial > bestPopulationValue)
                 {
                     bestPopulationVector = new RealVector(populationRow);
-                    bestPopulationValue = Obj(bestPopulationVector);
+                    bestPopulationValue = qtrial;
                     best_index = i;
                 }
@@ -250,6 +252,6 @@
             // Loop until iteration limit reached or canceled.
             // todo replace with a function
-            while (ResultsEvaluations < MaximumEvaluations 
-                && !cancellationToken.IsCancellationRequested 
+            while (ResultsIterations < MaximumEvaluations
+                && !cancellationToken.IsCancellationRequested
                 && bestPopulationValue > Problem.BestKnownQuality.Value + ValueToReachParameter.Value.Value)
             {
@@ -262,23 +264,23 @@
                     //assure the selected vectors r0, r1 and r2 are different
                     do
-                     {
-                         r0 = _random.Next(0, PopulationSizeParameter.Value.Value);
-                     } while (r0 == i);
-                     do
-                     {
-                         r1 = _random.Next(0, PopulationSizeParameter.Value.Value);
-                     } while (r1 == i || r1 == r0);
-                     do
-                     {
-                         r2 = _random.Next(0, PopulationSizeParameter.Value.Value);
-                     } while (r2 == i || r2 == r0 || r2 == r1);
+                    {
+                        r0 = _random.Next(0, PopulationSizeParameter.Value.Value);
+                    } while (r0 == i);
+                    do
+                    {
+                        r1 = _random.Next(0, PopulationSizeParameter.Value.Value);
+                    } while (r1 == i || r1 == r0);
+                    do
+                    {
+                        r2 = _random.Next(0, PopulationSizeParameter.Value.Value);
+                    } while (r2 == i || r2 == r0 || r2 == r1);
 
                     for (int j = 0; j < getMatrixRow(mutationPopulation, i).Length; j++)
                     {
-                        mutationPopulation[i,j] = populationOld[r0,j] +
-                            ScalingFactorParameter.Value.Value * (populationOld[r1,j] - populationOld[r2,j]);
+                        mutationPopulation[i, j] = populationOld[r0, j] +
+                            ScalingFactorParameter.Value.Value * (populationOld[r1, j] - populationOld[r2, j]);
                         //check the problem upper and lower bounds
-                        if (mutationPopulation[i,j] > ub) mutationPopulation[i,j] = ub;
-                        if (mutationPopulation[i,j] < lb) mutationPopulation[i,j] = lb;
+                        if (mutationPopulation[i, j] > ub) mutationPopulation[i, j] = ub;
+                        if (mutationPopulation[i, j] < lb) mutationPopulation[i, j] = lb;
                     }
                 }
@@ -292,9 +294,9 @@
                         if (_random.NextDouble() <= CrossoverProbabilityParameter.Value.Value || j == rnbr)
                         {
-                            trialPopulation[i,j] = mutationPopulation[i,j];
+                            trialPopulation[i, j] = mutationPopulation[i, j];
                         }
                         else
                         {
-                            trialPopulation[i,j] = populationOld[i,j];
+                            trialPopulation[i, j] = populationOld[i, j];
                         }
                     }
@@ -307,8 +309,8 @@
                     trialVector = new RealVector(getMatrixRow(trialPopulation, i));
 
-                    var selectionEval = Obj(selectionVector);
-                    var trailEval = Obj(trialVector);
-
-                    if (trailEval < selectionEval)
+                    var selectionEval = qualityPopulation[i];
+                    var trialEval = Obj(trialVector);
+
+                    if (trialEval < selectionEval)
                     {
                         for (int j = 0; j < getMatrixRow(populationOld, i).Length; j++)
@@ -316,4 +318,5 @@
                             populationOld[i, j] = trialPopulation[i, j];
                         }
+                        qualityPopulation[i] = trialEval;
                     }
                 }
@@ -323,5 +326,5 @@
                 {
                     selectionVector = new RealVector(getMatrixRow(populationOld, i));
-                    var quality = Obj(selectionVector);
+                    var quality = qualityPopulation[i];
                     if (quality < bestPopulationValue)
                     {
@@ -337,8 +340,8 @@
                 ResultsIterations = iterations;
                 ResultsBestSolution = bestPopulationVector;
-                ResultsBestQuality = bestPopulationValue; 
+                ResultsBestQuality = bestPopulationValue;
 
                 //update the results in view
-                if (iterations % 10 == 0 ) ResultsQualitiesBest.Values.Add(bestPopulationValue);
+                if (iterations % 10 == 0) ResultsQualitiesBest.Values.Add(bestPopulationValue);
                 if (bestPopulationValue < Problem.BestKnownQuality.Value + ValueToReachParameter.Value.Value)
                 {
@@ -347,5 +350,5 @@
             }
         }
-        
+
         //evaluate the vector
         public double Obj(RealVector x)
@@ -353,5 +356,5 @@
             evals = evals + 1;
             if (Problem.Maximization.Value)
-            return -Problem.Evaluator.Evaluate(x);
+                return -Problem.Evaluator.Evaluate(x);
 
             return Problem.Evaluator.Evaluate(x);
@@ -359,5 +362,5 @@
 
         // Get ith row from the matrix
-        public double[] getMatrixRow (double[,] Mat, int i)
+        public double[] getMatrixRow(double[,] Mat, int i)
         {
             double[] tmp = new double[Mat.GetUpperBound(1) + 1];
@@ -372,3 +375,2 @@
     }
 }
-
Index: branches/ichiriac/HeuristicLab.Algorithms.DifferentialEvolution/HeuristicLab.Algorithms.DifferentialEvolution.csproj
===================================================================
--- branches/ichiriac/HeuristicLab.Algorithms.DifferentialEvolution/HeuristicLab.Algorithms.DifferentialEvolution.csproj	(revision 13710)
+++ branches/ichiriac/HeuristicLab.Algorithms.DifferentialEvolution/HeuristicLab.Algorithms.DifferentialEvolution.csproj	(revision 13770)
@@ -22,4 +22,5 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@@ -95,6 +96,9 @@
   <ItemGroup>
     <Compile Include="DifferentialEvolution.cs" />
+    <Compile Include="DifferentialEvolutionReproduction.cs" />
+    <Compile Include="DifferentialEvolutionSelection.cs" />
     <Compile Include="Plugin.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Solution.cs" />
   </ItemGroup>
   <ItemGroup>
