Index: trunk/sources/HeuristicLab.Algorithms.SGA/3.3/SGA.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.SGA/3.3/SGA.cs	(revision 2975)
+++ trunk/sources/HeuristicLab.Algorithms.SGA/3.3/SGA.cs	(revision 2986)
@@ -21,4 +21,5 @@
 
 using System;
+using System.Collections.Generic;
 using System.Linq;
 using HeuristicLab.Core;
@@ -37,243 +38,270 @@
   [Item("SGA", "A standard genetic algorithm.")]
   [Creatable("Algorithms")]
+  [EmptyStorableClass]
   public sealed class SGA : EngineAlgorithm {
-    //#region Private Members
-    //// store operator references in order to be able to access them easily after deserialization
-    //[Storable]
-    //private PopulationCreator populationCreator;
-    //[Storable]
-    //private SGAOperator sgaOperator;
-    //#endregion
-
-    //#region Problem Properties
-    //public override Type ProblemType {
-    //  get { return typeof(ISingleObjectiveProblem); }
-    //}
-    //public new ISingleObjectiveProblem Problem {
-    //  get { return (ISingleObjectiveProblem)base.Problem; }
-    //  set { base.Problem = value; }
-    //}
-    //#endregion
-
-    //#region Parameter Properties
-    //private ValueParameter<IntData> SeedParameter {
-    //  get { return (ValueParameter<IntData>)Parameters["Seed"]; }
-    //}
-    //private ValueParameter<BoolData> SetSeedRandomlyParameter {
-    //  get { return (ValueParameter<BoolData>)Parameters["SetSeedRandomly"]; }
-    //}
-    //private ValueParameter<IntData> PopulationSizeParameter {
-    //  get { return (ValueParameter<IntData>)Parameters["PopulationSize"]; }
-    //}
-    //private ConstrainedValueParameter<ISelector> SelectorParameter {
-    //  get { return (ConstrainedValueParameter<ISelector>)Parameters["Selector"]; }
-    //}
-    //private ConstrainedValueParameter<ICrossover> CrossoverParameter {
-    //  get { return (ConstrainedValueParameter<ICrossover>)Parameters["Crossover"]; }
-    //}
-    //private ValueParameter<DoubleData> MutationProbabilityParameter {
-    //  get { return (ValueParameter<DoubleData>)Parameters["MutationProbability"]; }
-    //}
-    //private OptionalConstrainedValueParameter<IManipulator> MutatorParameter {
-    //  get { return (OptionalConstrainedValueParameter<IManipulator>)Parameters["Mutator"]; }
-    //}
-    //private ValueParameter<IntData> ElitesParameter {
-    //  get { return (ValueParameter<IntData>)Parameters["Elites"]; }
-    //}
-    //private ValueParameter<IntData> MaximumGenerationsParameter {
-    //  get { return (ValueParameter<IntData>)Parameters["MaximumGenerations"]; }
-    //}
-    //#endregion
-
-    //#region Properties
-    //public IntData Seed {
-    //  get { return SeedParameter.Value; }
-    //  set { SeedParameter.Value = value; }
-    //}
-    //public BoolData SetSeedRandomly {
-    //  get { return SetSeedRandomlyParameter.Value; }
-    //  set { SetSeedRandomlyParameter.Value = value; }
-    //}
-    //public IntData PopulationSize {
-    //  get { return PopulationSizeParameter.Value; }
-    //  set { PopulationSizeParameter.Value = value; }
-    //}
-    //public ISelector Selector {
-    //  get { return SelectorParameter.Value; }
-    //  set { SelectorParameter.Value = value; }
-    //}
-    //public ICrossover Crossover {
-    //  get { return CrossoverParameter.Value; }
-    //  set { CrossoverParameter.Value = value; }
-    //}
-    //public DoubleData MutationProbability {
-    //  get { return MutationProbabilityParameter.Value; }
-    //  set { MutationProbabilityParameter.Value = value; }
-    //}
-    //public IManipulator Mutator {
-    //  get { return MutatorParameter.Value; }
-    //  set { MutatorParameter.Value = value; }
-    //}
-    //public IntData Elites {
-    //  get { return ElitesParameter.Value; }
-    //  set { ElitesParameter.Value = value; }
-    //}
-    //public IntData MaximumGenerations {
-    //  get { return MaximumGenerationsParameter.Value; }
-    //  set { MaximumGenerationsParameter.Value = value; }
-    //}
-    //#endregion
-
-    //#region Persistence Properties
-    //[Storable]
-    //private object RestoreEvents {
-    //  get { return null; }
-    //  set { RegisterEvents(); }
-    //}
-    //#endregion
-
-    //public SGA()
-    //  : base() {
-    //  Parameters.Add(new ValueParameter<IntData>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntData(0)));
-    //  Parameters.Add(new ValueParameter<BoolData>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolData(true)));
-    //  Parameters.Add(new ValueParameter<IntData>("PopulationSize", "The size of the population of solutions.", new IntData(100)));
-    //  Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
-    //  Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
-    //  Parameters.Add(new ValueParameter<DoubleData>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new DoubleData(0.05)));
-    //  Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
-    //  Parameters.Add(new ValueParameter<IntData>("Elites", "The numer of elite solutions which are kept in each generation.", new IntData(1)));
-    //  Parameters.Add(new ValueParameter<IntData>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntData(1000)));
-
-    //  RandomCreator randomCreator = new RandomCreator();
-    //  populationCreator = new PopulationCreator();
-    //  sgaOperator = new SGAOperator();
-
-    //  randomCreator.RandomParameter.ActualName = "Random";
-    //  randomCreator.SeedParameter.ActualName = "Seed";
-    //  randomCreator.SeedParameter.Value = null;
-    //  randomCreator.SetSeedRandomlyParameter.ActualName = "SetSeedRandomly";
-    //  randomCreator.SetSeedRandomlyParameter.Value = null;
-    //  randomCreator.Successor = populationCreator;
-
-    //  populationCreator.PopulationSizeParameter.ActualName = "PopulationSize";
-    //  populationCreator.PopulationSizeParameter.Value = null;
-    //  populationCreator.Successor = sgaOperator;
-
-    //  sgaOperator.SelectorParameter.ActualName = "Selector";
-    //  sgaOperator.CrossoverParameter.ActualName = "Crossover";
-    //  sgaOperator.ElitesParameter.ActualName = "Elites";
-    //  sgaOperator.MaximumGenerationsParameter.ActualName = "MaximumGenerations";
-    //  sgaOperator.MutatorParameter.ActualName = "Mutator";
-    //  sgaOperator.MutationProbabilityParameter.ActualName = "MutationProbability";
-    //  sgaOperator.RandomParameter.ActualName = "Random";
-    //  sgaOperator.ResultsParameter.ActualName = "Results";
-
-    //  OperatorGraph.InitialOperator = randomCreator;
-
-    //  if (ApplicationManager.Manager != null) {
-    //    var selectors = ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name);
-    //    foreach (ISelector selector in selectors)
-    //      SelectorParameter.ValidValues.Add(selector);
-    //    ParameterizeSelectors();
-    //  }
-
-    //  RegisterEvents();
-    //}
-
-    //public override IDeepCloneable Clone(Cloner cloner) {
-    //  SGA clone = (SGA)base.Clone(cloner);
-    //  clone.populationCreator = (PopulationCreator)cloner.Clone(populationCreator);
-    //  clone.sgaOperator = (SGAOperator)cloner.Clone(sgaOperator);
-    //  clone.RegisterEvents();
-    //  return clone;
-    //}
-
-    //#region Events
-    //protected override void OnProblemChanged() {
-    //  if (Problem.SolutionCreator is IStochasticOperator) ((IStochasticOperator)Problem.SolutionCreator).RandomParameter.ActualName = "Random";
-    //  if (Problem.Evaluator is IStochasticOperator) ((IStochasticOperator)Problem.Evaluator).RandomParameter.ActualName = "Random";
-    //  foreach (IStochasticOperator op in Problem.Operators.OfType<IStochasticOperator>())
-    //    op.RandomParameter.ActualName = "Random";
-
-    //  populationCreator.SolutionCreatorParameter.Value = Problem.SolutionCreator;
-    //  populationCreator.EvaluatorParameter.Value = Problem.Evaluator;
-    //  sgaOperator.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
-    //  sgaOperator.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
-    //  sgaOperator.EvaluatorParameter.Value = Problem.Evaluator;
-
-    //  foreach (ISingleObjectiveSelector op in SelectorParameter.ValidValues.OfType<ISingleObjectiveSelector>()) {
-    //    op.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
-    //    op.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
-    //  }
-
-    //  ICrossover oldCrossover = CrossoverParameter.Value;
-    //  CrossoverParameter.ValidValues.Clear();
-    //  foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name))
-    //    CrossoverParameter.ValidValues.Add(crossover);
-    //  if (oldCrossover != null) {
-    //    CrossoverParameter.Value = CrossoverParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldCrossover.GetType());
-    //  }
-
-    //  IManipulator oldMutator = MutatorParameter.Value;
-    //  MutatorParameter.ValidValues.Clear();
-    //  foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name))
-    //    MutatorParameter.ValidValues.Add(mutator);
-    //  if (oldMutator != null) {
-    //    MutatorParameter.Value = MutatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMutator.GetType());
-    //  }
-
-    //  base.OnProblemChanged();
-    //}
-    //protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
-    //  if (Problem.SolutionCreator is IStochasticOperator) ((IStochasticOperator)Problem.SolutionCreator).RandomParameter.ActualName = "Random";
-    //  populationCreator.SolutionCreatorParameter.Value = Problem.SolutionCreator;
-    //  base.Problem_SolutionCreatorChanged(sender, e);
-    //}
-    //protected override void Problem_EvaluatorChanged(object sender, EventArgs e) {
-    //  if (Problem.Evaluator is IStochasticOperator) ((IStochasticOperator)Problem.Evaluator).RandomParameter.ActualName = "Random";
-
-    //  foreach (ISingleObjectiveSelector op in SelectorParameter.ValidValues.OfType<ISingleObjectiveSelector>()) {
-    //    op.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
-    //  }
-
-    //  populationCreator.EvaluatorParameter.Value = Problem.Evaluator;
-    //  sgaOperator.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
-    //  sgaOperator.EvaluatorParameter.Value = Problem.Evaluator;
-    //  base.Problem_EvaluatorChanged(sender, e);
-    //}
-    //private void ElitesParameter_ValueChanged(object sender, EventArgs e) {
-    //  foreach (ISelector selector in SelectorParameter.ValidValues)
-    //    selector.NumberOfSelectedSubScopesParameter.Value = new IntData(2 * (PopulationSizeParameter.Value.Value - ElitesParameter.Value.Value));
-    //}
-    //private void PopulationSizeParameter_ValueChanged(object sender, EventArgs e) {
-    //  foreach (ISelector selector in SelectorParameter.ValidValues)
-    //    selector.NumberOfSelectedSubScopesParameter.Value = new IntData(2 * (PopulationSizeParameter.Value.Value - ElitesParameter.Value.Value));
-    //}
-    //#endregion
-
-    //#region Helpers
-    //private void RegisterEvents() {
-    //  PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged);
-    //  ElitesParameter.ValueChanged += new EventHandler(ElitesParameter_ValueChanged);
-    //}
-    //private void ParameterizeSelectors() {
-    //  foreach (ISelector selector in SelectorParameter.ValidValues) {
-    //    selector.CopySelected = new BoolData(true);
-    //    selector.NumberOfSelectedSubScopesParameter.Value = new IntData(2 * (PopulationSizeParameter.Value.Value - ElitesParameter.Value.Value));
-    //    if (selector is IStochasticOperator) ((IStochasticOperator)selector).RandomParameter.ActualName = "Random";
-    //  }
-    //}
-    //private void ParameterizePopulationCreator() {
-    //  populationCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;
-    //  populationCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
-    //}
-    //private void ParameterizeSGAOperator() {
-    //  sgaOperator.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
-    //  sgaOperator.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
-    //  sgaOperator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
-    //}
-    //private void ParameterizeSolutionCreator() {
-    //}
-    //#endregion
+    #region Problem Properties
+    public override Type ProblemType {
+      get { return typeof(ISingleObjectiveProblem); }
+    }
+    public new ISingleObjectiveProblem Problem {
+      get { return (ISingleObjectiveProblem)base.Problem; }
+      set { base.Problem = value; }
+    }
+    #endregion
+
+    #region Parameter Properties
+    private ValueParameter<IntData> SeedParameter {
+      get { return (ValueParameter<IntData>)Parameters["Seed"]; }
+    }
+    private ValueParameter<BoolData> SetSeedRandomlyParameter {
+      get { return (ValueParameter<BoolData>)Parameters["SetSeedRandomly"]; }
+    }
+    private ValueParameter<IntData> PopulationSizeParameter {
+      get { return (ValueParameter<IntData>)Parameters["PopulationSize"]; }
+    }
+    private ConstrainedValueParameter<ISelector> SelectorParameter {
+      get { return (ConstrainedValueParameter<ISelector>)Parameters["Selector"]; }
+    }
+    private ConstrainedValueParameter<ICrossover> CrossoverParameter {
+      get { return (ConstrainedValueParameter<ICrossover>)Parameters["Crossover"]; }
+    }
+    private ValueParameter<DoubleData> MutationProbabilityParameter {
+      get { return (ValueParameter<DoubleData>)Parameters["MutationProbability"]; }
+    }
+    private OptionalConstrainedValueParameter<IManipulator> MutatorParameter {
+      get { return (OptionalConstrainedValueParameter<IManipulator>)Parameters["Mutator"]; }
+    }
+    private ValueParameter<IntData> ElitesParameter {
+      get { return (ValueParameter<IntData>)Parameters["Elites"]; }
+    }
+    private ValueParameter<IntData> MaximumGenerationsParameter {
+      get { return (ValueParameter<IntData>)Parameters["MaximumGenerations"]; }
+    }
+    #endregion
+
+    #region Properties
+    public IntData Seed {
+      get { return SeedParameter.Value; }
+      set { SeedParameter.Value = value; }
+    }
+    public BoolData SetSeedRandomly {
+      get { return SetSeedRandomlyParameter.Value; }
+      set { SetSeedRandomlyParameter.Value = value; }
+    }
+    public IntData PopulationSize {
+      get { return PopulationSizeParameter.Value; }
+      set { PopulationSizeParameter.Value = value; }
+    }
+    public ISelector Selector {
+      get { return SelectorParameter.Value; }
+      set { SelectorParameter.Value = value; }
+    }
+    public ICrossover Crossover {
+      get { return CrossoverParameter.Value; }
+      set { CrossoverParameter.Value = value; }
+    }
+    public DoubleData MutationProbability {
+      get { return MutationProbabilityParameter.Value; }
+      set { MutationProbabilityParameter.Value = value; }
+    }
+    public IManipulator Mutator {
+      get { return MutatorParameter.Value; }
+      set { MutatorParameter.Value = value; }
+    }
+    public IntData Elites {
+      get { return ElitesParameter.Value; }
+      set { ElitesParameter.Value = value; }
+    }
+    public IntData MaximumGenerations {
+      get { return MaximumGenerationsParameter.Value; }
+      set { MaximumGenerationsParameter.Value = value; }
+    }
+    private RandomCreator RandomCreator {
+      get { return (RandomCreator)OperatorGraph.InitialOperator; }
+    }
+    private PopulationCreator PopulationCreator {
+      get { return (PopulationCreator)RandomCreator.Successor; }
+    }
+    private SGAOperator SGAOperator {
+      get { return (SGAOperator)PopulationCreator.Successor; }
+    }
+    private List<ISelector> selectors;
+    private IEnumerable<ISelector> Selectors {
+      get { return selectors; }
+    }
+    #endregion
+
+    public SGA()
+      : base() {
+      Parameters.Add(new ValueParameter<IntData>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntData(0)));
+      Parameters.Add(new ValueParameter<BoolData>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolData(true)));
+      Parameters.Add(new ValueParameter<IntData>("PopulationSize", "The size of the population of solutions.", new IntData(100)));
+      Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
+      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
+      Parameters.Add(new ValueParameter<DoubleData>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new DoubleData(0.05)));
+      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
+      Parameters.Add(new ValueParameter<IntData>("Elites", "The numer of elite solutions which are kept in each generation.", new IntData(1)));
+      Parameters.Add(new ValueParameter<IntData>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntData(1000)));
+
+      RandomCreator randomCreator = new RandomCreator();
+      PopulationCreator populationCreator = new PopulationCreator();
+      SGAOperator sgaOperator = new SGAOperator();
+      OperatorGraph.InitialOperator = randomCreator;
+
+      randomCreator.RandomParameter.ActualName = "Random";
+      randomCreator.SeedParameter.ActualName = SeedParameter.Name;
+      randomCreator.SeedParameter.Value = null;
+      randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
+      randomCreator.SetSeedRandomlyParameter.Value = null;
+      randomCreator.Successor = populationCreator;
+
+      populationCreator.PopulationSizeParameter.ActualName = PopulationSizeParameter.Name;
+      populationCreator.Successor = sgaOperator;
+
+      sgaOperator.SelectorParameter.ActualName = SelectorParameter.Name;
+      sgaOperator.CrossoverParameter.ActualName = CrossoverParameter.Name;
+      sgaOperator.ElitesParameter.ActualName = ElitesParameter.Name;
+      sgaOperator.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name;
+      sgaOperator.MutatorParameter.ActualName = MutatorParameter.Name;
+      sgaOperator.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
+      sgaOperator.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
+      sgaOperator.ResultsParameter.ActualName = "Results";
+
+      Initialze();
+    }
+    [StorableConstructor]
+    private SGA(bool deserializing) : base() { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      SGA clone = (SGA)base.Clone(cloner);
+      clone.Initialze();
+      return clone;
+    }
+
+    #region Events
+    protected override void OnProblemChanged() {
+      ParameterizeStochasticOperator(Problem.SolutionCreator);
+      ParameterizeStochasticOperator(Problem.Evaluator);
+      foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
+      ParameterizePopulationCreator();
+      ParameterizeSGAOperator();
+      ParameterizeSelectors();
+      UpdateCrossovers();
+      UpdateMutators();
+      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
+      base.OnProblemChanged();
+    }
+    protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
+      ParameterizeStochasticOperator(Problem.SolutionCreator);
+      ParameterizePopulationCreator();
+      base.Problem_SolutionCreatorChanged(sender, e);
+    }
+    protected override void Problem_EvaluatorChanged(object sender, EventArgs e) {
+      ParameterizeStochasticOperator(Problem.Evaluator);
+      ParameterizePopulationCreator();
+      ParameterizeSGAOperator();
+      ParameterizeSelectors();
+      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
+      base.Problem_EvaluatorChanged(sender, e);
+    }
+    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
+      foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
+      UpdateCrossovers();
+      UpdateMutators();
+      base.Problem_OperatorsChanged(sender, e);
+    }
+    private void ElitesParameter_ValueChanged(object sender, EventArgs e) {
+      Elites.ValueChanged += new EventHandler(Elites_ValueChanged);
+      ParameterizeSelectors();
+    }
+    private void Elites_ValueChanged(object sender, EventArgs e) {
+      ParameterizeSelectors();
+    }
+    private void PopulationSizeParameter_ValueChanged(object sender, EventArgs e) {
+      PopulationSize.ValueChanged += new EventHandler(PopulationSize_ValueChanged);
+      ParameterizeSelectors();
+    }
+    private void PopulationSize_ValueChanged(object sender, EventArgs e) {
+      ParameterizeSelectors();
+    }
+    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
+      ParameterizeSGAOperator();
+      ParameterizeSelectors();
+    }
+    #endregion
+
+    #region Helpers
+    [StorableHook(HookType.AfterDeserialization)]
+    private void Initialze() {
+      InitializeSelectors();
+      UpdateSelectors();
+      PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged);
+      PopulationSize.ValueChanged += new EventHandler(PopulationSize_ValueChanged);
+      ElitesParameter.ValueChanged += new EventHandler(ElitesParameter_ValueChanged);
+      Elites.ValueChanged += new EventHandler(Elites_ValueChanged);
+      if (Problem != null)
+        Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
+    }
+
+    private void ParameterizePopulationCreator() {
+      PopulationCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
+      PopulationCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;
+    }
+    private void ParameterizeSGAOperator() {
+      SGAOperator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
+      SGAOperator.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
+      SGAOperator.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
+    }
+    private void ParameterizeStochasticOperator(IOperator op) {
+      if (op is IStochasticOperator)
+        ((IStochasticOperator)op).RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
+    }
+    private void InitializeSelectors() {
+      selectors = new List<ISelector>();
+      if (ApplicationManager.Manager != null) {
+        selectors.AddRange(ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name));
+        ParameterizeSelectors();
+      }
+    }
+    private void ParameterizeSelectors() {
+      foreach (ISelector selector in Selectors) {
+        selector.CopySelected = new BoolData(true);
+        selector.NumberOfSelectedSubScopesParameter.Value = new IntData(2 * (PopulationSizeParameter.Value.Value - ElitesParameter.Value.Value));
+        ParameterizeStochasticOperator(selector);
+      }
+      if (Problem != null) {
+        foreach (ISingleObjectiveSelector selector in Selectors.OfType<ISingleObjectiveSelector>()) {
+          selector.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
+          selector.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
+        }
+      }
+    }
+    private void UpdateSelectors() {
+      if (ApplicationManager.Manager != null) {
+        ISelector oldSelector = SelectorParameter.Value;
+        SelectorParameter.ValidValues.Clear();
+        foreach (ISelector selector in Selectors.OrderBy(x => x.Name))
+          SelectorParameter.ValidValues.Add(selector);
+        if (oldSelector != null)
+          SelectorParameter.Value = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldSelector.GetType());
+      }
+    }
+    private void UpdateCrossovers() {
+      ICrossover oldCrossover = CrossoverParameter.Value;
+      CrossoverParameter.ValidValues.Clear();
+      foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name))
+        CrossoverParameter.ValidValues.Add(crossover);
+      if (oldCrossover != null)
+        CrossoverParameter.Value = CrossoverParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldCrossover.GetType());
+    }
+    private void UpdateMutators() {
+      IManipulator oldMutator = MutatorParameter.Value;
+      MutatorParameter.ValidValues.Clear();
+      foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name))
+        MutatorParameter.ValidValues.Add(mutator);
+      if (oldMutator != null)
+        MutatorParameter.Value = MutatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMutator.GetType());
+    }
+    #endregion
   }
 }
