Index: branches/2825-NSGA3/HeuristicLab.Algorithms.NSGA3/3.3/NSGA3.cs
===================================================================
--- branches/2825-NSGA3/HeuristicLab.Algorithms.NSGA3/3.3/NSGA3.cs	(revision 17551)
+++ branches/2825-NSGA3/HeuristicLab.Algorithms.NSGA3/3.3/NSGA3.cs	(revision 17557)
@@ -1,67 +1,148 @@
 ﻿using System;
+using System.Linq;
 using System.Threading;
 using HEAL.Attic;
-using HeuristicLab.Common; // required for parameters collection
-using HeuristicLab.Core; // required for parameters collection
-using HeuristicLab.Data; // IntValue, ...
-using HeuristicLab.Encodings.BinaryVectorEncoding;
-using HeuristicLab.Optimization; // BasicAlgorithm
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.RealVectorEncoding;
+using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HeuristicLab.Problems.Binary;
-using HeuristicLab.Random; // MersenneTwister
 
 namespace HeuristicLab.Algorithms.NSGA3
 {
-    // each HL item needs to have a name and a description (BasicAlgorithm is an Item)
-    // The name and description of items is shown in the GUI
-    [Item(Name = "NSGA-III", Description = "An demo algorithm.")]
-
-    // If the algorithm should be shown in the "New..." dialog it must be creatable. Entries in the new dialog are grouped to categories and ordered by priorities
-    [Creatable(Category = CreatableAttribute.Categories.Algorithms, Priority = 999)]
-    [StorableType("689280F7-E371-44A2-98A5-FCEDF22CA343")] // for persistence (storing your algorithm to a files or transfer to HeuristicLab.Hive
+    /// <summary>
+    /// The Reference Point Based Non-dominated Sorting Genetic Algorithm III was introduced in Deb
+    /// et al. 2013. An Evolutionary Many-Objective Optimization Algorithm Using Reference Point
+    /// Based Non-dominated Sorting Approach. IEEE Transactions on Evolutionary Computation, 18(4),
+    /// pp. 577-601.
+    /// </summary>
+    [Item("NSGA-III", "The Reference Point Based Non-dominated Sorting Genetic Algorithm III was introduced in Deb et al. 2013. An Evolutionary Many-Objective Optimization Algorithm Using Reference Point Based Non-dominated Sorting Approach. IEEE Transactions on Evolutionary Computation, 18(4), pp. 577-601.")]
+    [Creatable(Category = CreatableAttribute.Categories.PopulationBasedAlgorithms, Priority = 136)]
+    [StorableType("30DF878D-D655-4E76-B3AD-2292C9DD6C5F")]
     public class NSGA3 : BasicAlgorithm
     {
-        // This algorithm only works for BinaryProblems.
-        // Overriding the ProblemType property has the effect that only BinaryProblems can be set as problem
-        // for the algorithm in the GUI
-        public override Type ProblemType { get { return typeof(BinaryProblem); } }
+        public override bool SupportsPause => false; // todo: make true
 
-        public new BinaryProblem Problem { get { return (BinaryProblem)base.Problem; } }
+        #region ProblemProperties
 
-        #region parameters
-
-        // If an algorithm has parameters then we usually also add properties to access these parameters.
-        // This is not strictly required but considered good shape.
-        private IFixedValueParameter<IntValue> MaxIterationsParameter
+        public override Type ProblemType
         {
-            get { return (IFixedValueParameter<IntValue>)Parameters["MaxIterations"]; }
+            get { return typeof(MultiObjectiveBasicProblem<RealVectorEncoding>); }
         }
 
-        public int MaxIterations
+        public new MultiObjectiveBasicProblem<RealVectorEncoding> Problem
         {
-            get { return MaxIterationsParameter.Value.Value; }
-            set { MaxIterationsParameter.Value.Value = value; }
+            get { return (MultiObjectiveBasicProblem<RealVectorEncoding>)base.Problem; }
+            set { base.Problem = value; }
         }
 
-        #endregion parameters
+        #endregion ProblemProperties
 
-        // createable items must have a default ctor
-        public NSGA3()
+        #region Storable fields
+
+        [Storable]
+        private IRandom random;
+
+        [Storable]
+        private Solution[] solutions;
+
+        #endregion Storable fields
+
+        #region ParameterAndResultsNames
+
+        // Parameter Names
+
+        private const string SeedName = "Seed";
+        private const string SetSeedRandomlyName = "SetSeedRandomly";
+        private const string PopulationSizeName = "PopulationSize";
+        private const string CrossoverProbabilityName = "CrossOverProbability";
+        private const string MutationProbabilityName = "MutationProbability";
+        private const string MaximumGenerationsName = "MaximumGenerations";
+        private const string DominateOnEqualQualitiesName = "DominateOnEqualQualities";
+
+        #endregion ParameterAndResultsNames
+
+        #region ParameterProperties
+
+        private IFixedValueParameter<IntValue> SeedParameter
         {
-            // algorithm parameters are shown in the GUI
-            Parameters.Add(new FixedValueParameter<IntValue>("MaxIterations", new IntValue(10000)));
+            get { return (IFixedValueParameter<IntValue>)Parameters[SeedName]; }
         }
 
-        // Persistence uses this ctor to improve deserialization efficiency.
-        // If we would use the default ctor instead this would completely initialize the object (e.g. creating parameters)
-        // even though the data is later overwritten by the stored data.
+        private IFixedValueParameter<BoolValue> SetSeedRandomlyParameter
+        {
+            get { return (IFixedValueParameter<BoolValue>)Parameters[SetSeedRandomlyName]; }
+        }
+
+        private IFixedValueParameter<IntValue> PopulationSizeParameter
+        {
+            get { return (IFixedValueParameter<IntValue>)Parameters[PopulationSizeName]; }
+        }
+
+        private IFixedValueParameter<PercentValue> CrossoverProbabilityParameter
+        {
+            get { return (IFixedValueParameter<PercentValue>)Parameters[CrossoverProbabilityName]; }
+        }
+
+        private IFixedValueParameter<PercentValue> MutationProbabilityParameter
+        {
+            get { return (IFixedValueParameter<PercentValue>)Parameters[MutationProbabilityName]; }
+        }
+
+        private IFixedValueParameter<IntValue> MaximumGenerationsParameter
+        {
+            get { return (IFixedValueParameter<IntValue>)Parameters[MaximumGenerationsName]; }
+        }
+
+        private IFixedValueParameter<BoolValue> DominateOnEqualQualitiesParameter
+        {
+            get { return (IFixedValueParameter<BoolValue>)Parameters[DominateOnEqualQualitiesName]; }
+        }
+
+        #endregion ParameterProperties
+
+        #region Properties
+
+        public IntValue Seed => SeedParameter.Value;
+
+        public BoolValue SetSeedRandomly => SetSeedRandomlyParameter.Value;
+
+        public IntValue PopulationSize => PopulationSizeParameter.Value;
+
+        public PercentValue CrossoverProbability => CrossoverProbabilityParameter.Value;
+
+        public PercentValue MutationProbability => MutationProbabilityParameter.Value;
+
+        public IntValue MaximumGenerations => MaximumGenerationsParameter.Value;
+
+        public BoolValue DominateOnEqualQualities => DominateOnEqualQualitiesParameter.Value;
+
+        #endregion Properties
+
+        public NSGA3() : base()
+        {
+            Parameters.Add(new FixedValueParameter<IntValue>(SeedName, "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
+            Parameters.Add(new FixedValueParameter<BoolValue>(SetSeedRandomlyName, "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
+            Parameters.Add(new FixedValueParameter<IntValue>(PopulationSizeName, "The size of the population of Individuals.", new IntValue(100)));
+            Parameters.Add(new FixedValueParameter<PercentValue>(CrossoverProbabilityName, "The probability that the crossover operator is applied on two parents.", new PercentValue(0.9)));
+            Parameters.Add(new FixedValueParameter<PercentValue>(MutationProbabilityName, "The probability that the mutation operator is applied on a Individual.", new PercentValue(0.05)));
+            Parameters.Add(new FixedValueParameter<IntValue>(MaximumGenerationsName, "The maximum number of generations which should be processed.", new IntValue(1000)));
+            Parameters.Add(new FixedValueParameter<BoolValue>(DominateOnEqualQualitiesName, "Flag which determines wether Individuals with equal quality values should be treated as dominated.", new BoolValue(false)));
+        }
+
+        // Persistence uses this ctor to improve deserialization efficiency. If we would use the
+        // default ctor instead this would completely initialize the object (e.g. creating
+        // parameters) even though the data is later overwritten by the stored data.
         [StorableConstructor]
         public NSGA3(StorableConstructorFlag _) : base(_) { }
 
-        // Each clonable item must have a cloning ctor (deep cloning, the cloner is used to handle cyclic object references)
+        // Each clonable item must have a cloning ctor (deep cloning, the cloner is used to handle
+        // cyclic object references). Don't forget to call the cloning ctor of the base class
         public NSGA3(NSGA3 original, Cloner cloner) : base(original, cloner)
         {
-            // Don't forget to call the cloning ctor of the base class
-            // This class does not have fields, therefore we don't need to actually clone anything
+            // todo: don't forget to clone storable fields
+            random = cloner.Clone(original.random);
+            solutions = original.solutions?.Select(cloner.Clone).ToArray();
         }
 
@@ -73,43 +154,5 @@
         protected override void Run(CancellationToken cancellationToken)
         {
-            int maxIters = MaxIterations;
-            var problem = Problem;
-            var rand = new MersenneTwister(1234);
-
-            var bestQuality = problem.Maximization ? double.MinValue : double.MaxValue;
-
-            var curItersItem = new IntValue();
-            var bestQualityItem = new DoubleValue(bestQuality);
-            var curItersResult = new Result("Iteration", curItersItem);
-            var bestQualityResult = new Result("Best quality", bestQualityItem);
-            Results.Add(curItersResult);
-            Results.Add(bestQualityResult);
-
-            for (int i = 0; i < maxIters; i++)
-            {
-                curItersItem.Value = i;
-
-                // -----------------------------
-                // IMPLEMENT YOUR ALGORITHM HERE
-                // -----------------------------
-
-                // this is an example for random search
-                // for a more elaborate algorithm check the source code of "HeuristicLab.Algorithms.ParameterlessPopulationPyramid"
-                var cand = new BinaryVector(problem.Length, rand);
-                var quality = problem.Evaluate(cand, rand); // calling Evaluate like this is not possible for all problems...
-                if (problem.Maximization) bestQuality = Math.Max(bestQuality, quality);
-                else bestQuality = Math.Min(quality, bestQuality);
-                bestQualityItem.Value = bestQuality;
-
-                // check the cancellation token to see if the used clicked "Stop"
-                if (cancellationToken.IsCancellationRequested) break;
-            }
-
-            Results.Add(new Result("Execution time", new TimeSpanValue(this.ExecutionTime)));
-        }
-
-        public override bool SupportsPause
-        {
-            get { return false; }
+            throw new NotImplementedException();
         }
     }
