Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Analyzers/ModelClustersFrequencyAnalyzer.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Analyzers/ModelClustersFrequencyAnalyzer.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Analyzers/ModelClustersFrequencyAnalyzer.cs	(revision 17134)
@@ -0,0 +1,168 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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 HEAL.Attic;
+using HeuristicLab.Algorithms.EvolvmentModelsOfModels;
+using HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
+  /// <summary>
+  /// Calculates the accumulated frequencies of variable-symbols over all trees in the population.
+  /// </summary>
+  [Item("Symbolic Data Analysis Model Clusters Frequency Analyzer", "Calculates the accumulated frequencies of Model Clusters over all trees in the population.")]
+  [StorableType("4755115D-1B73-4577-BA2A-A762AE4C3B2F")]
+  public sealed class ModelClustersFrequencyAnalyzer : SymbolicDataAnalysisAnalyzer {
+    private const string ModelClustersFrequencyParameterName = "ModelClustersFrequency";
+    private const string AggregateModelClustersParameterName = "AggregateModelClusters";
+
+    #region parameter properties
+    private const string MapParameterName = "Map";
+    public ILookupParameter<DataTable> ModelClustersFrequencyParameter {
+      get { return (ILookupParameter<DataTable>)Parameters[ModelClustersFrequencyParameterName]; }
+    }
+    public IValueLookupParameter<BoolValue> AggregateModelClustersParameter {
+      get { return (IValueLookupParameter<BoolValue>)Parameters[AggregateModelClustersParameterName]; }
+    }
+    public ILookupParameter<EMMMapBase<ISymbolicExpressionTree>> MapParameter {
+      get { return (ILookupParameter<EMMMapBase<ISymbolicExpressionTree>>)Parameters[MapParameterName]; }
+    }
+
+    #endregion
+    #region properties
+    public BoolValue AggregateModelClusters {
+      get { return AggregateModelClustersParameter.ActualValue; }
+      set { AggregateModelClustersParameter.Value = value; }
+    }
+    public DataTable ModelClustersFrequency {
+      get { return ModelClustersFrequencyParameter.ActualValue; }
+      set { ModelClustersFrequencyParameter.ActualValue = value; }
+    }
+    #endregion
+    [StorableConstructor]
+    private ModelClustersFrequencyAnalyzer(StorableConstructorFlag _) : base(_) { }
+    private ModelClustersFrequencyAnalyzer(ModelClustersFrequencyAnalyzer original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public ModelClustersFrequencyAnalyzer()
+      : base() {
+      Parameters.Add(new LookupParameter<DataTable>(ModelClustersFrequencyParameterName, "The relative Model Clusters reference frequencies aggregated over all trees in the population."));
+      Parameters.Add(new ValueLookupParameter<BoolValue>(AggregateModelClustersParameterName, "Switch that determines whether all references to factor Model Clusters should be aggregated regardless of the value. Turn off to analyze all factor variable references with different values separately.", new BoolValue(true)));
+      Parameters.Add(new LookupParameter<EMMMapBase<ISymbolicExpressionTree>>(MapParameterName));
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserialization() {
+      // BackwardsCompatibility3.3
+      #region Backwards compatible code, remove with 3.4
+      if (!Parameters.ContainsKey(AggregateModelClustersParameterName)) {
+        Parameters.Add(new ValueLookupParameter<BoolValue>(AggregateModelClustersParameterName, "Switch that determines whether all references to factor Model Clusters should be aggregated regardless of the value. Turn off to analyze all factor Model Clusters references with different values separately.", new BoolValue(true)));
+      }
+      #endregion
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ModelClustersFrequencyAnalyzer(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      ItemArray<ISymbolicExpressionTree> expressions = SymbolicExpressionTreeParameter.ActualValue;
+      ResultCollection results = ResultCollection;
+      DataTable datatable;
+      if (ModelClustersFrequencyParameter.ActualValue == null) {
+        datatable = new DataTable("ModelClusters frequencies", "Relative frequency of ModelClusters references aggregated over the whole population.");
+        datatable.VisualProperties.XAxisTitle = "Generation";
+        datatable.VisualProperties.YAxisTitle = "Relative ModelClusters Frequency";
+        ModelClustersFrequencyParameter.ActualValue = datatable;
+        results.Add(new Result("ModelClusters frequencies", "Relative frequency of ModelClusters references aggregated over the whole population.", datatable));
+      }
+
+      datatable = ModelClustersFrequencyParameter.ActualValue;
+      // all rows must have the same number of values so we can just take the first
+      int numberOfValues = datatable.Rows.Select(r => r.Values.Count).DefaultIfEmpty().First();
+
+      foreach (var pair in CalculateModelClustersFrequency(expressions, MapParameter.ActualValue)) {
+        if (!datatable.Rows.ContainsKey(pair.Key)) {
+          // initialize a new row for the variable and pad with zeros
+          DataRow row = new DataRow(pair.Key, "", Enumerable.Repeat(0.0, numberOfValues));
+          row.VisualProperties.StartIndexZero = true;
+          datatable.Rows.Add(row);
+        }
+        datatable.Rows[pair.Key].Values.Add(Math.Round(pair.Value, 3));
+      }
+
+      // add a zero for each data row that was not modified in the previous loop 
+      foreach (var row in datatable.Rows.Where(r => r.Values.Count != numberOfValues + 1))
+        row.Values.Add(0.0);
+
+      return base.Apply();
+    }
+
+    public static IEnumerable<KeyValuePair<string, double>> CalculateModelClustersFrequency(IEnumerable<ISymbolicExpressionTree> trees, EMMMapBase<ISymbolicExpressionTree> map) {
+      var modelClustersFrequency = trees
+          .SelectMany(t => GetModelClustersReferences(t, map))
+          .GroupBy(pair => pair.Key, pair => pair.Value)
+          .ToDictionary(g => g.Key, g => g.Sum());
+
+      double totalNumberOfSymbols = modelClustersFrequency.Values.Sum();
+
+      foreach (var pair in modelClustersFrequency.OrderBy(p => p.Key, new NaturalStringComparer()))
+        yield return new KeyValuePair<string, double>(pair.Key, pair.Value / totalNumberOfSymbols);
+    }
+
+    private static IEnumerable<KeyValuePair<string, double>> GetModelClustersReferences(ISymbolicExpressionTree tree, EMMMapBase<ISymbolicExpressionTree> map) {
+      Dictionary<string, double> references = new Dictionary<string, double>();
+      if (map is EMMIslandMap island) {
+        foreach (var treeNode in tree.IterateNodesPrefix().OfType<TreeModelTreeNode>()) {
+          string referenceId = "no";
+
+          referenceId = "Cluster " + island.ClusterNumber[treeNode.TreeNumber];
+          if (references.ContainsKey(referenceId)) {
+            int a = (int)references[referenceId];
+            a++;
+            references[referenceId] = a;
+          } else {
+            references[referenceId] = 1;
+          }
+        }
+      } else {
+        if (map is EMMSucsessMap sMap) {
+          for (int i = 0; i < map.ModelSet.Count; i++) {
+            string referenceId = "Tree Probability" + i;
+            references[referenceId] = sMap.SelfConfigurationMechanism.Probabilities[i];
+          }
+        } else {
+          string referenceId = "no";
+          references[referenceId] = 0;
+        }
+      }
+      return references;
+    }
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm.cs	(revision 17002)
+++ 	(revision )
@@ -1,263 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2019 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 HEAL.Attic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Problems.DataAnalysis.Symbolic;
-using HeuristicLab.Random;
-using HeuristicLab.Selection;
-using System.Collections.Generic;
-using System.Linq;
-using CancellationToken = System.Threading.CancellationToken;
-using Variable = HeuristicLab.Core.Variable;
-
-namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [Item("Evolvment Models Of Models Algorithm (EMM) ", "EMM implementation")]
-  [Creatable(CreatableAttribute.Categories.PopulationBasedAlgorithms, Priority = 125)]
-  [StorableType("AD23B21F-089A-4C6C-AD2E-1B01E7939CF5")]
-  public class EMMAlgorithm : EvolvmentModelsOfModelsAlgorithmBase {
-    public EMMAlgorithm() : base() { }
-    protected EMMAlgorithm(EMMAlgorithm original, Cloner cloner) : base(original, cloner) { }
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new EMMAlgorithm(this, cloner);
-    }
-
-    [StorableConstructor]
-    protected EMMAlgorithm(StorableConstructorFlag _) : base(_) { }
-
-    protected override void Run(CancellationToken cancellationToken) {
-      if (AlgorithmImplemetationType.Value == "Read") {
-        Map.MapRead(RandomParameter.Value, trees, "Map.txt");
-      } else {
-        Map.MapCreationPrepare(trees);
-        Map.CreateMap(RandomParameter.Value, ClusterNumbersParameter.Value.Value);
-        // Map.WriteMapToTxtFile(RandomParameter.Value); хайв этого не любит.. ворчит
-      }
-      ClusterNumbersShowParameter.Value.Value = Map.Map.Count;
-
-      if (AlgorithmImplemetationType.Value == "OnlyMap") {
-        globalScope = new Scope("Global Scope");
-        executionContext = new ExecutionContext(null, this, globalScope);
-      } else {
-        if (previousExecutionState != ExecutionState.Paused) {
-          InitializeAlgorithm(cancellationToken);
-        }
-        if (!globalScope.Variables.ContainsKey("TreeModelMap"))
-          globalScope.Variables.Add(new Variable("TreeModelMap", Map));
-        if (!globalScope.Variables.ContainsKey("Map"))
-          globalScope.Variables.Add(new Variable("Map", Map));
-        EMMAlgorithmRun(cancellationToken);
-      }
-    }
-    private void EMMAlgorithmRun(CancellationToken cancellationToken) {
-      var bestSelector = new BestSelector();
-      bestSelector.CopySelected = new BoolValue(false);
-      bestSelector.MaximizationParameter.ActualName = "Maximization";
-      bestSelector.NumberOfSelectedSubScopesParameter.ActualName = "Elites";
-      bestSelector.QualityParameter.ActualName = "Quality";
-
-      var maximumEvaluatedSolutions = MaximumEvaluatedSolutions.Value;
-      var crossover = Crossover;
-      var selector = Selector;
-      var crossoverProbability = CrossoverProbability.Value;
-      var mutator = Mutator;
-      var mutationProbability = MutationProbability.Value;
-      var evaluator = Problem.Evaluator;
-      var analyzer = Analyzer;
-      var rand = RandomParameter.Value;
-      var elites = Elites.Value;
-
-      // cancellation token for the inner operations which should not be immediately cancelled
-      var innerToken = new CancellationToken();
-
-      while (EvaluatedSolutions < maximumEvaluatedSolutions && !cancellationToken.IsCancellationRequested) {
-
-        var op4 = executionContext.CreateChildOperation(bestSelector, executionContext.Scope); // select elites
-        ExecuteOperation(executionContext, innerToken, op4);
-
-        var remaining = executionContext.Scope.SubScopes.Single(x => x.Name == "Remaining");
-        executionContext.Scope.SubScopes.AddRange(remaining.SubScopes);
-        var selected = executionContext.Scope.SubScopes.Single(x => x.Name == "Selected");
-        executionContext.Scope.SubScopes.AddRange(selected.SubScopes);
-        Population.Clear();
-        Population.AddRange(selected.SubScopes.Select(x => new EMMSolution(x)));
-        executionContext.Scope.SubScopes.Remove(remaining);
-        executionContext.Scope.SubScopes.Remove(selected);
-
-        var op = executionContext.CreateChildOperation(selector, executionContext.Scope);// select the rest of the Population
-        ExecuteOperation(executionContext, innerToken, op);
-
-        remaining = executionContext.Scope.SubScopes.Single(x => x.Name == "Remaining");
-        selected = executionContext.Scope.SubScopes.Single(x => x.Name == "Selected");
-
-        for (int i = 0; i < selector.NumberOfSelectedSubScopesParameter.Value.Value; i += 2) {
-          // crossover
-          IScope childScope = null;
-          if (rand.NextDouble() < crossoverProbability) {
-            childScope = new Scope($"{i}+{i + 1}") { Parent = executionContext.Scope };
-            childScope.SubScopes.Add(selected.SubScopes[i]);
-            childScope.SubScopes.Add(selected.SubScopes[i + 1]);
-            var op1 = executionContext.CreateChildOperation(crossover, childScope);
-            ExecuteOperation(executionContext, innerToken, op1);
-            childScope.SubScopes.Clear();
-          }
-
-          childScope = childScope ?? selected.SubScopes[i];
-          // mutation
-          if (rand.NextDouble() < mutationProbability) {
-            var op2 = executionContext.CreateChildOperation(mutator, childScope);
-            ExecuteOperation(executionContext, innerToken, op2);
-          }
-
-          // evaluation
-          if (childScope != null) {
-            var op3 = executionContext.CreateChildOperation(evaluator, childScope);
-            ExecuteOperation(executionContext, innerToken, op3);
-            //if (Problem.ProblemData is IRegressionProblemData problemData) {
-            //  SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(Problem.SymbolicExpressionTreeInterpreter, (ISymbolicExpressionTree)childScope.Variables["SymbolicExpressionTree"].Value, problemData, problemData.TestIndices, true, 100 /*max iterration*/, true);
-            //}
-            ++EvaluatedSolutions;
-            Population.Add(new EMMSolution(childScope));
-          } else {// no crossover or mutation were applied, a child was not produced, do nothing
-            Population.Add(new EMMSolution(selected.SubScopes[i]));
-          }
-          if (EvaluatedSolutions >= maximumEvaluatedSolutions) {
-            break;
-          }
-
-        }
-        if (Map is EMMSucsessMap) {
-          var population = new Dictionary<ISymbolicExpressionTree, double>();
-          foreach (var individ in Population) {
-            var tree = (ISymbolicExpressionTree)(((IScope)individ.Individual).Variables["SymbolicExpressionTree"].Value);
-            population.Add(tree, individ.Qualities.Value);
-          }
-          Map.MapUpDate(population);
-          population.Clear();
-        }
-        //List<object> A = new List<object>();
-        //A.Add(new Scope ());
-        //A.Add(new SymbolicExpressionTree());
-
-        globalScope.SubScopes.Replace(Population.Select(x => (IScope)x.Individual));
-        // run analyzer
-        var analyze = executionContext.CreateChildOperation(analyzer, globalScope);
-        ExecuteOperation(executionContext, innerToken, analyze);
-        Results.AddOrUpdateResult("Evaluated Solutions", new IntValue(EvaluatedSolutions));
-      }
-    }
-    protected void InitializeAlgorithm(CancellationToken cancellationToken) {
-      globalScope = new Scope("Global Scope");
-      executionContext = new ExecutionContext(null, this, globalScope);
-
-      // set the execution context for parameters to allow lookup
-      foreach (var parameter in Problem.Parameters.OfType<IValueParameter>()) {
-        globalScope.Variables.Add(new Variable(parameter.Name, parameter.Value));
-      }
-      globalScope.Variables.Add(new Variable("Results", Results)); // make results available as a parameter for analyzers etc.
-
-      var rand = RandomParameter.Value;
-      if (SetSeedRandomly) Seed = RandomSeedGenerator.GetSeed();
-      rand.Reset(Seed);
-
-      InitializePopulation(executionContext, cancellationToken, rand);
-      EvaluatedSolutions = PopulationSize.Value;
-
-      base.Initialize(cancellationToken);
-    }
-
-    private void InitializePopulation(ExecutionContext executionContext, CancellationToken cancellationToken, IRandom random) {
-      Population = new List<IEMMSolution>();
-      var evaluator = Problem.Evaluator;
-      var creator = Problem.SolutionCreator;
-      var parentScope = executionContext.Scope; //main scope for the next step work
-                                                // first, create all individuals
-      for (int i = 0; i < PopulationSize.Value; ++i) {
-        var childScope = new Scope(i.ToString()) { Parent = parentScope };
-        ExecuteOperation(executionContext, cancellationToken, executionContext.CreateChildOperation(creator, childScope));
-        var name = ((ISymbolicExpressionTreeCreator)creator).SymbolicExpressionTreeParameter.ActualName;
-        var tree = (ISymbolicExpressionTree)childScope.Variables[name].Value;
-        foreach (var node in tree.IterateNodesPostfix().OfType<TreeModelTreeNode>()) {
-          Map.NodeManipulationForInizializtion(random, node);
-        }
-        parentScope.SubScopes.Add(childScope);
-      }
-      // then, evaluate them and update qualities
-      for (int i = 0; i < PopulationSize.Value; ++i) {
-        var childScope = parentScope.SubScopes[i];
-        ExecuteOperation(executionContext, cancellationToken, executionContext.CreateChildOperation(evaluator, childScope));
-        Population.Add(new EMMSolution(childScope));  // Create solution and push individual inside. push solution to Population 
-      }
-    }
-
-    // next function was not tested in real work
-    private void LocalDecent(ISymbolicDataAnalysisSingleObjectiveProblem problem, CancellationToken cancellationToken, IScope childScope) {
-      int maxStepNumber = 100;
-      var name = ((ISymbolicExpressionTreeCreator)Problem.SolutionCreator).SymbolicExpressionTreeParameter.ActualName;
-      var tree = (ISymbolicExpressionTree)childScope.Variables[name].Value;
-      var oldTree = tree.Clone();
-      ExecuteOperation(executionContext, cancellationToken, executionContext.CreateChildOperation(problem.Evaluator, childScope));
-      var rand = RandomParameter.Value;
-      if (SetSeedRandomly) Seed = RandomSeedGenerator.GetSeed();
-      rand.Reset(Seed);
-      while (maxStepNumber > 0) {
-        maxStepNumber = TreeIterator(tree.Root, rand, cancellationToken, childScope, maxStepNumber);
-      }
-    }
-    int TreeIterator(ISymbolicExpressionTreeNode a, IRandom rand, CancellationToken cancellationToken, IScope childScope, int maxStepNumber) {
-      if (a is TreeModelTreeNode modelNode) {
-        ModelChange(modelNode, rand, cancellationToken, childScope);
-        maxStepNumber--;
-      }
-      if (a.Subtrees != null) {
-        for (int i = 0; i < (a.Subtrees.Count()); i++) {
-          TreeIterator(a.Subtrees.ToList()[i], rand, cancellationToken, childScope, maxStepNumber);
-        }
-      }
-      return maxStepNumber;
-    }
-    void ModelChange(TreeModelTreeNode tree, IRandom rand, CancellationToken cancellationToken, IScope childScope) {
-      int treeNumber = tree.TreeNumber;
-      var oldSubTree = (ISymbolicExpressionTree)tree.Tree.Clone();
-      double oldQuality = ((DoubleValue)childScope.Variables["Quality"].Value).Value;
-      int cluster;
-      if (Map is EMMIslandMap map)
-        cluster = map.ClusterNumber[treeNumber];
-      else cluster = treeNumber;
-      int newTreeNumber = rand.Next(Map.Map[cluster].Count);
-      tree.Tree = (ISymbolicExpressionTree)Map.ModelSet[newTreeNumber].Clone();
-      tree.Tree.Root.ShakeLocalParameters(rand, 1);
-      var evaluator = Problem.Evaluator;
-      ExecuteOperation(executionContext, cancellationToken, executionContext.CreateChildOperation(evaluator, childScope));
-      double currentQuality = ((DoubleValue)childScope.Variables["Quality"].Value).Value;
-      if (oldQuality > currentQuality) {
-        tree.Tree = (ISymbolicExpressionTree)oldSubTree.Clone();
-        ((DoubleValue)childScope.Variables["Quality"].Value).Value = oldQuality;
-      }
-    }
-  }
-
-
-}
-
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm/EMMAlgorithm.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm/EMMAlgorithm.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm/EMMAlgorithm.cs	(revision 17134)
@@ -0,0 +1,364 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Problems.DataAnalysis;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
+using HeuristicLab.Random;
+using HeuristicLab.Selection;
+using System.Collections.Generic;
+using System.Linq;
+using CancellationToken = System.Threading.CancellationToken;
+using Variable = HeuristicLab.Core.Variable;
+
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  [Item("Evolvement Models Of Models Algorithm (EMM) ", "EMM implementation")]
+  [Creatable(CreatableAttribute.Categories.PopulationBasedAlgorithms, Priority = 125)]
+  [StorableType("AD23B21F-089A-4C6C-AD2E-1B01E7939CF5")]
+  public class EMMAlgorithm : EvolvmentModelsOfModelsAlgorithmBase {
+    #region Constructors
+    public EMMAlgorithm() : base() { }
+    protected EMMAlgorithm(EMMAlgorithm original, Cloner cloner) : base(original, cloner) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EMMAlgorithm(this, cloner);
+    }
+
+    [StorableConstructor]
+    protected EMMAlgorithm(StorableConstructorFlag _) : base(_) { }
+    #endregion
+    #region Algorithm run
+    protected override void Run(CancellationToken cancellationToken) {
+
+      Map.DistanceParametr = DistanceType.Value;
+
+      if (AlgorithmImplemetationType.Value == "Read") {
+        Map.MapRead(trees);
+      } else {
+        Map.MapCreationPrepare(trees);
+        Map.CreateMap(RandomParameter.Value, Problem);
+      }
+      if (previousExecutionState != ExecutionState.Paused) {
+        InitializeAlgorithm(cancellationToken);
+      }
+      if (!globalScope.Variables.ContainsKey("TreeModelMap"))
+        globalScope.Variables.Add(new Variable("TreeModelMap", Map));
+      if (!globalScope.Variables.ContainsKey("Map"))
+        globalScope.Variables.Add(new Variable("Map", Map));
+      EMMAlgorithmRun(cancellationToken);
+    }
+    private void EMMAlgorithmRun(CancellationToken cancellationToken) {
+      var bestSelector = new BestSelector();
+      bestSelector.CopySelected = new BoolValue(false);
+      bestSelector.MaximizationParameter.ActualName = "Maximization";
+      bestSelector.NumberOfSelectedSubScopesParameter.ActualName = "Elites";
+      bestSelector.QualityParameter.ActualName = "Quality";
+
+      var maximumEvaluatedSolutions = MaximumEvaluatedSolutions.Value;
+      var crossover = Crossover;
+      var selector = Selector;
+      var crossoverProbability = CrossoverProbability.Value;
+      var mutator = Mutator;
+      var mutationProbability = MutationProbability.Value;
+      var evaluator = Problem.Evaluator;
+      var analyzer = Analyzer;
+      var rand = RandomParameter.Value;
+      var elites = Elites.Value;
+      var fmd = new InfixExpressionFormatter();
+      // cancellation token for the inner operations which should not be immediately canceled
+      var innerToken = new CancellationToken();
+      // for future
+      //var mutatorTypes = new SymbolicExpressionTreeManipulator[]
+      //{
+      //     new EMMMultyPointsMutator(),
+      //     new EMMMultyPointsMutatorNodeTypeSaving (),
+      //     new EMMMutators()
+      //};
+      //var tuu = MutatorParameter.ValidValues;
+      //var select = SelectorParameter.ValidValues;
+
+      while (EvaluatedSolutions < maximumEvaluatedSolutions && !cancellationToken.IsCancellationRequested) {
+
+        var op4 = executionContext.CreateChildOperation(bestSelector, executionContext.Scope); // select elites
+        ExecuteOperation(executionContext, innerToken, op4);
+
+        var remaining = executionContext.Scope.SubScopes.Single(x => x.Name == "Remaining");
+        executionContext.Scope.SubScopes.AddRange(remaining.SubScopes);
+        var selected = executionContext.Scope.SubScopes.Single(x => x.Name == "Selected");
+        executionContext.Scope.SubScopes.AddRange(selected.SubScopes);
+        Population.Clear();
+        Population.AddRange(selected.SubScopes.Select(x => new EMMSolution(x)));
+        executionContext.Scope.SubScopes.Remove(remaining);
+        executionContext.Scope.SubScopes.Remove(selected);
+
+        var op = executionContext.CreateChildOperation(selector, executionContext.Scope);// select the rest of the Population
+        ExecuteOperation(executionContext, innerToken, op);
+
+        remaining = executionContext.Scope.SubScopes.Single(x => x.Name == "Remaining");
+        selected = executionContext.Scope.SubScopes.Single(x => x.Name == "Selected");
+
+        for (int i = 0; i < selector.NumberOfSelectedSubScopesParameter.Value.Value; i += 2) {
+          IScope childScope = null;
+          // for future
+          //var obbbb = CrossoverParameter.ValidValues.ToList();
+          //int nn = 3;
+          //if (rand.NextDouble() < crossoverProbability) {
+          //  childScope = new Scope($"{i}+{i + 1}") { Parent = executionContext.Scope };
+          //  childScope.SubScopes.Add(selected.SubScopes[i]);
+          //  childScope.SubScopes.Add(selected.SubScopes[i + 1]);
+          //  var op1 = executionContext.CreateChildOperation(obbbb[nn], childScope);
+          //  ExecuteOperation(executionContext, innerToken, op1);
+          //  childScope.SubScopes.Clear();
+          //}
+
+          if (rand.NextDouble() < crossoverProbability) {
+            childScope = new Scope($"{i}+{i + 1}") { Parent = executionContext.Scope };
+            childScope.SubScopes.Add(selected.SubScopes[i]);
+            childScope.SubScopes.Add(selected.SubScopes[i + 1]);
+            var op1 = executionContext.CreateChildOperation(crossover, childScope);
+            ExecuteOperation(executionContext, innerToken, op1);
+            childScope.SubScopes.Clear();
+          }
+
+          childScope = childScope ?? selected.SubScopes[i];
+          // mutation
+          if (rand.NextDouble() < mutationProbability) {
+            var op2 = executionContext.CreateChildOperation(mutator, childScope);
+            ExecuteOperation(executionContext, innerToken, op2);
+          }
+
+          // evaluation
+          if (childScope != null) {
+            if (!childScope.Variables.ContainsKey("Quality"))
+              childScope.Variables.Add(new Variable("Quality"));
+            EvaluationComplex(executionContext, innerToken, childScope);
+          } else {// no crossover or mutation were applied, a child was not produced, do nothing
+            Population.Add(new EMMSolution(selected.SubScopes[i]));
+          }
+          if (EvaluatedSolutions >= maximumEvaluatedSolutions) {
+            break;
+          }
+        }
+
+        UpDateParameters();
+
+        globalScope.SubScopes.Replace(Population.Select(x => (IScope)x.Individual));
+        // run analyzer
+        var analyze = executionContext.CreateChildOperation(analyzer, globalScope);
+        ExecuteOperation(executionContext, innerToken, analyze);
+
+        Results.AddOrUpdateResult("Evaluated Solutions", new IntValue(EvaluatedSolutions));
+      }
+    }
+    protected virtual void UpDateParameters() {
+      if (Map is EMMSucsessMap) {
+        var population = new Dictionary<ISymbolicExpressionTree, double>();
+        foreach (var individ in Population) {
+          var tree = (ISymbolicExpressionTree)(((IScope)individ.Individual).Variables["SymbolicExpressionTree"].Value);
+          population.Add(tree, individ.Qualities.Value);
+        }
+        Map.MapUpDate(population);
+        population.Clear();
+      }
+    }
+    #endregion
+    #region Initialization
+    protected void InitializeAlgorithm(CancellationToken cancellationToken) {
+      globalScope = new Scope("Global Scope");
+      executionContext = new ExecutionContext(null, this, globalScope);
+
+      // set the execution context for parameters to allow lookup
+      foreach (var parameter in Problem.Parameters.OfType<IValueParameter>()) {
+        globalScope.Variables.Add(new Variable(parameter.Name, parameter.Value));
+      }
+      globalScope.Variables.Add(new Variable("Results", Results)); // make results available as a parameter for analyzers etc.
+
+      var rand = RandomParameter.Value;
+      if (SetSeedRandomly) Seed = RandomSeedGenerator.GetSeed();
+      rand.Reset(Seed);
+      EvaluatedSolutions = 0;
+      //  InitializeParametrs(); for future
+      InitializePopulation(executionContext, cancellationToken, rand);
+
+
+      base.Initialize(cancellationToken);
+    }
+    protected virtual void InitializeParametrs() { }
+
+    private void InitializePopulation(ExecutionContext executionContext, CancellationToken cancellationToken, IRandom random) {
+      Population = new List<IEMMSolution>();
+      var fmd = new InfixExpressionFormatter();
+      var evaluator = Problem.Evaluator;
+      var creator = Problem.SolutionCreator;
+      var parser = new InfixExpressionParser();
+
+      var parentScope = executionContext.Scope; //main scope for the next step work
+                                                // first, create all individuals
+      for (int i = 0; i < PopulationSize.Value; ++i) {
+        var childScope = new Scope(i.ToString()) { Parent = parentScope };
+        ExecuteOperation(executionContext, cancellationToken, executionContext.CreateChildOperation(creator, childScope));
+        var name = ((ISymbolicExpressionTreeCreator)creator).SymbolicExpressionTreeParameter.ActualName;
+        var tree = (ISymbolicExpressionTree)childScope.Variables[name].Value;
+
+        foreach (var node in tree.IterateNodesPostfix().OfType<TreeModelTreeNode>()) {
+          Map.NodeManipulationForInizializtion(random, node);
+        }
+        parentScope.SubScopes.Add(childScope);
+      }
+      // then, evaluate them and update qualities
+      for (int i = 0; i < PopulationSize.Value; ++i) {
+        var childScope = parentScope.SubScopes[i];
+        if (!childScope.Variables.ContainsKey("Quality"))
+          childScope.Variables.Add(new Variable("Quality", new DoubleValue(0)));
+        EvaluationComplex(executionContext, cancellationToken, childScope);
+      }
+    }
+    #endregion
+    #region Evaluators
+    private void EvaluationComplex(ExecutionContext executionContext, CancellationToken cancellationToken, IScope childScope) {
+      var evaluator = Problem.Evaluator;
+      if (evaluator is SymbolicRegressionConstantOptimizationEvaluator eval) {
+        var creator = Problem.SolutionCreator;
+        var name = ((ISymbolicExpressionTreeCreator)creator).SymbolicExpressionTreeParameter.ActualName;
+        var tree = (ISymbolicExpressionTree)childScope.Variables[name].Value;
+        var treeWithModelInside = ModelToTreePusher(tree);
+
+        //ExecuteOperation(executionContext, cancellationToken, executionContext.CreateChildOperation(evaluator, treeScope));
+        var pd = (IRegressionProblemData)Problem.ProblemData;
+        var estimationLimits = ((SymbolicRegressionSingleObjectiveProblem)Problem).EstimationLimits;
+        var interpreter = new SymbolicDataAnalysisExpressionTreeBatchInterpreter();
+        var quality = SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, treeWithModelInside, pd, pd.TrainingIndices, applyLinearScaling: true, maxIterations: 10, updateVariableWeights: true, lowerEstimationLimit: estimationLimits.Lower, upperEstimationLimit: estimationLimits.Upper, updateConstantsInTree: true);
+        childScope.Variables["Quality"].Value = new DoubleValue(quality);
+
+        int index = 0;
+        ConstuntValuesInTreeUpdate(tree, ConstantValuesFromTreeToListExtruction(treeWithModelInside), ref index);
+        childScope.Variables[name].Value = tree;
+        EvaluatedSolutions += 10;
+      } else {
+        var op3 = executionContext.CreateChildOperation(evaluator, childScope);
+        ExecuteOperation(executionContext, cancellationToken, op3);
+        EvaluatedSolutions += 1;
+      }
+      Population.Add(new EMMSolution(childScope));
+    }
+    private ISymbolicExpressionTree ModelToTreePusher(ISymbolicExpressionTree tree) {
+      //All model nodes in tree are exchange to trees that are stored in model nodes.
+      // After this function we have deal with usual tree
+      var clone = (ISymbolicExpressionTree)tree.Clone();
+      foreach (var node in clone.IterateNodesPostfix().OfType<TreeModelTreeNode>()) {
+        var newChild = node.Tree.Root.GetSubtree(0).GetSubtree(0);
+        Swap(node, newChild);
+      }
+      return clone;
+    }
+    protected static void Swap(ISymbolicExpressionTreeNode oldChild, ISymbolicExpressionTreeNode newChild) {
+      var parent = oldChild.Parent;
+      if (parent == null)
+        return;
+
+      var index = parent.IndexOfSubtree(oldChild);
+      parent.RemoveSubtree(index);
+      parent.InsertSubtree(index, newChild);
+    }
+    private List<double> ConstantValuesFromTreeToListExtruction(ISymbolicExpressionTree tree) {
+      //This function stored in a list all constants and coefficients from the tree
+      var constants = new List<double>();
+      foreach (var node in tree.IterateNodesPostfix()) {
+        if (node is ConstantTreeNode cNode) {
+          constants.Add(cNode.Value);
+        }
+        if (node is VariableTreeNode vNode) {
+          constants.Add(vNode.Weight);
+        }
+      }
+      return constants;
+    }
+    private void ConstuntValuesInTreeUpdate(ISymbolicExpressionTree tree, List<double> constants, ref int index) {
+      foreach (var node in tree.IterateNodesPostfix()) {
+        if (node is ConstantTreeNode cNode) {
+          cNode.Value = constants[index];
+          index++;
+        } else if (node is VariableTreeNode vNode) {
+          vNode.Weight = constants[index];
+          index++;
+        } else if (node is TreeModelTreeNode mNode) {
+          ConstuntValuesInTreeUpdate(mNode.Tree, constants, ref index);
+        }
+
+      }
+    }
+    #endregion
+    #region Local Search
+    // next function was not tested in real work
+    private void LocalDecent(ISymbolicDataAnalysisSingleObjectiveProblem problem, CancellationToken cancellationToken, IScope childScope) {
+      int maxStepNumber = 100;
+      var name = ((ISymbolicExpressionTreeCreator)Problem.SolutionCreator).SymbolicExpressionTreeParameter.ActualName;
+      var tree = (ISymbolicExpressionTree)childScope.Variables[name].Value;
+      var oldTree = tree.Clone();
+      ExecuteOperation(executionContext, cancellationToken, executionContext.CreateChildOperation(problem.Evaluator, childScope));
+      var rand = RandomParameter.Value;
+      if (SetSeedRandomly) Seed = RandomSeedGenerator.GetSeed();
+      rand.Reset(Seed);
+      while (maxStepNumber > 0) {
+        maxStepNumber = TreeIterator(tree.Root, rand, cancellationToken, childScope, maxStepNumber);
+      }
+    }
+    int TreeIterator(ISymbolicExpressionTreeNode a, IRandom rand, CancellationToken cancellationToken, IScope childScope, int maxStepNumber) {
+      if (a is TreeModelTreeNode modelNode) {
+        ModelChange(modelNode, rand, cancellationToken, childScope);
+        maxStepNumber--;
+      }
+      if (a.Subtrees != null) {
+        for (int i = 0; i < (a.Subtrees.Count()); i++) {
+          TreeIterator(a.Subtrees.ToList()[i], rand, cancellationToken, childScope, maxStepNumber);
+        }
+      }
+      return maxStepNumber;
+    }
+    void ModelChange(TreeModelTreeNode tree, IRandom rand, CancellationToken cancellationToken, IScope childScope) {
+      int treeNumber = tree.TreeNumber;
+      var oldSubTree = (ISymbolicExpressionTree)tree.Tree.Clone();
+      double oldQuality = ((DoubleValue)childScope.Variables["Quality"].Value).Value;
+      int cluster;
+      if (Map is EMMIslandMap map)
+        cluster = map.ClusterNumber[treeNumber];
+      else cluster = treeNumber;
+      int newTreeNumber = rand.Next(Map.Map[cluster].Count);
+      tree.Tree = (ISymbolicExpressionTree)Map.ModelSet[newTreeNumber].Clone();
+      tree.Tree.Root.ShakeLocalParameters(rand, 1);
+      var evaluator = Problem.Evaluator;
+      ExecuteOperation(executionContext, cancellationToken, executionContext.CreateChildOperation(evaluator, childScope));
+      double currentQuality = ((DoubleValue)childScope.Variables["Quality"].Value).Value;
+      if (oldQuality > currentQuality) {
+        tree.Tree = (ISymbolicExpressionTree)oldSubTree.Clone();
+        ((DoubleValue)childScope.Variables["Quality"].Value).Value = oldQuality;
+      }
+    }
+    #endregion
+  }
+
+
+}
+
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm/EMMBaseAlgorithm.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm/EMMBaseAlgorithm.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm/EMMBaseAlgorithm.cs	(revision 17134)
@@ -0,0 +1,468 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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 HEAL.Attic;
+using HeuristicLab.Algorithms.DataAnalysis;
+using HeuristicLab.Analysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.PluginInfrastructure;
+using HeuristicLab.Problems.DataAnalysis;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using HeuristicLab.Random;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using CancellationToken = System.Threading.CancellationToken;
+using ExecutionContext = HeuristicLab.Core.ExecutionContext;
+
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  [Item("EMMAlgorithmBase", "Base class for all EMM algorithm variants.")]
+  [StorableType("A56A396B-965A-4ADE-8A2B-AE3A45F9C239")]
+  public abstract class EvolvmentModelsOfModelsAlgorithmBase : FixedDataAnalysisAlgorithm<ISymbolicDataAnalysisSingleObjectiveProblem> {
+    #region data members
+    [Storable]
+    protected IList<IEMMSolution> Solutions;
+    [Storable]
+    protected List<IEMMSolution> Population;
+    [Storable]
+    protected int EvaluatedSolutions;
+    [Storable]
+    protected ExecutionContext executionContext;
+    [Storable]
+    protected IScope globalScope;
+    [Storable]
+    protected ExecutionState previousExecutionState;
+    [Storable]
+    protected IEnumerable<ISymbolicExpressionTree> trees;
+
+    [Storable]
+    protected ExecutionState currentExecutionState;
+    #endregion
+
+    #region parameters
+    private const string SeedParameterName = "Seed";
+    private const string SetSeedRandomlyParameterName = "SetSeedRandomly";
+    private const string PopulationSizeParameterName = "PopulationSize";
+    private const string SelectorParameterName = "Selector";
+    private const string GroupSizeParameterName = "GroupSize";
+    private const string CrossoverProbabilityParameterName = "CrossoverProbability";
+    private const string CrossoverParameterName = "Crossover";
+    private const string MutationProbabilityParameterName = "MutationProbability";
+    private const string MutatorParameterName = "Mutator";
+    private const string MaximumEvaluatedSolutionsParameterName = "MaximumEvaluatedSolutions";
+    private const string RandomParameterName = "Random";
+    private const string AnalyzerParameterName = "Analyzer";
+    private const string InputFileParameterName = "InputFile";
+    private const string AlgorithmImplementationTypeParameterName = "AlgorithmImplementationType";
+    private const string DistanceTypeParameterName = "DistanceType";
+    private const string MapParameterName = "Map";
+    public IValueParameter<MultiAnalyzer> AnalyzerParameter {
+      get { return (ValueParameter<MultiAnalyzer>)Parameters[AnalyzerParameterName]; }
+    }
+    public IFixedValueParameter<IntValue> SeedParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters[SeedParameterName]; }
+    }
+    public IConstrainedValueParameter<StringValue> AlgorithmImplementationTypeParameter {
+      get { return (IConstrainedValueParameter<StringValue>)Parameters[AlgorithmImplementationTypeParameterName]; }
+    }
+    public IConstrainedValueParameter<StringValue> DistanceTypeParameter {
+      get { return (IConstrainedValueParameter<StringValue>)Parameters[DistanceTypeParameterName]; }
+    }
+    public IConstrainedValueParameter<EMMMapBase<ISymbolicExpressionTree>> MapParameter {
+      get { return (IConstrainedValueParameter<EMMMapBase<ISymbolicExpressionTree>>)Parameters[MapParameterName]; }
+    }
+
+    public IFixedValueParameter<StringValue> InputFileParameter {
+      get { return (IFixedValueParameter<StringValue>)Parameters[InputFileParameterName]; }
+    }
+    public IFixedValueParameter<BoolValue> SetSeedRandomlyParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[SetSeedRandomlyParameterName]; }
+    }
+    private IValueParameter<IntValue> PopulationSizeParameter {
+      get { return (IValueParameter<IntValue>)Parameters[PopulationSizeParameterName]; }
+    }
+    public IValueParameter<PercentValue> CrossoverProbabilityParameter {
+      get { return (IValueParameter<PercentValue>)Parameters[CrossoverProbabilityParameterName]; }
+    }
+    public IValueParameter<IntValue> GroupSizeParameter {
+      get { return (IValueParameter<IntValue>)Parameters[GroupSizeParameterName]; }
+    }
+    public IConstrainedValueParameter<ICrossover> CrossoverParameter {
+      get { return (IConstrainedValueParameter<ICrossover>)Parameters[CrossoverParameterName]; }
+    }
+    public IConstrainedValueParameter<ISelector> SelectorParameter {
+      get { return (IConstrainedValueParameter<ISelector>)Parameters[SelectorParameterName]; }
+    }
+    public IValueParameter<PercentValue> MutationProbabilityParameter {
+      get { return (IValueParameter<PercentValue>)Parameters[MutationProbabilityParameterName]; }
+    }
+    public IConstrainedValueParameter<IManipulator> MutatorParameter {
+      get { return (IConstrainedValueParameter<IManipulator>)Parameters[MutatorParameterName]; }
+    }
+    public IValueParameter<IntValue> MaximumEvaluatedSolutionsParameter {
+      get { return (IValueParameter<IntValue>)Parameters[MaximumEvaluatedSolutionsParameterName]; }
+    }
+    public IValueParameter<IRandom> RandomParameter {
+      get { return (IValueParameter<IRandom>)Parameters[RandomParameterName]; }
+    }
+    #endregion
+
+    #region parameter properties
+    public ValueParameter<IntValue> ElitesParameter {
+      get { return (ValueParameter<IntValue>)Parameters["Elites"]; }
+    }
+    public int Seed {
+      get { return SeedParameter.Value.Value; }
+      set { SeedParameter.Value.Value = value; }
+    }
+    public StringValue AlgorithmImplemetationType {
+      get { return AlgorithmImplementationTypeParameter.Value; }
+      set { AlgorithmImplementationTypeParameter.Value.Value = value.Value; }
+    }
+    public StringValue DistanceType {
+      get { return DistanceTypeParameter.Value; }
+      set { DistanceTypeParameter.Value.Value = value.Value; }
+    }
+    public EMMMapBase<ISymbolicExpressionTree> Map {
+      get { return MapParameter.Value; }
+      set { MapParameter.Value = value; }
+    }
+    public StringValue InputFile {
+      get { return InputFileParameter.Value; }
+      set { InputFileParameter.Value.Value = value.Value; }
+    }
+    public bool SetSeedRandomly {
+      get { return SetSeedRandomlyParameter.Value.Value; }
+      set { SetSeedRandomlyParameter.Value.Value = value; }
+    }
+    public IntValue PopulationSize {
+      get { return PopulationSizeParameter.Value; }
+      set { PopulationSizeParameter.Value = value; }
+    }
+    public PercentValue CrossoverProbability {
+      get { return CrossoverProbabilityParameter.Value; }
+      set { CrossoverProbabilityParameter.Value = value; }
+    }
+    public IntValue GroupSize {
+      get { return GroupSizeParameter.Value; }
+      set { GroupSizeParameter.Value = value; }
+    }
+    public ICrossover Crossover {
+      get { return CrossoverParameter.Value; }
+      set { CrossoverParameter.Value = value; }
+    }
+    public ISelector Selector {
+      get { return SelectorParameter.Value; }
+      set { SelectorParameter.Value = value; }
+    }
+    public PercentValue MutationProbability {
+      get { return MutationProbabilityParameter.Value; }
+      set { MutationProbabilityParameter.Value = value; }
+    }
+    public IManipulator Mutator {
+      get { return MutatorParameter.Value; }
+      set { MutatorParameter.Value = value; }
+    }
+    public MultiAnalyzer Analyzer {
+      get { return AnalyzerParameter.Value; }
+      set { AnalyzerParameter.Value = value; }
+    }
+    public IntValue MaximumEvaluatedSolutions {
+      get { return MaximumEvaluatedSolutionsParameter.Value; }
+      set { MaximumEvaluatedSolutionsParameter.Value = value; }
+    }
+    public IntValue Elites {
+      get { return ElitesParameter.Value; }
+    }
+    #endregion
+
+    #region constructors
+    public EvolvmentModelsOfModelsAlgorithmBase() {
+
+      Parameters.Add(new FixedValueParameter<IntValue>(SeedParameterName, "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
+      Parameters.Add(new FixedValueParameter<StringValue>(InputFileParameterName, "The file with set of models that will be.", new StringValue("input.txt")));
+      Parameters.Add(new ConstrainedValueParameter<StringValue>(AlgorithmImplementationTypeParameterName, "The Type of possible algorithm, implementation, choose one: OnlyMap, Full, Read."));
+      Parameters.Add(new ConstrainedValueParameter<StringValue>(DistanceTypeParameterName, "The Type of possible distance calculator for case of only distance calculation."));
+      Parameters.Add(new ConstrainedValueParameter<EMMMapBase<ISymbolicExpressionTree>>(MapParameterName, "The type of map creation algorithm. Use one from: IslandMap, NetworkMap."));
+      Parameters.Add(new FixedValueParameter<BoolValue>(SetSeedRandomlyParameterName, "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
+      Parameters.Add(new ValueParameter<IntValue>(PopulationSizeParameterName, "The size of the population of Solutions.", new IntValue(100)));
+      Parameters.Add(new ConstrainedValueParameter<ISelector>(SelectorParameterName, "The operator used to select parents."));
+      Parameters.Add(new ValueParameter<PercentValue>(CrossoverProbabilityParameterName, "The probability that the crossover operator is applied.", new PercentValue(0.9)));
+      Parameters.Add(new ValueParameter<IntValue>(GroupSizeParameterName, "The GoupSize that the Selector operator is applied.", new IntValue(3)));
+      Parameters.Add(new ConstrainedValueParameter<ICrossover>(CrossoverParameterName, "The operator used to cross Solutions."));
+      Parameters.Add(new ValueParameter<PercentValue>(MutationProbabilityParameterName, "The probability that the mutation operator is applied on a solution.", new PercentValue(0.25)));
+      Parameters.Add(new ConstrainedValueParameter<IManipulator>(MutatorParameterName, "The operator used to mutate Solutions."));
+      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));
+      Parameters.Add(new ValueParameter<IntValue>(MaximumEvaluatedSolutionsParameterName, "The maximum number of evaluated Solutions (approximately).", new IntValue(100_000)));
+      Parameters.Add(new ValueParameter<IRandom>(RandomParameterName, new MersenneTwister()));
+      Parameters.Add(new ValueParameter<IntValue>("Elites", "The number of elite Solutions which are kept in each generation.", new IntValue(1)));
+      foreach (ISelector selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name))
+        SelectorParameter.ValidValues.Add(selector);
+      ISelector proportionalSelector = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType().Name.Equals("ProportionalSelector"));
+      if (proportionalSelector != null) SelectorParameter.Value = proportionalSelector;
+      ParameterizeSelectors();
+
+      //begin hack ...
+      InputFile.ValueChanged += InputFile_ValueChanged;
+      InfixExpressionParser parser = new InfixExpressionParser();
+      trees = File.ReadAllLines(InputFileParameter.Value.Value).Select(parser.Parse).ToArray();
+      // end hack
+
+      ProblemChanged += EvolvmentModelsOfModelsAlgorithmBase_ProblemChanged;
+      MapParameterUpdate();
+
+    }
+
+    // also hack vvvvvvvvv
+    private void InputFile_ValueChanged(object sender, EventArgs e) {
+      InfixExpressionParser parser = new InfixExpressionParser();
+      trees = File.ReadAllLines(InputFileParameter.Value.Value).Select(parser.Parse);
+    }
+    // remove again ^^^^^^^^^ 
+
+    private void EvolvmentModelsOfModelsAlgorithmBase_ProblemChanged(object sender, EventArgs e) {
+      if (Problem != null) {
+        Problem.SymbolicExpressionTreeInterpreter = new SymbolicDataAnalysisExpressionTreeBatchInterpreter();
+      }
+    }
+    protected void MapParameterUpdate() {
+      var mapTypes = new EMMMapBase<ISymbolicExpressionTree>[]
+      {
+        new EMMIslandMap(),
+        new EMMNetworkMap(),
+        new EMMDisatanceMap(),
+        new EMMRankMap(),
+        new EMMSucsessMap (),
+        new EMMZeroMap ()
+      };
+      foreach (var t in mapTypes) {
+        MapParameter.ValidValues.Add(t);
+      }
+      var algorithmType = new StringValue[]
+        {
+          new StringValue("Full"),
+          new StringValue("Read"),
+        };
+      foreach (var t in algorithmType) {
+        AlgorithmImplementationTypeParameter.ValidValues.Add(t);
+      }
+      var distanceType = new StringValue[]
+        {
+          new StringValue("MSE"),
+          new StringValue("PearsonsRSquared"),
+          new StringValue ("Covariance"),
+          new StringValue ("MaxAbsoluteError"),
+          new StringValue ("MeanAbsoluteError"),
+          new StringValue ("Symbolic")
+        };
+      foreach (var t in distanceType) {
+        DistanceTypeParameter.ValidValues.Add(t);
+      }
+    }
+
+    protected EvolvmentModelsOfModelsAlgorithmBase(EvolvmentModelsOfModelsAlgorithmBase original, Cloner cloner) : base(original, cloner) {
+      EvaluatedSolutions = original.EvaluatedSolutions;
+      previousExecutionState = original.previousExecutionState;
+
+      if (original.Solutions != null) {
+        Solutions = original.Solutions.Select(cloner.Clone).ToArray();
+      }
+
+      if (original.Population != null) {
+        Population = original.Population.Select(cloner.Clone).ToList();
+      }
+
+      if (original.executionContext != null) {
+        executionContext = cloner.Clone(original.executionContext);
+      }
+
+      if (original.globalScope != null) {
+        globalScope = cloner.Clone(original.globalScope);
+      }
+      // hack 
+      if (original.trees != null) {
+        trees = original.trees.Select(x => cloner.Clone(x)).ToArray();
+      }
+    }
+
+    [StorableConstructor]
+    protected EvolvmentModelsOfModelsAlgorithmBase(StorableConstructorFlag _) : base(_) { }
+    #endregion
+
+
+    public override void Prepare() {
+      base.Prepare();
+    }
+
+    protected override void Initialize(CancellationToken cancellationToken) {
+      base.Initialize(cancellationToken);
+    }
+
+    public override bool SupportsPause => true;
+
+    // implements random number generation from https://en.wikipedia.org/wiki/Dirichlet_distribution#Random_number_generation
+
+    public IList<IEMMSolution> GetResult(IRandom random) {
+      return Population;
+    }
+
+    #region operator wiring and events
+    private void ParameterizeStochasticOperator(IOperator op) {
+      IStochasticOperator stochasticOp = op as IStochasticOperator;
+      if (stochasticOp != null) {
+        stochasticOp.RandomParameter.ActualName = "Random";
+        stochasticOp.RandomParameter.Hidden = true;
+      }
+    }
+    private void ParameterizeSelectors() {
+      foreach (ISelector selector in SelectorParameter.ValidValues) {
+        selector.CopySelected = new BoolValue(true);
+        selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(2 * (PopulationSizeParameter.Value.Value - ElitesParameter.Value.Value));
+        selector.NumberOfSelectedSubScopesParameter.Hidden = true;
+        ParameterizeStochasticOperator(selector);
+      }
+      if (Problem != null) {
+        foreach (ISingleObjectiveSelector selector in SelectorParameter.ValidValues.OfType<ISingleObjectiveSelector>()) {
+          selector.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
+          selector.MaximizationParameter.Hidden = true;
+          selector.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
+          selector.QualityParameter.Hidden = true;
+        }
+      }
+    }
+    protected void ExecuteOperation(ExecutionContext executionContext, CancellationToken cancellationToken, IOperation operation) {
+      Stack<IOperation> executionStack = new Stack<IOperation>();
+      executionStack.Push(operation);
+      while (executionStack.Count > 0) {
+        cancellationToken.ThrowIfCancellationRequested();
+        IOperation next = executionStack.Pop();
+        if (next is OperationCollection) {
+          OperationCollection coll = (OperationCollection)next;
+          for (int i = coll.Count - 1; i >= 0; i--)
+            if (coll[i] != null) executionStack.Push(coll[i]);
+        } else if (next is IAtomicOperation) {
+          IAtomicOperation op = (IAtomicOperation)next;
+          next = op.Operator.Execute((IExecutionContext)op, cancellationToken);
+          if (next != null) executionStack.Push(next);
+        }
+      }
+    }
+
+    private void UpdateAnalyzers() {
+      Analyzer.Operators.Clear();
+      if (Problem != null) {
+        foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>()) {
+          foreach (IScopeTreeLookupParameter param in analyzer.Parameters.OfType<IScopeTreeLookupParameter>())
+            param.Depth = 1;
+          Analyzer.Operators.Add(analyzer, analyzer.EnabledByDefault);
+        }
+      }
+    }
+
+    private void UpdateCrossovers() {
+      ICrossover oldCrossover = CrossoverParameter.Value;
+      CrossoverParameter.ValidValues.Clear();
+      ICrossover defaultCrossover = Problem.Operators.OfType<ICrossover>().FirstOrDefault();
+
+      foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name))
+        CrossoverParameter.ValidValues.Add(crossover);
+
+      if (oldCrossover != null) {
+        ICrossover crossover = CrossoverParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldCrossover.GetType());
+        if (crossover != null) CrossoverParameter.Value = crossover;
+        else oldCrossover = null;
+      }
+      if (oldCrossover == null && defaultCrossover != null)
+        CrossoverParameter.Value = defaultCrossover;
+    }
+
+    private void UpdateMutators() {
+      IManipulator oldMutator = MutatorParameter.Value;
+      MutatorParameter.ValidValues.Clear();
+      IManipulator defaultMutator = Problem.Operators.OfType<IManipulator>().FirstOrDefault();
+
+      foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name))
+        MutatorParameter.ValidValues.Add(mutator);
+
+      if (oldMutator != null) {
+        IManipulator mutator = MutatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMutator.GetType());
+        if (mutator != null) MutatorParameter.Value = mutator;
+        else oldMutator = null;
+      }
+
+      if (oldMutator == null && defaultMutator != null)
+        MutatorParameter.Value = defaultMutator;
+    }
+    private void UpdateSelectors() {
+      ISelector oldSelector = SelectorParameter.Value;
+      SelectorParameter.ValidValues.Clear();
+      ISelector defaultSelector = Problem.Operators.OfType<ISelector>().FirstOrDefault();
+
+      foreach (ISelector selector in Problem.Operators.OfType<ISelector>().OrderBy(x => x.Name))
+        SelectorParameter.ValidValues.Add(selector);
+
+      if (oldSelector != null) {
+        ISelector selector = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldSelector.GetType());
+        if (selector != null) SelectorParameter.Value = selector;
+        else oldSelector = null;
+      }
+
+      if (oldSelector == null && defaultSelector != null)
+        SelectorParameter.Value = defaultSelector;
+    }
+    protected override void OnProblemChanged() {
+      UpdateCrossovers();
+      UpdateMutators();
+      UpdateAnalyzers();
+      base.OnProblemChanged();
+    }
+
+    protected override void OnExecutionStateChanged() {
+      previousExecutionState = currentExecutionState;
+      currentExecutionState = ExecutionState;
+      base.OnExecutionStateChanged();
+    }
+
+    protected override void OnStopped() {
+      if (Solutions != null) {
+        Solutions.Clear();
+      }
+      if (Population != null) {
+        Population.Clear();
+      }
+      //if (offspringPopulation != null) {
+      //  offspringPopulation.Clear();
+      //}
+      //if (jointPopulation != null) {
+      //  jointPopulation.Clear();
+      //}
+      executionContext.Scope.SubScopes.Clear();
+      base.OnStopped();
+    }
+    #endregion
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm/EMMSolution.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm/EMMSolution.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm/EMMSolution.cs	(revision 17134)
@@ -0,0 +1,93 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using DoubleValue = HeuristicLab.Data.DoubleValue;
+// Can be deleted potentially
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  [StorableType("AB38211D-5F52-4420-A606-1C3CB58BA27C")]
+  public interface IEMMSolution : IItem {
+    IItem Individual { get; set; }
+    DoubleValue Qualities { get; set; }
+  }
+  [Item("EMMSolution", "Represents a solution inside the EMM population")]
+  [StorableType("C0E63430-5000-4592-BBE4-2D3E0EE1AE3F")]
+  public class EMMSolution : Item, IEMMSolution {
+    [Storable]
+    public IItem Individual { get; set; }
+
+    [Storable]
+    public DoubleValue Qualities { get; set; }
+
+    public EMMSolution() { }
+
+    public EMMSolution(IItem individual) : this() {
+      Individual = individual;
+    }
+    public EMMSolution(IScope scope) {
+      Individual = scope;
+      Qualities = (DoubleValue)scope.Variables["Quality"].Value;
+    }
+    public EMMSolution(IItem individual, DoubleValue qualities) {
+      Individual = individual;
+      Qualities = qualities;
+    }
+
+    public EMMSolution(DoubleValue qualities) {
+      Qualities = qualities;
+    }
+
+    public int Dimensions = 1;
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EMMSolution(this, cloner);
+    }
+
+    protected EMMSolution(EMMSolution original, Cloner cloner) : base(original, cloner) {
+      Qualities = cloner.Clone(original.Qualities);
+      Individual = cloner.Clone(original.Individual);
+    }
+
+    [StorableConstructor]
+    protected EMMSolution(StorableConstructorFlag _) : base(_) { }
+  }
+  [Item("EMMSolution", "Represents a solution inside the EMM population")]
+  [StorableType("559EA31B-2263-4233-900C-EC62120EE580")]
+  public class EMMSolution<T> : EMMSolution where T : class, IItem {
+    public new T Individual {
+      get { return (T)base.Individual; }
+      set { base.Individual = value; }
+    }
+
+    public EMMSolution(T individual) : base(individual) { }
+
+    protected EMMSolution(EMMSolution<T> original, Cloner cloner) : base(original, cloner) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EMMSolution<T>(this, cloner);
+    }
+
+    [StorableConstructor]
+    protected EMMSolution(StorableConstructorFlag _) : base(_) { }
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMBaseAlgorithm.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMBaseAlgorithm.cs	(revision 17002)
+++ 	(revision )
@@ -1,498 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2019 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 HEAL.Attic;
-using HeuristicLab.Algorithms.DataAnalysis;
-using HeuristicLab.Analysis;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Optimization;
-using HeuristicLab.Parameters;
-using HeuristicLab.PluginInfrastructure;
-using HeuristicLab.Problems.DataAnalysis;
-using HeuristicLab.Problems.DataAnalysis.Symbolic;
-using HeuristicLab.Random;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using CancellationToken = System.Threading.CancellationToken;
-using ExecutionContext = HeuristicLab.Core.ExecutionContext;
-
-namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [Item("MOEADAlgorithmBase", "Base class for all MOEA/D algorithm variants.")]
-  [StorableType("A56A396B-965A-4ADE-8A2B-AE3A45F9C239")]
-  public abstract class EvolvmentModelsOfModelsAlgorithmBase : FixedDataAnalysisAlgorithm<ISymbolicDataAnalysisSingleObjectiveProblem> {
-    #region data members
-    [Storable]
-    protected IList<IEMMSolution> Solutions;
-    [Storable]
-    protected List<IEMMSolution> Population;
-    [Storable]
-    protected int EvaluatedSolutions;
-    [Storable]
-    protected ExecutionContext executionContext;
-    [Storable]
-    protected IScope globalScope;
-    [Storable]
-    protected ExecutionState previousExecutionState;
-    [Storable]
-    protected IEnumerable<ISymbolicExpressionTree> trees;
-
-    [Storable]
-    protected ExecutionState currentExecutionState;
-    #endregion
-
-    #region parameters
-    private const string SeedParameterName = "Seed";
-    private const string SetSeedRandomlyParameterName = "SetSeedRandomly";
-    private const string PopulationSizeParameterName = "PopulationSize";
-    private const string SelectorParameterName = "Selector";
-    private const string GroupSizeParameterName = "GroupSize";
-    private const string CrossoverProbabilityParameterName = "CrossoverProbability";
-    private const string CrossoverParameterName = "Crossover";
-    private const string MutationProbabilityParameterName = "MutationProbability";
-    private const string MutatorParameterName = "Mutator";
-    private const string MaximumEvaluatedSolutionsParameterName = "MaximumEvaluatedSolutions";
-    private const string RandomParameterName = "Random";
-    private const string AnalyzerParameterName = "Analyzer";
-    private const string InputFileParameterName = "InputFile";
-    private const string ClusterNumbersParameterName = "ClusterNumbers";
-    private const string ClusterNumbersShowParameterName = "ClusterNumbersShow";
-    private const string AlgorithmImplementationTypeParameterName = "AlgorithmImplementationType";
-    private const string MapParameterName = "Map";
-    private const string NegbourTypeParameterName = "NegbourType";
-    private const string NegbourNumberParameterName = "NegbourNumber";
-    public IValueParameter<MultiAnalyzer> AnalyzerParameter {
-      get { return (ValueParameter<MultiAnalyzer>)Parameters[AnalyzerParameterName]; }
-    }
-    public IFixedValueParameter<IntValue> SeedParameter {
-      get { return (IFixedValueParameter<IntValue>)Parameters[SeedParameterName]; }
-    }
-    public IValueParameter<IntValue> ClusterNumbersParameter {
-      get { return (IValueParameter<IntValue>)Parameters[ClusterNumbersParameterName]; }
-    }
-    public IValueParameter<IntValue> ClusterNumbersShowParameter {
-      get { return (IValueParameter<IntValue>)Parameters[ClusterNumbersShowParameterName]; }
-    }
-    public IConstrainedValueParameter<StringValue> AlgorithmImplementationTypeParameter {
-      get { return (IConstrainedValueParameter<StringValue>)Parameters[AlgorithmImplementationTypeParameterName]; }
-    }
-    public IConstrainedValueParameter<EMMMapBase<ISymbolicExpressionTree>> MapParameter {
-      get { return (IConstrainedValueParameter<EMMMapBase<ISymbolicExpressionTree>>)Parameters[MapParameterName]; }
-    }
-    public IFixedValueParameter<StringValue> NegbourTypeParameter {
-      get { return (IFixedValueParameter<StringValue>)Parameters[NegbourTypeParameterName]; }
-    }
-    public IFixedValueParameter<IntValue> NegbourNumberParameter {
-      get { return (IFixedValueParameter<IntValue>)Parameters[NegbourNumberParameterName]; }
-    }
-    public IFixedValueParameter<StringValue> InputFileParameter {
-      get { return (IFixedValueParameter<StringValue>)Parameters[InputFileParameterName]; }
-    }
-    public IFixedValueParameter<BoolValue> SetSeedRandomlyParameter {
-      get { return (IFixedValueParameter<BoolValue>)Parameters[SetSeedRandomlyParameterName]; }
-    }
-    private IValueParameter<IntValue> PopulationSizeParameter {
-      get { return (IValueParameter<IntValue>)Parameters[PopulationSizeParameterName]; }
-    }
-    public IValueParameter<PercentValue> CrossoverProbabilityParameter {
-      get { return (IValueParameter<PercentValue>)Parameters[CrossoverProbabilityParameterName]; }
-    }
-    public IValueParameter<IntValue> GroupSizeParameter {
-      get { return (IValueParameter<IntValue>)Parameters[GroupSizeParameterName]; }
-    }
-    public IConstrainedValueParameter<ICrossover> CrossoverParameter {
-      get { return (IConstrainedValueParameter<ICrossover>)Parameters[CrossoverParameterName]; }
-    }
-    public IConstrainedValueParameter<ISelector> SelectorParameter {
-      get { return (IConstrainedValueParameter<ISelector>)Parameters[SelectorParameterName]; }
-    }
-    public IValueParameter<PercentValue> MutationProbabilityParameter {
-      get { return (IValueParameter<PercentValue>)Parameters[MutationProbabilityParameterName]; }
-    }
-    public IConstrainedValueParameter<IManipulator> MutatorParameter {
-      get { return (IConstrainedValueParameter<IManipulator>)Parameters[MutatorParameterName]; }
-    }
-    public IValueParameter<IntValue> MaximumEvaluatedSolutionsParameter {
-      get { return (IValueParameter<IntValue>)Parameters[MaximumEvaluatedSolutionsParameterName]; }
-    }
-    public IValueParameter<IRandom> RandomParameter {
-      get { return (IValueParameter<IRandom>)Parameters[RandomParameterName]; }
-    }
-    #endregion
-
-    #region parameter properties
-    public ValueParameter<IntValue> ElitesParameter {
-      get { return (ValueParameter<IntValue>)Parameters["Elites"]; }
-    }
-    public int Seed {
-      get { return SeedParameter.Value.Value; }
-      set { SeedParameter.Value.Value = value; }
-    }
-    public IntValue ClusterNumbers {
-      get { return ClusterNumbersParameter.Value; }
-      set { ClusterNumbersParameter.Value = value; }
-    }
-    public IntValue ClusterNumbersShow {
-      get { return ClusterNumbersShowParameter.Value; }
-      set { ClusterNumbersShowParameter.Value = value; }
-    }
-    public StringValue AlgorithmImplemetationType {
-      get { return AlgorithmImplementationTypeParameter.Value; }
-      set { AlgorithmImplementationTypeParameter.Value.Value = value.Value; }
-    }
-    public EMMMapBase<ISymbolicExpressionTree> Map {
-      get { return MapParameter.Value; }
-      set { MapParameter.Value = value; }
-    }
-    public StringValue NegbourType {
-      get { return NegbourTypeParameter.Value; }
-      set { NegbourTypeParameter.Value.Value = value.Value; }
-    }
-    public IntValue NegbourNumber {
-      get { return NegbourNumberParameter.Value; }
-      set { NegbourNumberParameter.Value.Value = value.Value; }
-    }
-    public StringValue InputFile {
-      get { return InputFileParameter.Value; }
-      set { InputFileParameter.Value.Value = value.Value; }
-    }
-    public bool SetSeedRandomly {
-      get { return SetSeedRandomlyParameter.Value.Value; }
-      set { SetSeedRandomlyParameter.Value.Value = value; }
-    }
-    public IntValue PopulationSize {
-      get { return PopulationSizeParameter.Value; }
-      set { PopulationSizeParameter.Value = value; }
-    }
-    public PercentValue CrossoverProbability {
-      get { return CrossoverProbabilityParameter.Value; }
-      set { CrossoverProbabilityParameter.Value = value; }
-    }
-    public IntValue GroupSize {
-      get { return GroupSizeParameter.Value; }
-      set { GroupSizeParameter.Value = value; }
-    }
-    public ICrossover Crossover {
-      get { return CrossoverParameter.Value; }
-      set { CrossoverParameter.Value = value; }
-    }
-    public ISelector Selector {
-      get { return SelectorParameter.Value; }
-      set { SelectorParameter.Value = value; }
-    }
-    public PercentValue MutationProbability {
-      get { return MutationProbabilityParameter.Value; }
-      set { MutationProbabilityParameter.Value = value; }
-    }
-    public IManipulator Mutator {
-      get { return MutatorParameter.Value; }
-      set { MutatorParameter.Value = value; }
-    }
-    public MultiAnalyzer Analyzer {
-      get { return AnalyzerParameter.Value; }
-      set { AnalyzerParameter.Value = value; }
-    }
-    public IntValue MaximumEvaluatedSolutions {
-      get { return MaximumEvaluatedSolutionsParameter.Value; }
-      set { MaximumEvaluatedSolutionsParameter.Value = value; }
-    }
-    public IntValue Elites {
-      get { return ElitesParameter.Value; }
-    }
-    #endregion
-
-    #region constructors
-    public EvolvmentModelsOfModelsAlgorithmBase() {
-
-      Parameters.Add(new FixedValueParameter<IntValue>(SeedParameterName, "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
-      Parameters.Add(new FixedValueParameter<StringValue>(InputFileParameterName, "The file with set of models that will be.", new StringValue("input.txt")));
-      Parameters.Add(new ConstrainedValueParameter<StringValue>(AlgorithmImplementationTypeParameterName, "The Type of possible algorith, implemetation, choose one: OnlyMap, Full, Read."));
-      Parameters.Add(new ConstrainedValueParameter<EMMMapBase<ISymbolicExpressionTree>>(MapParameterName, "The type of map crearion algorithm. Use one from: IslandMap, NetworkMap."));
-      Parameters.Add(new FixedValueParameter<IntValue>(NegbourNumberParameterName, "The parametr for FullMap type of map crearion algorithm. Use one from: 10, 20.", new IntValue(10)));
-      Parameters.Add(new FixedValueParameter<StringValue>(NegbourTypeParameterName, "The parametr for FullMap type of map crearion algorithm. Use one from: Percent, Number.", new StringValue("Number")));
-      Parameters.Add(new FixedValueParameter<BoolValue>(SetSeedRandomlyParameterName, "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
-      Parameters.Add(new ValueParameter<IntValue>(PopulationSizeParameterName, "The size of the population of Solutions.", new IntValue(100)));
-      Parameters.Add(new ConstrainedValueParameter<ISelector>(SelectorParameterName, "The operator used to sellect parents."));
-      Parameters.Add(new ValueParameter<PercentValue>(CrossoverProbabilityParameterName, "The probability that the crossover operator is applied.", new PercentValue(0.9)));
-      Parameters.Add(new ValueParameter<IntValue>(GroupSizeParameterName, "The GoupSize that the Selector operator is applied.", new IntValue(3)));
-      Parameters.Add(new ConstrainedValueParameter<ICrossover>(CrossoverParameterName, "The operator used to cross Solutions."));
-      Parameters.Add(new ValueParameter<PercentValue>(MutationProbabilityParameterName, "The probability that the mutation operator is applied on a solution.", new PercentValue(0.25)));
-      Parameters.Add(new ConstrainedValueParameter<IManipulator>(MutatorParameterName, "The operator used to mutate Solutions."));
-      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));
-      Parameters.Add(new ValueParameter<IntValue>(MaximumEvaluatedSolutionsParameterName, "The maximum number of evaluated Solutions (approximately).", new IntValue(100_000)));
-      Parameters.Add(new ValueParameter<IRandom>(RandomParameterName, new MersenneTwister()));
-      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite Solutions which are kept in each generation.", new IntValue(1)));
-      Parameters.Add(new ValueParameter<IntValue>(ClusterNumbersParameterName, "The number of clusters for model Map.", new IntValue(10)));
-      Parameters.Add(new ValueParameter<IntValue>(ClusterNumbersShowParameterName, "The number of clusters for model Map.", new IntValue(10)));
-      foreach (ISelector selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name))
-        SelectorParameter.ValidValues.Add(selector);
-      ISelector proportionalSelector = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType().Name.Equals("ProportionalSelector"));
-      if (proportionalSelector != null) SelectorParameter.Value = proportionalSelector;
-      ParameterizeSelectors();
-
-      //begin hack ...
-      InputFile.ValueChanged += InputFile_ValueChanged;
-      InfixExpressionParser parser = new InfixExpressionParser();
-      trees = File.ReadAllLines(InputFileParameter.Value.Value).Select(parser.Parse).ToArray();
-      // end hack
-
-      ProblemChanged += EvolvmentModelsOfModelsAlgorithmBase_ProblemChanged;
-      MapParameterUpdate();
-
-    }
-
-    // also hack vvvvvvvvv
-    private void InputFile_ValueChanged(object sender, EventArgs e) {
-      InfixExpressionParser parser = new InfixExpressionParser();
-      trees = File.ReadAllLines(InputFileParameter.Value.Value).Select(parser.Parse);
-    }
-    // remove again ^^^^^^^^^ 
-
-    private void EvolvmentModelsOfModelsAlgorithmBase_ProblemChanged(object sender, EventArgs e) {
-      if (Problem != null) {
-        Problem.SymbolicExpressionTreeInterpreter = new SymbolicDataAnalysisExpressionTreeBatchInterpreter();
-        //Problem.SymbolicExpressionTreeGrammar = new EMMGrammar();
-      }
-    }
-    protected void MapParameterUpdate() {
-      int neghboorNumber = 10;
-
-      switch (NegbourType.Value) {
-        case "Percent": neghboorNumber = Convert.ToInt32((Convert.ToDouble(ClusterNumbersParameter.Value.Value)) * (Convert.ToDouble(NegbourNumber.Value)) / 100.0); break;
-        case "Number": neghboorNumber = NegbourNumber.Value; break;
-        default: neghboorNumber = NegbourNumber.Value; break;
-      }
-      var mapTypes = new EMMMapBase<ISymbolicExpressionTree>[]
-      {
-        new EMMIslandMap(),
-        new EMMNetworkMap(neghboorNumber),
-        new EMMDisatanceMap(),
-        new EMMRankMap(),
-        new EMMSucsessMap (),
-        new EMMZeroMap ()
-      };
-      foreach (var t in mapTypes) {
-        MapParameter.ValidValues.Add(t);
-      }
-      var algorithmType = new StringValue[]
-        {
-          new StringValue("Full"),
-          new StringValue("Read"),
-          new StringValue ("OnlyMap")
-        };
-      foreach (var t in algorithmType) {
-        AlgorithmImplementationTypeParameter.ValidValues.Add(t);
-      }
-    }
-
-    protected EvolvmentModelsOfModelsAlgorithmBase(EvolvmentModelsOfModelsAlgorithmBase original, Cloner cloner) : base(original, cloner) {
-      EvaluatedSolutions = original.EvaluatedSolutions;
-      previousExecutionState = original.previousExecutionState;
-
-      if (original.Solutions != null) {
-        Solutions = original.Solutions.Select(cloner.Clone).ToArray();
-      }
-
-      if (original.Population != null) {
-        Population = original.Population.Select(cloner.Clone).ToList();
-      }
-
-      //if (original.offspringPopulation != null) {
-      //  offspringPopulation = original.offspringPopulation.Select(cloner.Clone).ToList();
-      //}
-
-      //if (original.jointPopulation != null) {
-      //  jointPopulation = original.jointPopulation.Select(x => cloner.Clone(x)).ToList();
-      //}
-
-      if (original.executionContext != null) {
-        executionContext = cloner.Clone(original.executionContext);
-      }
-
-      if (original.globalScope != null) {
-        globalScope = cloner.Clone(original.globalScope);
-      }
-
-      // hack
-      trees = original.trees.Select(x => cloner.Clone(x)).ToArray();
-    }
-
-    [StorableConstructor]
-    protected EvolvmentModelsOfModelsAlgorithmBase(StorableConstructorFlag _) : base(_) { }
-    #endregion
-
-
-    public override void Prepare() {
-      base.Prepare();
-    }
-
-    protected override void Initialize(CancellationToken cancellationToken) {
-      base.Initialize(cancellationToken);
-    }
-
-    public override bool SupportsPause => true;
-
-    // implements random number generation from https://en.wikipedia.org/wiki/Dirichlet_distribution#Random_number_generation
-
-    public IList<IEMMSolution> GetResult(IRandom random) {
-      return Population;
-    }
-
-    #region operator wiring and events
-    private void ParameterizeStochasticOperator(IOperator op) {
-      IStochasticOperator stochasticOp = op as IStochasticOperator;
-      if (stochasticOp != null) {
-        stochasticOp.RandomParameter.ActualName = "Random";
-        stochasticOp.RandomParameter.Hidden = true;
-      }
-    }
-    private void ParameterizeSelectors() {
-      foreach (ISelector selector in SelectorParameter.ValidValues) {
-        selector.CopySelected = new BoolValue(true);
-        selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(2 * (PopulationSizeParameter.Value.Value - ElitesParameter.Value.Value));
-        selector.NumberOfSelectedSubScopesParameter.Hidden = true;
-        ParameterizeStochasticOperator(selector);
-      }
-      if (Problem != null) {
-        foreach (ISingleObjectiveSelector selector in SelectorParameter.ValidValues.OfType<ISingleObjectiveSelector>()) {
-          selector.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
-          selector.MaximizationParameter.Hidden = true;
-          selector.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
-          selector.QualityParameter.Hidden = true;
-        }
-      }
-    }
-    protected void ExecuteOperation(ExecutionContext executionContext, CancellationToken cancellationToken, IOperation operation) {
-      Stack<IOperation> executionStack = new Stack<IOperation>();
-      executionStack.Push(operation);
-      while (executionStack.Count > 0) {
-        cancellationToken.ThrowIfCancellationRequested();
-        IOperation next = executionStack.Pop();
-        if (next is OperationCollection) {
-          OperationCollection coll = (OperationCollection)next;
-          for (int i = coll.Count - 1; i >= 0; i--)
-            if (coll[i] != null) executionStack.Push(coll[i]);
-        } else if (next is IAtomicOperation) {
-          IAtomicOperation op = (IAtomicOperation)next;
-          next = op.Operator.Execute((IExecutionContext)op, cancellationToken);
-          if (next != null) executionStack.Push(next);
-        }
-      }
-    }
-
-    private void UpdateAnalyzers() {
-      Analyzer.Operators.Clear();
-      if (Problem != null) {
-        foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>()) {
-          foreach (IScopeTreeLookupParameter param in analyzer.Parameters.OfType<IScopeTreeLookupParameter>())
-            param.Depth = 1;
-          Analyzer.Operators.Add(analyzer, analyzer.EnabledByDefault);
-        }
-      }
-    }
-
-    private void UpdateCrossovers() {
-      ICrossover oldCrossover = CrossoverParameter.Value;
-      CrossoverParameter.ValidValues.Clear();
-      ICrossover defaultCrossover = Problem.Operators.OfType<ICrossover>().FirstOrDefault();
-
-      foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name))
-        CrossoverParameter.ValidValues.Add(crossover);
-
-      if (oldCrossover != null) {
-        ICrossover crossover = CrossoverParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldCrossover.GetType());
-        if (crossover != null) CrossoverParameter.Value = crossover;
-        else oldCrossover = null;
-      }
-      if (oldCrossover == null && defaultCrossover != null)
-        CrossoverParameter.Value = defaultCrossover;
-    }
-
-    private void UpdateMutators() {
-      IManipulator oldMutator = MutatorParameter.Value;
-      MutatorParameter.ValidValues.Clear();
-      IManipulator defaultMutator = Problem.Operators.OfType<IManipulator>().FirstOrDefault();
-
-      foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name))
-        MutatorParameter.ValidValues.Add(mutator);
-
-      if (oldMutator != null) {
-        IManipulator mutator = MutatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMutator.GetType());
-        if (mutator != null) MutatorParameter.Value = mutator;
-        else oldMutator = null;
-      }
-
-      if (oldMutator == null && defaultMutator != null)
-        MutatorParameter.Value = defaultMutator;
-    }
-    private void UpdateSelectors() {
-      ISelector oldSelector = SelectorParameter.Value;
-      SelectorParameter.ValidValues.Clear();
-      ISelector defaultSelector = Problem.Operators.OfType<ISelector>().FirstOrDefault();
-
-      foreach (ISelector selector in Problem.Operators.OfType<ISelector>().OrderBy(x => x.Name))
-        SelectorParameter.ValidValues.Add(selector);
-
-      if (oldSelector != null) {
-        ISelector selector = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldSelector.GetType());
-        if (selector != null) SelectorParameter.Value = selector;
-        else oldSelector = null;
-      }
-
-      if (oldSelector == null && defaultSelector != null)
-        SelectorParameter.Value = defaultSelector;
-    }
-    protected override void OnProblemChanged() {
-      UpdateCrossovers();
-      UpdateMutators();
-      UpdateAnalyzers();
-      base.OnProblemChanged();
-    }
-
-    protected override void OnExecutionStateChanged() {
-      previousExecutionState = currentExecutionState;
-      currentExecutionState = ExecutionState;
-      base.OnExecutionStateChanged();
-    }
-
-    protected override void OnStopped() {
-      if (Solutions != null) {
-        Solutions.Clear();
-      }
-      if (Population != null) {
-        Population.Clear();
-      }
-      //if (offspringPopulation != null) {
-      //  offspringPopulation.Clear();
-      //}
-      //if (jointPopulation != null) {
-      //  jointPopulation.Clear();
-      //}
-      executionContext.Scope.SubScopes.Clear();
-      base.OnStopped();
-    }
-    #endregion
-  }
-}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMBaseMap.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMBaseMap.cs	(revision 17002)
+++ 	(revision )
@@ -1,190 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2019 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 HEAL.Attic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Problems.DataAnalysis.Symbolic;
-using HeuristicLab.Random;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-
-namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [StorableType("83CF9650-98FF-454B-9072-82EA4D39C752")]
-  public abstract class EMMMapBase<T> : Item where T : class {
-    #region data members
-    [Storable]
-    public List<T> ModelSet { get; set; }
-    [Storable]
-    public List<List<int>> Map { get; set; }
-    #endregion
-    #region constructors
-    [StorableConstructor]
-    protected EMMMapBase(StorableConstructorFlag _) : base(_) { }
-    public EMMMapBase() {
-      Map = new List<List<int>>();
-    }
-    public EMMMapBase(EMMMapBase<T> original, Cloner cloner) {
-      if (original.ModelSet != null) {
-        if (original.ModelSet is List<ISymbolicExpressionTree> originalSet && ModelSet is List<ISymbolicExpressionTree> set)
-          set = originalSet.Select(cloner.Clone).ToList();
-        else ModelSet = original.ModelSet.ToList(); /// check this if you want to use it
-      }
-      if (original.Map != null) {
-        Map = original.Map.Select(x => x.ToList()).ToList();
-      }
-    }
-    #endregion
-    #region map creation functions
-    protected double[,] CalculateDistances() {
-      double[,] distances;
-      if (ModelSet is List<ISymbolicExpressionTree> set) {
-        distances = SymbolicExpressionTreeHash.ComputeSimilarityMatrix(set, simplify: false, strict: true);
-      } else { /// for future work
-        distances = new double[ModelSet.Count, ModelSet.Count];
-        for (int i = 0; i < ModelSet.Count - 1; i++) {
-          for (int j = 0; j <= i; j++) {
-            distances[i, j] = 0;
-          }
-        }
-      }
-      for (int i = 0; i < ModelSet.Count - 1; i++) {
-        for (int j = i + 1; j < ModelSet.Count; j++) {
-          distances[j, i] = distances[i, j] = 1 - distances[i, j];
-        }
-      }
-      return distances;
-    }
-    public abstract void CreateMap(IRandom random, int k);
-    public void MapCreationPrepare(IEnumerable<T> trees) {
-      ModelSet = trees.ToList();
-    }
-
-    protected void MapSizeCheck(int k) {
-      if (Map != null) Map.Clear();
-      else Map = new List<List<int>>();
-      if (Map.Count != k) {
-        if (Map.Count != 0) {
-          Map.Clear();
-        }
-        for (int i = 0; i < k; i++) {
-          Map.Add(new List<int>());
-        }
-      }
-    }
-    #endregion
-    #region map and files
-    public void MapRead(IRandom random, IEnumerable<T> trees, string fileName = "Map.txt") {
-      ModelSet = trees.ToList();
-      MapFromFileRead(fileName);
-      if (this is EMMIslandMap island) { island.ClusterNumbersCalculate(); }
-      if (this is EMMNetworkMap one) { one.NeghboorNumber = Map[0].Count; }
-    }
-    public void WriteMapToTxtFile(IRandom random) {
-      string s = random.ToString();
-      string fileName = "Map";
-      fileName += s;
-      fileName += ".txt";
-      File.WriteAllLines(fileName, MapToString());
-      string fileName2 = "MapToSee";
-      fileName2 += s;
-      fileName2 += ".txt";
-      File.WriteAllLines(fileName2, MapToSee());
-    }
-    public string[] MapToString() { // Function that preapre Map to printing in .txt File: create a set of strings for future reading by computer
-      string[] s;
-      s = new string[Map.Count];
-      for (int i = 0; i < Map.Count; i++) {
-        s[i] = "";
-        for (int j = 0; j < Map[i].Count; j++) {
-          s[i] += Map[i][j].ToString();
-          s[i] += " ";
-        }
-      }
-      return s;
-    }
-    public string[] MapToSee() { // Function that prepare Map to printing in .txt File: create a set of strings in human readable view
-      var fmt = new InfixExpressionFormatter();
-      string[] s;
-      s = new string[(ModelSet.Count) + 1];
-      s[0] = "ClusterNumber" + "," + "ModelNumber" + "," + "Model";
-      for (int i = 1; i < ((ModelSet.Count) + 1); i++) {
-        s[i] = "";
-        if (this is EMMIslandMap island) {
-          s[i] += island.ClusterNumber[i - 1].ToString() + ",";
-        }
-        s[i] += (i - 1).ToString() + ",";
-        if (ModelSet[i - 1] is ISymbolicExpressionTree model) {
-          s[i] += fmt.Format(model);
-        } else { s[i] += ModelSet[i - 1].ToString(); }
-      }
-      return s;
-    }
-    public void MapFromFileRead(string fileName) {
-      string input = File.ReadAllText(fileName);
-      int i = 0;
-      foreach (var row in input.Split('\n')) {
-        Map.Add(new List<int>());
-        foreach (var col in row.Trim().Split(' ')) {
-          Map[i].Add(int.Parse(col.Trim()));
-        }
-        i++;
-      }
-    }
-    #endregion
-
-    #region map use functions
-    public abstract T NewModelForInizializtionNotTree(IRandom random, out int treeNumber);
-    public ISymbolicExpressionTree NewModelForInizializtion(IRandom random, out int treeNumber) {
-      treeNumber = random.Next(ModelSet.Count);
-      if (ModelSet[treeNumber] is ISymbolicExpressionTree model)
-        return (ISymbolicExpressionTree)(model.Clone());
-      return new SymbolicExpressionTree();
-    }
-    public void NodeManipulationForInizializtion(IRandom random, TreeModelTreeNode node) {
-      node.Tree = NewModelForInizializtion(random, out int treeNumber);
-      node.SetLocalParameters(random, 0.5);
-      node.TreeNumber = treeNumber;
-    }
-    public abstract ISymbolicExpressionTree NewModelForMutation(IRandom random, out int treeNumber, int parentTreeNumber);
-    public virtual void NodeForMutationChange(IRandom random, TreeModelTreeNode treeNode) {
-      int treeNumber = treeNode.TreeNumber;
-      int treeNumber2 = treeNode.TreeNumber;
-      treeNode.Tree = new SymbolicExpressionTree(NewModelForMutation(random, out treeNumber, treeNumber2).Root);
-      treeNode.TreeNumber = treeNumber;
-      SetLocalParametersForTree(random, 0.5, treeNode.Tree);
-    }
-    public void SetLocalParametersForTree(IRandom random, double shakingFactor, ISymbolicExpressionTree tree) {
-      foreach (var node in tree.IterateNodesPrefix().Where(x => x.HasLocalParameters)) {
-        if (node is VariableTreeNode variableTreeNode) {
-          var symbol = variableTreeNode.Symbol;
-          variableTreeNode.Weight = NormalDistributedRandom.NextDouble(random, symbol.WeightManipulatorMu, symbol.WeightManipulatorSigma);
-        } else {
-          node.ResetLocalParameters(random);
-        }
-      }
-    }
-    public virtual void MapUpDate(Dictionary<ISymbolicExpressionTree, double> population) { }
-    #endregion
-  }
-}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMClustering.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMClustering.cs	(revision 17002)
+++ 	(revision )
@@ -1,135 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2019 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.Core;
-using System.Collections.Generic;
-
-namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  public class EMModelsClusterizationAlgorithm {
-    public int K { get; private set; }
-    public EMModelsClusterizationAlgorithm() {
-    }
-    public EMModelsClusterizationAlgorithm(int k) {
-      K = k;
-    }
-    public EMModelsClusterizationAlgorithm(EMModelsClusterizationAlgorithm old) {
-      this.K = old.K;
-    }
-    public int Apply(IRandom random, double[,] distances, List<int> numberCluster) {
-
-      K = ApplyClusteringAlgorithm(random, distances, numberCluster, K);
-      return K;
-    }
-
-    public static int ApplyClusteringAlgorithm(IRandom random, double[,] distances, List<int> numberCluster, int k) {
-      int mapSize = distances.GetLength(0);
-      List<int> centroids = new List<int>(); // capacity is equal K
-      List<double> averageClusterDistance = new List<double>();
-      List<List<int>> clusters = new List<List<int>>(); // capacity is equal K
-      CentroidsRandomSetUp(random, centroids, mapSize, k);
-      if (numberCluster.Count == 0) {
-        for (int i = 0; i < mapSize; i++) {
-          numberCluster.Add(0);
-        }
-      }
-      bool flag = true;
-
-      while (flag) {
-        clusters.Clear();
-        for (int i = 0; i < k; i++) {
-          clusters.Add(new List<int>());
-
-        }
-        for (int i = 0; i < mapSize; i++) {
-          numberCluster[i] = LookCloseCentroid(centroids, distances, i, k);
-          clusters[numberCluster[i]].Add(numberCluster[i]);
-        }
-        k = NullSizeClusterDelete(centroids, clusters, mapSize, numberCluster, k);
-        flag = false;
-        for (int i = 0; i < k; i++) {
-          AverageClusterDistanceCalculation(averageClusterDistance, distances, numberCluster, mapSize, i);
-          var newCentroid = clusters[i][HelpFunctions.ChooseMinElementIndex(averageClusterDistance)];
-          if (newCentroid != centroids[i]) {
-            flag = true;
-            centroids[i] = newCentroid;
-          }
-          averageClusterDistance.Clear();
-        }
-      }
-      return k;
-    }
-    private static void CentroidsRandomSetUp(IRandom random, List<int> centroids, int size, int k) {
-      for (int i = 0; i < k; i++) {
-        centroids.Add(random.Next(size));
-      }
-    }
-    private static int LookCloseCentroid(List<int> centroids, double[,] distances, int currentNumber, int k) {
-      double minDistanse = distances[currentNumber, centroids[0]];
-      int clusterNum = 0;
-      for (int i = 1; i < k; i++) {
-        if (minDistanse > distances[currentNumber, centroids[i]]) {
-          minDistanse = distances[currentNumber, centroids[i]];
-          clusterNum = i;
-        }
-      }
-      return clusterNum;
-    }
-    private static int NullSizeClusterDelete(List<int> centroids, List<List<int>> clusters, int mapSize, List<int> numberCluster, int k) {
-      int iter = 0;
-      for (int i = 0; i < k; i++) {
-        if (clusters[i - iter].Count == 0) {
-          for (int j = 0; j < mapSize; j++) {
-            if (numberCluster[j] > (i - iter))
-              numberCluster[j]--;
-          }
-
-          for (int j = 0; j < k - iter; j++) {
-            if (j != i - iter) {
-              for (int m = 0; m < clusters[j].Count; m++)
-                if (clusters[j][m] > (i - iter))
-                  (clusters[j][m])--;
-            }
-          }
-          clusters.Remove(clusters[i - iter]);
-          centroids.Remove(i - iter);
-          iter++;
-        }
-      }
-      k -= iter;
-      return k;
-    }
-    private static void AverageClusterDistanceCalculation(List<double> averageClusterDistance, double[,] distances, List<int> numberCluster, int MapSize, int currentClusterNumber) {
-      int m = 0;
-      for (int i = 0; i < MapSize; i++) {
-        if (numberCluster[i] == currentClusterNumber) {
-          averageClusterDistance.Add(0);
-          for (int j = 0; j < MapSize; j++) {
-            if (numberCluster[j] == currentClusterNumber)
-              averageClusterDistance[m] += distances[i, j];
-          }
-          m++;
-        }
-      }
-    }
-
-
-  }
-}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMDisatanceMap.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMDisatanceMap.cs	(revision 17002)
+++ 	(revision )
@@ -1,78 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2019 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 HEAL.Attic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using System;
-using System.Collections.Generic;
-
-namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [Item("DistanceMap", "A map of models of models of models")]
-  [StorableType("456692FB-2149-4359-8106-45D59D2D7FA0")]
-  public class EMMDisatanceMap : EMMMapBase<ISymbolicExpressionTree> {
-    [Storable]
-    public List<List<double>> Probabilities { get; set; }
-    #region conctructors
-    [StorableConstructor]
-    protected EMMDisatanceMap(StorableConstructorFlag _) : base(_) { }
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new EMMDisatanceMap(this, cloner);
-    }
-    public EMMDisatanceMap() : base() { ModelSet = new List<ISymbolicExpressionTree>(); }
-    public EMMDisatanceMap(EMMDisatanceMap original, Cloner cloner) : base(original, cloner) { }
-    #endregion
-    #region MapCreation
-    override public void CreateMap(IRandom random, int k) {
-
-      Probabilities = new List<List<double>>();
-      MapSizeCheck(ModelSet.Count);
-      ApplyDistanceMapCreationAlgorithm(random, CalculateDistances(), Map, Probabilities);
-    }
-    public static void ApplyDistanceMapCreationAlgorithm(IRandom random, double[,] distances, List<List<int>> map, List<List<double>> probabilities) {
-      int mapSize = distances.GetLength(0);
-      for (int t = 0; t < mapSize; t++) {
-        probabilities.Add(new List<double>());
-        double tempSum = 0;
-        for (int i = 0; i < mapSize; i++) {
-          tempSum += Math.Log(distances[i, t]);
-        }
-        for (int i = 0; i < mapSize; i++) {
-          if (distances[i, t].IsAlmost(0))
-            continue;
-          map[t].Add(i);
-          probabilities[t].Add(Math.Log(distances[i, t]) / tempSum);
-        }
-      }
-    }
-    #endregion
-    #region MapApplayFunctions
-    public override ISymbolicExpressionTree NewModelForMutation(IRandom random, out int treeNumber, int parentTreeNumber) {
-      treeNumber = HelpFunctions.OneElementFromListProportionalSelection(random, Probabilities[parentTreeNumber]);
-      return (ISymbolicExpressionTree)ModelSet[treeNumber].Clone();
-    }
-    override public ISymbolicExpressionTree NewModelForInizializtionNotTree(IRandom random, out int treeNumber) {
-      return NewModelForInizializtion(random, out treeNumber);
-    }
-    #endregion
-  }
-}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMIslandMap.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMIslandMap.cs	(revision 17002)
+++ 	(revision )
@@ -1,88 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2019 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 HEAL.Attic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Random;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [Item("IslandMap", "A map of models of models of models")]
-  [StorableType("E4AB04B9-FD5D-47EE-949D-243660754F3A")]
-  public class EMMIslandMap : EMMMapBase<ISymbolicExpressionTree> {
-    [Storable]
-    public List<int> ClusterNumber { get; set; }  // May be only Island Map really need it
-    #region conctructors
-    [StorableConstructor]
-    protected EMMIslandMap(StorableConstructorFlag _) : base(_) { }
-    public EMMIslandMap() {
-      ModelSet = new List<ISymbolicExpressionTree>();
-      ClusterNumber = new List<int>();
-    }
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new EMMIslandMap(this, cloner);
-    }
-    public EMMIslandMap(EMMIslandMap original, Cloner cloner) : base(original, cloner) {
-      if (original.ClusterNumber != null) {
-        ClusterNumber = original.ClusterNumber.ToList();
-      }
-    }
-    #endregion
-    #region MapApplayFunctions
-    override public void CreateMap(IRandom random, int k) {
-
-      k = EMModelsClusterizationAlgorithm.ApplyClusteringAlgorithm(random, CalculateDistances(), ClusterNumber, k);
-      MapSizeCheck(k);
-      for (int i = 0; i < ModelSet.Count; i++) {
-        Map[ClusterNumber[i]].Add(i);
-      }
-    }
-    override public ISymbolicExpressionTree NewModelForInizializtionNotTree(IRandom random, out int treeNumber) {
-      return NewModelForInizializtion(random, out treeNumber);
-    }
-
-    public override ISymbolicExpressionTree NewModelForMutation(IRandom random, out int treeNumber, int parentTreeNumber) {
-      if (parentTreeNumber == -10) {
-        treeNumber = random.Next(ModelSet.Count);
-      } else {
-        treeNumber = Map[ClusterNumber[parentTreeNumber]].SampleRandom(random);
-      }
-      return (ISymbolicExpressionTree)ModelSet[treeNumber].Clone();
-    }
-    public void ClusterNumbersCalculate() {  // May be it should be transported to Child Clase (IslandMap)
-      for (int i = 0; i < Map.Count; i++) {
-        for (int j = 0; j < Map[i].Count; j++) {
-          ClusterNumber.Add(0);
-        }
-      }
-      for (int i = 0; i < Map.Count; i++) {
-        for (int j = 0; j < Map[i].Count; j++) {
-          ClusterNumber[Map[i][j]] = i;
-        }
-      }
-    }
-    #endregion
-
-  }
-}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMultyPointsMutator.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMultyPointsMutator.cs	(revision 17002)
+++ 	(revision )
@@ -1,114 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2019 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 HEAL.Attic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Parameters;
-using HeuristicLab.Problems.DataAnalysis.Symbolic;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [Item("EMMMultyPointMutator", "Selects a random tree node and changes the symbol.")]
-  [StorableType("918B5F77-3B9E-4620-94A3-236913C4A3F2")]
-  public sealed class EMMMultyPointsMutator : SymbolicExpressionTreeManipulator {
-    private const string MapParameterName = "Map";
-    private const string MutationProbabilityParameterName = "MutationProbability";
-    public ILookupParameter<EMMMapBase<ISymbolicExpressionTree>> MapParameter {
-      get { return (ILookupParameter<EMMMapBase<ISymbolicExpressionTree>>)Parameters[MapParameterName]; }
-    }
-    public ILookupParameter<PercentValue> MutationProbabilityParameter {
-      get { return (ILookupParameter<PercentValue>)Parameters[MutationProbabilityParameterName]; }
-    }
-    public List<ISymbolicExpressionTree> ModelSet => MapParameter.ActualValue.ModelSet;
-    public List<List<int>> Map => MapParameter.ActualValue.Map;
-    public PercentValue MutationProbability => MutationProbabilityParameter.ActualValue;
-
-    [StorableConstructor]
-    private EMMMultyPointsMutator(StorableConstructorFlag _) : base(_) { }
-    private EMMMultyPointsMutator(EMMMultyPointsMutator original, Cloner cloner) : base(original, cloner) { }
-    public EMMMultyPointsMutator() : base() {
-      Parameters.Add(new LookupParameter<EMMMapBase<ISymbolicExpressionTree>>(MapParameterName));
-      Parameters.Add(new LookupParameter<PercentValue>(MutationProbabilityParameterName));
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new EMMMultyPointsMutator(this, cloner);
-    }
-
-    protected override void Manipulate(IRandom random, ISymbolicExpressionTree symbolicExpressionTree) {
-      EMMOnePointMutatorPart(random, symbolicExpressionTree, ModelSet, Map, MutationProbability);
-    }
-    private static bool SymbolTypeCheck(ISymbol nSymbol, IEnumerable<ISymbol> allSymbols) {
-      foreach (var pSymbol in allSymbols) {
-        if (nSymbol == pSymbol)
-          return true;
-      }
-      return false;
-    }
-    public void EMMOnePointMutatorPart(IRandom random, ISymbolicExpressionTree symbolicExpressionTree, List<ISymbolicExpressionTree> modelSet, List<List<int>> map, PercentValue mutationProbability) {
-
-      List<ISymbol> allowedSymbols = new List<ISymbol>();
-      var probability = (1 / mutationProbability.Value) / (symbolicExpressionTree.Length); // probability for edch node to mutate
-      var allAllowedSymbols = symbolicExpressionTree.Root.Grammar.AllowedSymbols.Where(s =>
-        !(s is Defun) &&
-        !(s is GroupSymbol) &&
-        !(s is ProgramRootSymbol) &&
-        !(s is StartSymbol)
-      );
-
-      symbolicExpressionTree.Root.ForEachNodePostfix(node => {//for each node in tree - try to mutate
-
-        if (SymbolTypeCheck(node.Symbol, allAllowedSymbols)) { // we do not want to toch StartSymbol
-          if (random.NextDouble() < probability) { // ok. this node decide to mutate
-
-            foreach (var symbol in allAllowedSymbols) {// add in list all nodes with the same arity
-              if ((symbol.MaximumArity == node.Symbol.MaximumArity) && (symbol.MinimumArity == node.Symbol.MinimumArity)) { allowedSymbols.Add(symbol); }
-            }
-            if (node.Symbol.MaximumArity == 0) { // for terminal nodes add aditional the same type of nodes
-              allowedSymbols.Add(node.Symbol);
-            }
-            int pTemp = random.Next(map.Count);
-            if (node is TreeModelTreeNode treeNode) { pTemp = treeNode.TreeNumber; } //remeber the cluster number
-            var weights = allowedSymbols.Select(s => s.InitialFrequency).ToList(); // set up probabilities
-
-#pragma warning disable CS0618 // Type or member is obsolete
-            var newSymbol = allowedSymbols.SelectRandom(weights, random); // create new node from the choosen symbol type. Ror terminal nodes it means that we have only one possible varint.
-#pragma warning restore CS0618 // Type or member is obsolete
-            node = newSymbol.CreateTreeNode();
-
-            if (node is TreeModelTreeNode treeNode2) { // make rigth mutation for tree model
-              treeNode2.TreeNumber = pTemp;
-              MapParameter.ActualValue.NodeForMutationChange(random, treeNode2);
-            } else if (node.HasLocalParameters) { // make local parametrs set up for other node types
-              node.ResetLocalParameters(random);
-            }
-            allowedSymbols.Clear(); // clean before the next node
-          }
-
-        }
-      });
-    }
-  }
-}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMultyPointsMutatorNodeTypeSaving.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMultyPointsMutatorNodeTypeSaving.cs	(revision 17002)
+++ 	(revision )
@@ -1,117 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2019 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 HEAL.Attic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Parameters;
-using HeuristicLab.Problems.DataAnalysis.Symbolic;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [Item("EMMMultyPointMutatorNodeTypeSaving", "Selects a random tree node and changes the symbol.")]
-  [StorableType("8A24C715-BEFD-4396-9264-31F949330B1A")]
-  public sealed class EMMMultyPointsMutatorNodeTypeSaving : SymbolicExpressionTreeManipulator {
-
-    private const string MapParameterName = "Map";
-    private const string MutationProbabilityParameterName = "MutationProbability";
-    public ILookupParameter<EMMMapBase<ISymbolicExpressionTree>> MapParameter {
-      get { return (ILookupParameter<EMMMapBase<ISymbolicExpressionTree>>)Parameters[MapParameterName]; }
-    }
-    public List<ISymbolicExpressionTree> ModelSet => MapParameter.ActualValue.ModelSet;
-    public List<List<int>> Map => MapParameter.ActualValue.Map;
-
-    public ILookupParameter<PercentValue> MutationProbabilityParameter {
-      get { return (ILookupParameter<PercentValue>)Parameters[MutationProbabilityParameterName]; }
-    }
-
-    public PercentValue MutationProbability => MutationProbabilityParameter.ActualValue;
-
-    [StorableConstructor]
-    private EMMMultyPointsMutatorNodeTypeSaving(StorableConstructorFlag _) : base(_) { }
-    private EMMMultyPointsMutatorNodeTypeSaving(EMMMultyPointsMutatorNodeTypeSaving original, Cloner cloner) : base(original, cloner) { }
-    public EMMMultyPointsMutatorNodeTypeSaving() : base() {
-      Parameters.Add(new LookupParameter<EMMMapBase<ISymbolicExpressionTree>>(MapParameterName));
-      Parameters.Add(new LookupParameter<PercentValue>(MutationProbabilityParameterName));
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new EMMMultyPointsMutatorNodeTypeSaving(this, cloner);
-    }
-
-    protected override void Manipulate(IRandom random, ISymbolicExpressionTree symbolicExpressionTree) {
-      EMMOnePointMutatorPart(random, symbolicExpressionTree, ModelSet, Map, MutationProbability);
-    }
-    private static bool SymbolTypeCheck(ISymbol nSymbol, IEnumerable<ISymbol> allSymbols) {
-      foreach (var pSymbol in allSymbols) {
-        if (nSymbol == pSymbol)
-          return true;
-      }
-      return false;
-    }
-    public void EMMOnePointMutatorPart(IRandom random, ISymbolicExpressionTree symbolicExpressionTree, List<ISymbolicExpressionTree> modelSet, List<List<int>> map, PercentValue mutationProbability) {
-
-      List<ISymbol> allowedSymbols = new List<ISymbol>();
-      var probability = (1 / mutationProbability.Value) / (symbolicExpressionTree.Length); // probability for edch node to mutate
-      var allAllowedSymbols = symbolicExpressionTree.Root.Grammar.AllowedSymbols.Where(s =>
-        !(s is Defun) &&
-        !(s is GroupSymbol) &&
-        !(s is ProgramRootSymbol) &&
-        !(s is StartSymbol)
-      );
-
-      symbolicExpressionTree.Root.ForEachNodePostfix(node => {//for each node in tree - try to mutate
-
-        if (SymbolTypeCheck(node.Symbol, allAllowedSymbols)) { // we do not want to toch StartSymbol
-          if (random.NextDouble() < probability) { // ok. this node decide to mutate
-            if (node.Symbol.MaximumArity > 0) {
-              foreach (var symbol in allAllowedSymbols) {// add in list all nodes with the same arity
-                if ((symbol.MaximumArity == node.Symbol.MaximumArity) && (symbol.MinimumArity == node.Symbol.MinimumArity)) { allowedSymbols.Add(symbol); }
-              }
-            } else { // for terminal nodes add  the same type of nodes
-              allowedSymbols.Add(node.Symbol);
-            }
-            int pTemp = random.Next(modelSet.Count);
-            if (node is TreeModelTreeNode treeNode) { pTemp = treeNode.TreeNumber; } //remeber the cluster number
-            var weights = allowedSymbols.Select(s => s.InitialFrequency).ToList(); // set up probabilities
-
-#pragma warning disable CS0618 // Type or member is obsolete
-            var newSymbol = allowedSymbols.SelectRandom(weights, random); // create new node from the choosen symbol type. Ror terminal nodes it means that we have only one possible varint.
-#pragma warning restore CS0618 // Type or member is obsolete
-            node = newSymbol.CreateTreeNode();
-
-            if (node is TreeModelTreeNode treeNode2) { // make rigth mutation for tree model
-              treeNode2.TreeNumber = pTemp;
-              MapParameter.ActualValue.NodeForMutationChange(random, treeNode2);
-            } else if (node.HasLocalParameters) { // make local parametrs set up for other node types
-              node.ResetLocalParameters(random);
-            }
-            allowedSymbols.Clear(); // clean before the next node
-          }
-
-        }
-      });
-    }
-  }
-}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMutators.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMutators.cs	(revision 17002)
+++ 	(revision )
@@ -1,121 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2019 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 HEAL.Attic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Parameters;
-using HeuristicLab.Problems.DataAnalysis.Symbolic;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [Item("EMMChangeNodeTypeManipulation", "Selects a random tree node and changes the symbol.")]
-  [StorableType("990D3946-7F06-48B4-B8DB-F8E308D6304D")]
-  public sealed class EMMMutators : SymbolicExpressionTreeManipulator {
-    private const int MAX_TRIES = 100;
-    private const string MapParameterName = "Map";
-
-    public ILookupParameter<EMMMapBase<ISymbolicExpressionTree>> MapParameter {
-      get { return (ILookupParameter<EMMMapBase<ISymbolicExpressionTree>>)Parameters[MapParameterName]; }
-    }
-
-    public List<ISymbolicExpressionTree> ModelSet => MapParameter.ActualValue.ModelSet;
-    public List<List<int>> Map => MapParameter.ActualValue.Map;
-
-    [StorableConstructor]
-    private EMMMutators(StorableConstructorFlag _) : base(_) { }
-    private EMMMutators(EMMMutators original, Cloner cloner) : base(original, cloner) { }
-    public EMMMutators() : base() {
-      Parameters.Add(new LookupParameter<EMMMapBase<ISymbolicExpressionTree>>(MapParameterName));
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new EMMMutators(this, cloner);
-    }
-
-    protected override void Manipulate(IRandom random, ISymbolicExpressionTree symbolicExpressionTree) {
-      EMMMutatorsPart(random, symbolicExpressionTree, ModelSet, Map);
-    }
-    public void EMMMutatorsPart(IRandom random, ISymbolicExpressionTree symbolicExpressionTree, List<ISymbolicExpressionTree> modelSet, List<List<int>> map) {
-      List<ISymbol> allowedSymbols = new List<ISymbol>();
-      ISymbolicExpressionTreeNode parent;
-      int childIndex;
-      ISymbolicExpressionTreeNode child;
-      // repeat until a fitting parent and child are found (MAX_TRIES times)
-      int tries = 0;
-      do {
-
-#pragma warning disable 612, 618
-        parent = symbolicExpressionTree.Root.IterateNodesPrefix().Skip(1).Where(n => n.SubtreeCount > 0).SelectRandom(random);
-#pragma warning restore 612, 618
-
-        childIndex = random.Next(parent.SubtreeCount);
-
-        child = parent.GetSubtree(childIndex);
-        int existingSubtreeCount = child.SubtreeCount;
-        allowedSymbols.Clear();
-        foreach (var symbol in parent.Grammar.GetAllowedChildSymbols(parent.Symbol, childIndex)) {
-          // check basic properties that the new symbol must have
-          if (symbol.Name != child.Symbol.Name &&
-            symbol.InitialFrequency > 0 &&
-            existingSubtreeCount <= parent.Grammar.GetMinimumSubtreeCount(symbol) &&
-            existingSubtreeCount >= parent.Grammar.GetMaximumSubtreeCount(symbol)) {
-            // check that all existing subtrees are also allowed for the new symbol
-            bool allExistingSubtreesAllowed = true;
-            for (int existingSubtreeIndex = 0; existingSubtreeIndex < existingSubtreeCount && allExistingSubtreesAllowed; existingSubtreeIndex++) {
-              var existingSubtree = child.GetSubtree(existingSubtreeIndex);
-              allExistingSubtreesAllowed &= parent.Grammar.IsAllowedChildSymbol(symbol, existingSubtree.Symbol, existingSubtreeIndex);
-            }
-            if (allExistingSubtreesAllowed) {
-              allowedSymbols.Add(symbol);
-            }
-          }
-        }
-        tries++;
-      } while (tries < MAX_TRIES && allowedSymbols.Count == 0);
-
-      if (tries < MAX_TRIES) {
-        var weights = allowedSymbols.Select(s => s.InitialFrequency).ToList();
-#pragma warning disable 612, 618
-        var newSymbol = allowedSymbols.SelectRandom(weights, random);
-#pragma warning restore 612, 618
-
-        // replace the old node with the new node
-
-        var newNode = newSymbol.CreateTreeNode();
-
-        if (newNode is TreeModelTreeNode treeNode) {
-          int p = random.Next(modelSet.Count);
-          if (child is TreeModelTreeNode chNode) { p = chNode.TreeNumber; }
-          treeNode.TreeNumber = p;
-          MapParameter.ActualValue.NodeForMutationChange(random, treeNode);
-        } else if (newNode.HasLocalParameters)
-          newNode.ResetLocalParameters(random);
-        foreach (var subtree in child.Subtrees)
-          newNode.AddSubtree(subtree);
-        parent.RemoveSubtree(childIndex);
-        parent.InsertSubtree(childIndex, newNode);
-      }
-    }
-  }
-}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMNetworkMap.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMNetworkMap.cs	(revision 17002)
+++ 	(revision )
@@ -1,77 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2019 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 HEAL.Attic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Random;
-using System.Collections.Generic;
-
-namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [Item("NetworkMap", "A map of models of models of models")]
-  [StorableType("C200ECC2-6D33-4468-A538-580B07D75B3C")]
-  public class EMMNetworkMap : EMMMapBase<ISymbolicExpressionTree> {
-    public int NeghboorNumber { get; set; }
-    #region conctructors
-    [StorableConstructor]
-    protected EMMNetworkMap(StorableConstructorFlag _) : base(_) { }
-    public EMMNetworkMap() : this(1) { }
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new EMMNetworkMap(this, cloner);
-    }
-    public EMMNetworkMap(int neghboorNumber = 10) : base() {
-      NeghboorNumber = neghboorNumber;
-    }
-    public EMMNetworkMap(EMMNetworkMap original, Cloner cloner) : base(original, cloner) { NeghboorNumber = original.NeghboorNumber; }
-    #endregion
-    #region MapTransformation
-    override public void CreateMap(IRandom random, int k) {
-      ApplyNetworkMapCreationAlgorithm(random, CalculateDistances(), Map, NeghboorNumber);
-    }
-    public static void ApplyNetworkMapCreationAlgorithm(IRandom random, double[,] distances, List<List<int>> map, int neghboorNumber = 10) {
-      int mapSize = distances.GetLength(0);
-      List<double> currentList = new List<double>();
-      for (int i = 0; i < mapSize; i++) {
-        map.Add(new List<int>());
-        for (int j = 0; j < mapSize; j++) {
-          currentList.Add(distances[i, j]);
-        }
-        map[i].Add(HelpFunctions.ChooseMinElementIndex(currentList));
-        while (map[i].Count < neghboorNumber) {
-          map[i].Add(HelpFunctions.ChooseMinElementIndex(currentList, i, map[i]));
-        }
-        currentList.Clear();
-      }
-    }
-    #endregion
-    #region Dialog with surroudings
-    public override ISymbolicExpressionTree NewModelForMutation(IRandom random, out int treeNumber, int parentTreeNumber) {
-      treeNumber = Map[parentTreeNumber].SampleRandom(random);
-      return (ISymbolicExpressionTree)ModelSet[treeNumber].Clone();
-    }
-    override public ISymbolicExpressionTree NewModelForInizializtionNotTree(IRandom random, out int treeNumber) {
-      var newTree = NewModelForInizializtion(random, out treeNumber);
-      return newTree;
-    }
-    #endregion
-  }
-}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMOperators/EMMMultyPointsMutator.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMOperators/EMMMultyPointsMutator.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMOperators/EMMMultyPointsMutator.cs	(revision 17134)
@@ -0,0 +1,114 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  [Item("EMMMultyPointMutator", "Selects a random tree node and changes the symbol.")]
+  [StorableType("918B5F77-3B9E-4620-94A3-236913C4A3F2")]
+  public sealed class EMMMultyPointsMutator : SymbolicExpressionTreeManipulator {
+    private const string MapParameterName = "Map";
+    private const string MutationProbabilityParameterName = "MutationProbability";
+    public ILookupParameter<EMMMapBase<ISymbolicExpressionTree>> MapParameter {
+      get { return (ILookupParameter<EMMMapBase<ISymbolicExpressionTree>>)Parameters[MapParameterName]; }
+    }
+    public ILookupParameter<PercentValue> MutationProbabilityParameter {
+      get { return (ILookupParameter<PercentValue>)Parameters[MutationProbabilityParameterName]; }
+    }
+    public List<ISymbolicExpressionTree> ModelSet => MapParameter.ActualValue.ModelSet;
+    public List<List<int>> Map => MapParameter.ActualValue.Map;
+    public PercentValue MutationProbability => MutationProbabilityParameter.ActualValue;
+
+    [StorableConstructor]
+    private EMMMultyPointsMutator(StorableConstructorFlag _) : base(_) { }
+    private EMMMultyPointsMutator(EMMMultyPointsMutator original, Cloner cloner) : base(original, cloner) { }
+    public EMMMultyPointsMutator() : base() {
+      Parameters.Add(new LookupParameter<EMMMapBase<ISymbolicExpressionTree>>(MapParameterName));
+      Parameters.Add(new LookupParameter<PercentValue>(MutationProbabilityParameterName));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EMMMultyPointsMutator(this, cloner);
+    }
+
+    protected override void Manipulate(IRandom random, ISymbolicExpressionTree symbolicExpressionTree) {
+      EMMOnePointMutatorPart(random, symbolicExpressionTree, ModelSet, Map, MutationProbability);
+    }
+    private static bool SymbolTypeCheck(ISymbol nSymbol, IEnumerable<ISymbol> allSymbols) {
+      foreach (var pSymbol in allSymbols) {
+        if (nSymbol == pSymbol)
+          return true;
+      }
+      return false;
+    }
+    public void EMMOnePointMutatorPart(IRandom random, ISymbolicExpressionTree symbolicExpressionTree, List<ISymbolicExpressionTree> modelSet, List<List<int>> map, PercentValue mutationProbability) {
+
+      List<ISymbol> allowedSymbols = new List<ISymbol>();
+      var probability = (1 / mutationProbability.Value) / (symbolicExpressionTree.Length); // probability for each node to mutate
+      var allAllowedSymbols = symbolicExpressionTree.Root.Grammar.AllowedSymbols.Where(s =>
+        !(s is Defun) &&
+        !(s is GroupSymbol) &&
+        !(s is ProgramRootSymbol) &&
+        !(s is StartSymbol)
+      );
+
+      symbolicExpressionTree.Root.ForEachNodePostfix(node => {//for each node in tree - try to mutate
+
+        if (SymbolTypeCheck(node.Symbol, allAllowedSymbols)) { // we do not want to touch StartSymbol
+          if (random.NextDouble() < probability) { // ok. this node decide to mutate
+
+            foreach (var symbol in allAllowedSymbols) {// add in list all nodes with the same arity
+              if ((symbol.MaximumArity == node.Symbol.MaximumArity) && (symbol.MinimumArity == node.Symbol.MinimumArity)) { allowedSymbols.Add(symbol); }
+            }
+            if (node.Symbol.MaximumArity == 0) { // for terminal nodes add additional the same type of nodes
+              allowedSymbols.Add(node.Symbol);
+            }
+            int pTemp = random.Next(map.Count);
+            if (node is TreeModelTreeNode treeNode) { pTemp = treeNode.TreeNumber; } //remember the cluster number
+            var weights = allowedSymbols.Select(s => s.InitialFrequency).ToList(); // set up probabilities
+
+#pragma warning disable CS0618 // Type or member is obsolete
+            var newSymbol = allowedSymbols.SelectRandom(weights, random); // create new node from the chosen symbol type. For terminal nodes it means that we have only one possible variant.
+#pragma warning restore CS0618 // Type or member is obsolete
+            node = newSymbol.CreateTreeNode();
+
+            if (node is TreeModelTreeNode treeNode2) { // make right mutation for tree model
+              treeNode2.TreeNumber = pTemp;
+              MapParameter.ActualValue.NodeForMutationChange(random, treeNode2);
+            } else if (node.HasLocalParameters) { // make local parameters set up for other node types
+              node.ResetLocalParameters(random);
+            }
+            allowedSymbols.Clear(); // clean before the next node
+          }
+
+        }
+      });
+    }
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMOperators/EMMMultyPointsMutatorNodeTypeSaving.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMOperators/EMMMultyPointsMutatorNodeTypeSaving.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMOperators/EMMMultyPointsMutatorNodeTypeSaving.cs	(revision 17134)
@@ -0,0 +1,117 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  [Item("EMMMultyPointMutatorNodeTypeSaving", "Selects a random tree node and changes the symbol.")]
+  [StorableType("8A24C715-BEFD-4396-9264-31F949330B1A")]
+  public sealed class EMMMultyPointsMutatorNodeTypeSaving : SymbolicExpressionTreeManipulator {
+
+    private const string MapParameterName = "Map";
+    private const string MutationProbabilityParameterName = "MutationProbability";
+    public ILookupParameter<EMMMapBase<ISymbolicExpressionTree>> MapParameter {
+      get { return (ILookupParameter<EMMMapBase<ISymbolicExpressionTree>>)Parameters[MapParameterName]; }
+    }
+    public List<ISymbolicExpressionTree> ModelSet => MapParameter.ActualValue.ModelSet;
+    public List<List<int>> Map => MapParameter.ActualValue.Map;
+
+    public ILookupParameter<PercentValue> MutationProbabilityParameter {
+      get { return (ILookupParameter<PercentValue>)Parameters[MutationProbabilityParameterName]; }
+    }
+
+    public PercentValue MutationProbability => MutationProbabilityParameter.ActualValue;
+
+    [StorableConstructor]
+    private EMMMultyPointsMutatorNodeTypeSaving(StorableConstructorFlag _) : base(_) { }
+    private EMMMultyPointsMutatorNodeTypeSaving(EMMMultyPointsMutatorNodeTypeSaving original, Cloner cloner) : base(original, cloner) { }
+    public EMMMultyPointsMutatorNodeTypeSaving() : base() {
+      Parameters.Add(new LookupParameter<EMMMapBase<ISymbolicExpressionTree>>(MapParameterName));
+      Parameters.Add(new LookupParameter<PercentValue>(MutationProbabilityParameterName));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EMMMultyPointsMutatorNodeTypeSaving(this, cloner);
+    }
+
+    protected override void Manipulate(IRandom random, ISymbolicExpressionTree symbolicExpressionTree) {
+      EMMOnePointMutatorPart(random, symbolicExpressionTree, ModelSet, Map, MutationProbability);
+    }
+    private static bool SymbolTypeCheck(ISymbol nSymbol, IEnumerable<ISymbol> allSymbols) {
+      foreach (var pSymbol in allSymbols) {
+        if (nSymbol == pSymbol)
+          return true;
+      }
+      return false;
+    }
+    public void EMMOnePointMutatorPart(IRandom random, ISymbolicExpressionTree symbolicExpressionTree, List<ISymbolicExpressionTree> modelSet, List<List<int>> map, PercentValue mutationProbability) {
+
+      List<ISymbol> allowedSymbols = new List<ISymbol>();
+      var probability = (1 / mutationProbability.Value) / (symbolicExpressionTree.Length); // probability for each node to mutate
+      var allAllowedSymbols = symbolicExpressionTree.Root.Grammar.AllowedSymbols.Where(s =>
+        !(s is Defun) &&
+        !(s is GroupSymbol) &&
+        !(s is ProgramRootSymbol) &&
+        !(s is StartSymbol)
+      );
+
+      symbolicExpressionTree.Root.ForEachNodePostfix(node => {//for each node in tree - try to mutate
+
+        if (SymbolTypeCheck(node.Symbol, allAllowedSymbols)) { // we do not want to touch StartSymbol
+          if (random.NextDouble() < probability) { // ok. this node decide to mutate
+            if (node.Symbol.MaximumArity > 0) {
+              foreach (var symbol in allAllowedSymbols) {// add in list all nodes with the same arity
+                if ((symbol.MaximumArity == node.Symbol.MaximumArity) && (symbol.MinimumArity == node.Symbol.MinimumArity)) { allowedSymbols.Add(symbol); }
+              }
+            } else { // for terminal nodes add  the same type of nodes
+              allowedSymbols.Add(node.Symbol);
+            }
+            int pTemp = random.Next(modelSet.Count);
+            if (node is TreeModelTreeNode treeNode) { pTemp = treeNode.TreeNumber; } //remember the cluster number
+            var weights = allowedSymbols.Select(s => s.InitialFrequency).ToList(); // set up probabilities
+
+#pragma warning disable CS0618 // Type or member is obsolete
+            var newSymbol = allowedSymbols.SelectRandom(weights, random); // create new node from the chosen symbol type. For terminal nodes it means that we have only one possible variant.
+#pragma warning restore CS0618 // Type or member is obsolete
+            node = newSymbol.CreateTreeNode();
+
+            if (node is TreeModelTreeNode treeNode2) { // make right mutation for tree model
+              treeNode2.TreeNumber = pTemp;
+              MapParameter.ActualValue.NodeForMutationChange(random, treeNode2);
+            } else if (node.HasLocalParameters) { // make local parameters set up for other node types
+              node.ResetLocalParameters(random);
+            }
+            allowedSymbols.Clear(); // clean before the next node
+          }
+
+        }
+      });
+    }
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMOperators/EMMMutators.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMOperators/EMMMutators.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMOperators/EMMMutators.cs	(revision 17134)
@@ -0,0 +1,121 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  [Item("EMMChangeNodeTypeManipulation", "Selects a random tree node and changes the symbol.")]
+  [StorableType("990D3946-7F06-48B4-B8DB-F8E308D6304D")]
+  public sealed class EMMMutators : SymbolicExpressionTreeManipulator {
+    private const int MAX_TRIES = 100;
+    private const string MapParameterName = "Map";
+
+    public ILookupParameter<EMMMapBase<ISymbolicExpressionTree>> MapParameter {
+      get { return (ILookupParameter<EMMMapBase<ISymbolicExpressionTree>>)Parameters[MapParameterName]; }
+    }
+
+    public List<ISymbolicExpressionTree> ModelSet => MapParameter.ActualValue.ModelSet;
+    public List<List<int>> Map => MapParameter.ActualValue.Map;
+
+    [StorableConstructor]
+    private EMMMutators(StorableConstructorFlag _) : base(_) { }
+    private EMMMutators(EMMMutators original, Cloner cloner) : base(original, cloner) { }
+    public EMMMutators() : base() {
+      Parameters.Add(new LookupParameter<EMMMapBase<ISymbolicExpressionTree>>(MapParameterName));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EMMMutators(this, cloner);
+    }
+
+    protected override void Manipulate(IRandom random, ISymbolicExpressionTree symbolicExpressionTree) {
+      EMMMutatorsPart(random, symbolicExpressionTree, ModelSet, Map);
+    }
+    public void EMMMutatorsPart(IRandom random, ISymbolicExpressionTree symbolicExpressionTree, List<ISymbolicExpressionTree> modelSet, List<List<int>> map) {
+      List<ISymbol> allowedSymbols = new List<ISymbol>();
+      ISymbolicExpressionTreeNode parent;
+      int childIndex;
+      ISymbolicExpressionTreeNode child;
+      // repeat until a fitting parent and child are found (MAX_TRIES times)
+      int tries = 0;
+      do {
+
+#pragma warning disable 612, 618
+        parent = symbolicExpressionTree.Root.IterateNodesPrefix().Skip(1).Where(n => n.SubtreeCount > 0).SelectRandom(random);
+#pragma warning restore 612, 618
+
+        childIndex = random.Next(parent.SubtreeCount);
+
+        child = parent.GetSubtree(childIndex);
+        int existingSubtreeCount = child.SubtreeCount;
+        allowedSymbols.Clear();
+        foreach (var symbol in parent.Grammar.GetAllowedChildSymbols(parent.Symbol, childIndex)) {
+          // check basic properties that the new symbol must have
+          if (symbol.Name != child.Symbol.Name &&
+            symbol.InitialFrequency > 0 &&
+            existingSubtreeCount <= parent.Grammar.GetMinimumSubtreeCount(symbol) &&
+            existingSubtreeCount >= parent.Grammar.GetMaximumSubtreeCount(symbol)) {
+            // check that all existing subtrees are also allowed for the new symbol
+            bool allExistingSubtreesAllowed = true;
+            for (int existingSubtreeIndex = 0; existingSubtreeIndex < existingSubtreeCount && allExistingSubtreesAllowed; existingSubtreeIndex++) {
+              var existingSubtree = child.GetSubtree(existingSubtreeIndex);
+              allExistingSubtreesAllowed &= parent.Grammar.IsAllowedChildSymbol(symbol, existingSubtree.Symbol, existingSubtreeIndex);
+            }
+            if (allExistingSubtreesAllowed) {
+              allowedSymbols.Add(symbol);
+            }
+          }
+        }
+        tries++;
+      } while (tries < MAX_TRIES && allowedSymbols.Count == 0);
+
+      if (tries < MAX_TRIES) {
+        var weights = allowedSymbols.Select(s => s.InitialFrequency).ToList();
+#pragma warning disable 612, 618
+        var newSymbol = allowedSymbols.SelectRandom(weights, random);
+#pragma warning restore 612, 618
+
+        // replace the old node with the new node
+
+        var newNode = newSymbol.CreateTreeNode();
+
+        if (newNode is TreeModelTreeNode treeNode) {
+          int p = random.Next(modelSet.Count);
+          if (child is TreeModelTreeNode chNode) { p = chNode.TreeNumber; }
+          treeNode.TreeNumber = p;
+          MapParameter.ActualValue.NodeForMutationChange(random, treeNode);
+        } else if (newNode.HasLocalParameters)
+          newNode.ResetLocalParameters(random);
+        foreach (var subtree in child.Subtrees)
+          newNode.AddSubtree(subtree);
+        parent.RemoveSubtree(childIndex);
+        parent.InsertSubtree(childIndex, newNode);
+      }
+    }
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMRankMap.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMRankMap.cs	(revision 17002)
+++ 	(revision )
@@ -1,91 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2019 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 HEAL.Attic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using System;
-using System.Collections.Generic;
-
-namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [Item("RankMap", "A map of models of models of models")]
-  [StorableType("1D4DD90E-553A-46DB-B0CD-6A899AA0B6D0")]
-  public class EMMRankMap : EMMMapBase<ISymbolicExpressionTree> {
-    [Storable]
-    public List<List<double>> Probabilities { get; set; }
-    #region conctructors
-    [StorableConstructor]
-    protected EMMRankMap(StorableConstructorFlag _) : base(_) { }
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new EMMRankMap(this, cloner);
-    }
-    public EMMRankMap() : base() { ModelSet = new List<ISymbolicExpressionTree>(); }
-    public EMMRankMap(EMMRankMap original, Cloner cloner) : base(original, cloner) { }
-    #endregion
-    #region MapCreation
-    override public void CreateMap(IRandom random, int k) {
-
-      Probabilities = new List<List<double>>();
-      MapSizeCheck(ModelSet.Count);
-      ApplyRankMapCreationAlgorithm(random, CalculateDistances(), Map, Probabilities);
-    }
-    public static void ApplyRankMapCreationAlgorithm(IRandom random, double[,] distances, List<List<int>> map, List<List<double>> probabilities) {
-      int mapSize = distances.GetLength(0);
-      double tempSum = 0;
-      for (int i = 0; i < mapSize; i++) {
-        tempSum += i;
-      }
-      List<List<double>> currentList = new List<List<double>>();
-      for (int t = 0; t < mapSize; t++) {
-        for (int i = 0; i < mapSize; i++) {
-          if (distances[i, t].IsAlmost(0))
-            continue;
-          currentList.Add(new List<double>());
-          currentList[i].Add(i);
-          currentList[i].Add(distances[i, t]);
-        }
-        currentList.Sort((a, b) => a[1].CompareTo(b[1])); ///загадкой является то нафига оно мне вообще понадобилось in DistanceMap.. но это работающая сортировка.
-        for (int i = 0; i < currentList.Count; i++) {
-          currentList[i].Add(currentList.Count - i);
-        }
-        probabilities.Add(new List<double>());
-        for (int i = 0; i < mapSize; i++) {
-          if (distances[i, t].IsAlmost(0))
-            continue;
-          map[t].Add(Convert.ToInt32(currentList[i][0]));
-          probabilities[t].Add(currentList[i][2] / tempSum);
-        }
-        currentList.Clear();
-      }
-    }
-    #endregion
-    #region MapApplayFunctions
-    public override ISymbolicExpressionTree NewModelForMutation(IRandom random, out int treeNumber, int parentTreeNumber) {
-      treeNumber = Map[parentTreeNumber][HelpFunctions.OneElementFromListProportionalSelection(random, Probabilities[parentTreeNumber])];
-      return (ISymbolicExpressionTree)ModelSet[treeNumber].Clone();
-    }
-    override public ISymbolicExpressionTree NewModelForInizializtionNotTree(IRandom random, out int treeNumber) {
-      return NewModelForInizializtion(random, out treeNumber);
-    }
-    #endregion
-  }
-}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMSolution.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMSolution.cs	(revision 17002)
+++ 	(revision )
@@ -1,93 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2019 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 HEAL.Attic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using DoubleValue = HeuristicLab.Data.DoubleValue;
-// Can be deleted potnetinaly
-namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [StorableType("AB38211D-5F52-4420-A606-1C3CB58BA27C")]
-  public interface IEMMSolution : IItem {
-    IItem Individual { get; set; }
-    DoubleValue Qualities { get; set; }
-  }
-  [Item("EMMSolution", "Represents a solution inside the EMM population")]
-  [StorableType("C0E63430-5000-4592-BBE4-2D3E0EE1AE3F")]
-  public class EMMSolution : Item, IEMMSolution {
-    [Storable]
-    public IItem Individual { get; set; }
-
-    [Storable]
-    public DoubleValue Qualities { get; set; }
-
-    public EMMSolution() { }
-
-    public EMMSolution(IItem individual) : this() {
-      Individual = individual;
-    }
-    public EMMSolution(IScope scope) {
-      Individual = scope;
-      Qualities = (DoubleValue)scope.Variables["Quality"].Value;
-    }
-    public EMMSolution(IItem individual, DoubleValue qualities) {
-      Individual = individual;
-      Qualities = qualities;
-    }
-
-    public EMMSolution(DoubleValue qualities) {
-      Qualities = qualities;
-    }
-
-    public int Dimensions = 1;
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new EMMSolution(this, cloner);
-    }
-
-    protected EMMSolution(EMMSolution original, Cloner cloner) : base(original, cloner) {
-      Qualities = cloner.Clone(original.Qualities);
-      Individual = cloner.Clone(original.Individual);
-    }
-
-    [StorableConstructor]
-    protected EMMSolution(StorableConstructorFlag _) : base(_) { }
-  }
-  [Item("EMMSolution", "Represents a solution inside the EMM population")]
-  [StorableType("559EA31B-2263-4233-900C-EC62120EE580")]
-  public class EMMSolution<T> : EMMSolution where T : class, IItem {
-    public new T Individual {
-      get { return (T)base.Individual; }
-      set { base.Individual = value; }
-    }
-
-    public EMMSolution(T individual) : base(individual) { }
-
-    protected EMMSolution(EMMSolution<T> original, Cloner cloner) : base(original, cloner) { }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new EMMSolution<T>(this, cloner);
-    }
-
-    [StorableConstructor]
-    protected EMMSolution(StorableConstructorFlag _) : base(_) { }
-  }
-}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMSucsessMap.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMSucsessMap.cs	(revision 17002)
+++ 	(revision )
@@ -1,100 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2019 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 HEAL.Attic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Problems.DataAnalysis.Symbolic;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [Item("SucsessMap", "A map of models of models of models")]
-  [StorableType("3880BA82-4CB0-4838-A17A-823E91BC046C")]
-  public class EMMSucsessMap : EMMMapBase<ISymbolicExpressionTree> {
-    [Storable]
-    public List<double> Probabilities { get; private set; }
-    [Storable]
-    public List<List<double>> SucsessStatistics { get; private set; }
-    #region conctructors
-    [StorableConstructor]
-    protected EMMSucsessMap(StorableConstructorFlag _) : base(_) { }
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new EMMSucsessMap(this, cloner);
-    }
-    public EMMSucsessMap() : base() {
-      ModelSet = new List<ISymbolicExpressionTree>();
-      SucsessStatistics = new List<List<double>>();
-    }
-    public EMMSucsessMap(EMMSucsessMap original, Cloner cloner) : base(original, cloner) {
-      SucsessStatistics = original.SucsessStatistics.Select(x => x.ToList()).ToList();
-    }
-    #endregion
-    #region MapCreation
-    override public void CreateMap(IRandom random, int k) {
-
-      Probabilities = new List<double>();
-      Map.Clear();
-      Map.Add(new List<int>());
-      MapSizeCheck(ModelSet.Count);
-      ApplySucsessMapCreationAlgorithm(random, CalculateDistances(), Map, Probabilities, SucsessStatistics);
-    }
-    public static void ApplySucsessMapCreationAlgorithm(IRandom random, double[,] distances, List<List<int>> map, List<double> probabilities, List<List<double>> sucsessStatistics) {
-      int mapSize = distances.GetLength(0);
-      for (int t = 0; t < mapSize; t++) {
-        map[t].Add(t);
-        probabilities.Add(1.0 / ((double)(mapSize))); // uniform distribution as start point
-      }
-    }
-    public override void MapUpDate(Dictionary<ISymbolicExpressionTree, double> population) {
-      SucsessStatisticCollection(population);
-      HelpFunctions.ProbabilitiesUpDate(SucsessStatistics, Probabilities);
-    }
-    private void SucsessStatisticCollection(Dictionary<ISymbolicExpressionTree, double> population) {
-      if (SucsessStatistics.Count != 0)
-        SucsessStatistics.Clear();
-      for (int t = 0; t < Probabilities.Count; t++) {
-        SucsessStatistics.Add(new List<double>());
-        SucsessStatistics[t].Add(0);
-        SucsessStatistics[t].Add(0);
-      }
-      foreach (var solution in population) {
-        TreeCheck(solution.Key, solution.Value);
-      }
-    }
-    private void TreeCheck(ISymbolicExpressionTree tree, double treeQuality) {
-      foreach (var treeNode in tree.IterateNodesPrefix().OfType<TreeModelTreeNode>()) {
-        SucsessStatistics[treeNode.TreeNumber][0] += 1;
-        SucsessStatistics[treeNode.TreeNumber][1] += treeQuality;
-      }
-    }
-    #endregion
-    #region MapApplayFunctions
-    public override ISymbolicExpressionTree NewModelForMutation(IRandom random, out int treeNumber, int parentTreeNumber) {
-      treeNumber = Map[HelpFunctions.OneElementFromListProportionalSelection(random, Probabilities)][0];
-      return (ISymbolicExpressionTree)ModelSet[treeNumber].Clone();
-    }
-    override public ISymbolicExpressionTree NewModelForInizializtionNotTree(IRandom random, out int treeNumber) {
-      return NewModelForInizializtion(random, out treeNumber);
-    }
-    #endregion
-  }
-}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMZeroMap.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMZeroMap.cs	(revision 17002)
+++ 	(revision )
@@ -1,55 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2019 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 HEAL.Attic;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using System.Collections.Generic;
-
-namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [Item("ZeroMap", "A map of models of models of models")]
-  [StorableType("FF199AE7-DF0A-4E2A-99BC-BECD647E18F0")]
-  public class EMMZeroMap : EMMMapBase<ISymbolicExpressionTree> {
-    #region conctructors
-    [StorableConstructor]
-    protected EMMZeroMap(StorableConstructorFlag _) : base(_) { }
-    public EMMZeroMap() {
-      ModelSet = new List<ISymbolicExpressionTree>();
-    }
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new EMMZeroMap(this, cloner);
-    }
-    public EMMZeroMap(EMMZeroMap original, Cloner cloner) : base(original, cloner) { }
-    #endregion
-    #region MapApplayFunctions
-    override public void CreateMap(IRandom random, int k) { }
-    override public ISymbolicExpressionTree NewModelForInizializtionNotTree(IRandom random, out int treeNumber) {
-      return NewModelForInizializtion(random, out treeNumber);
-    }
-    public override ISymbolicExpressionTree NewModelForMutation(IRandom random, out int treeNumber, int parentTreeNumber) {
-      treeNumber = random.Next(ModelSet.Count);
-      return (ISymbolicExpressionTree)ModelSet[treeNumber].Clone();
-    }
-    #endregion
-
-  }
-}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/FileComuncations.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/FileComuncations.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/FileComuncations.cs	(revision 17134)
@@ -0,0 +1,135 @@
+﻿using HEAL.Attic;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  class FileComuncations {
+    public static void DoubleMatrixPrint(string fileName, double[,] matrix, int size) {
+      using (var sw = new StreamWriter(fileName)) {
+        for (int i = 0; i < size; i++) {
+          for (int j = 0; j < size; j++) {
+            sw.Write($"{matrix[i, j]}");
+            if (j < size - 1)
+              sw.Write(" ");
+          }
+          sw.WriteLine();
+        }
+      }
+    }
+    public static void DoubleMatrixPrint(string fileName, DoubleMatrix matrix) {
+      using (var sw = new StreamWriter(fileName)) {
+        for (int i = 0; i < matrix.Rows; i++) {
+          for (int j = 0; j < matrix.Columns; j++) {
+            sw.Write($"{matrix[i, j]}");
+            if (j < matrix.Columns - 1)
+              sw.Write(" ");
+          }
+          sw.WriteLine();
+        }
+      }
+    }
+    public static void DoubleMatrixPrint(string fileName, List<List<double>> matrix) {
+      using (var sw = new StreamWriter(fileName)) {
+        for (int i = 0; i < matrix.Count; i++) {
+          for (int j = 0; j < matrix[i].Count; j++) {
+            sw.Write($"{matrix[i][j]}");
+            if (j < matrix[i].Count - 1)
+              sw.Write(" ");
+          }
+          sw.WriteLine();
+        }
+      }
+    }
+    public static void DoubleMatrixSerialize(string fileName, double[,] matrix) {
+      var obj = new DoubleMatrix(matrix);
+      var proto = new ProtoBufSerializer();
+      proto.Serialize(obj, fileName);
+    }
+    public static void IntMatrixSerialize(string fileName, int[,] matrix) {
+      var obj = new IntMatrix(matrix);
+      var proto = new ProtoBufSerializer();
+      proto.Serialize(obj, fileName);
+    }
+    public static void IntMatrixSerialize(string fileName, IntMatrix matrix) {
+      var proto = new ProtoBufSerializer();
+      proto.Serialize(matrix, fileName);
+    }
+    public static void DoubleMatrixSerialize(string fileName, DoubleMatrix matrix) {
+      var proto = new ProtoBufSerializer();
+      proto.Serialize(matrix, fileName);
+    }
+    public static double[,] DoubleMatrixDeserialize(string fileName) {
+      var proto = new ProtoBufSerializer();
+      var m = (DoubleMatrix)proto.Deserialize(fileName);
+      double[,] matrix = m.CloneAsMatrix();
+      return matrix;
+    }
+    public static int[,] IntFromDeserialize(string fileName, int size) {
+      var proto = new ProtoBufSerializer();
+      var m = (IntMatrix)proto.Deserialize(fileName);
+      int[,] matrix = m.CloneAsMatrix();
+      return matrix;
+    }
+    public static List<List<int>> IntMatrixFromFileRead(string fileName) {
+      string input = File.ReadAllText(fileName);
+      var temp = new List<List<int>>();
+      int i = 0;
+      foreach (var row in input.Split('\n')) {
+        temp.Add(new List<int>());
+        foreach (var col in row.Trim().Split(' ')) {
+          temp[i].Add(int.Parse(col.Trim()));
+        }
+        i++;
+      }
+      return temp;
+    }
+    public static List<List<double>> DoubleMatrixFromFileRead(string fileName) {
+      string input = File.ReadAllText(fileName);
+      var temp = new List<List<double>>();
+      int i = 0;
+      foreach (var row in input.Split('\n')) {
+        temp.Add(new List<double>());
+        foreach (var col in row.Trim().Split(' ')) {
+          temp[i].Add(double.Parse(col.Trim()));
+        }
+        i++;
+      }
+      return temp;
+    }
+    public static double[,] DoubleMatrixFromFileRead(string fileName, int size) {
+      var matrix = new double[size, size];
+      string input = File.ReadAllText(fileName);
+      int i = 0, j = 0;
+      foreach (var row in input.Split('\n')) {
+        foreach (var col in row.Trim().Split(' ')) {
+          matrix[i, j] = double.Parse(col.Trim());
+          j++;
+        }
+        i++;
+      }
+      return matrix;
+    }
+    public static void TreesEvoluationResultsToTxtFile(ISymbolicDataAnalysisSingleObjectiveProblem problem, List<ISymbolicExpressionTree> trees) {
+      var problemData = problem.ProblemData;
+      var dataset = problemData.Dataset;
+      var rows = problemData.TrainingIndices;
+      var interpreter = problem.SymbolicExpressionTreeInterpreter;
+      string[] toWrite = new string[trees.Count()];
+      int i = 0;
+      foreach (var tree in trees) {
+        var estimatedValues = interpreter.GetSymbolicExpressionTreeValues(tree, dataset, rows);
+        string str = "";
+        foreach (var value in estimatedValues) {
+          str += value.ToString() + " ";
+        }
+        toWrite[i] = str;
+        i++;
+      }
+      File.WriteAllLines("evolv.txt", toWrite);
+    }
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/HelpFunctions.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/HelpFunctions.cs	(revision 17002)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/HelpFunctions.cs	(revision 17134)
@@ -20,4 +20,7 @@
 #endregion
 using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using HeuristicLab.Random;
 using System.Collections.Generic;
 using System.Linq;
@@ -85,29 +88,14 @@
       return maxElementNumber;
     }
-    public static double CheckSocialKatre(double socialKarteValue, double value, double stepValue) {
-      if (value > (socialKarteValue + stepValue))
-        return stepValue;
-      else if (value > socialKarteValue)
-        return (value - socialKarteValue);
-      else return 0;
-    }
-    public static void ProbabilitiesUpDate(List<List<double>> sucsessStatistics, List<double> probabilities) {
 
-      var averageQuality = new List<double>();
-      foreach (var variant in sucsessStatistics) {
-        if (variant[0] > 0.005) {
-          averageQuality.Add(variant[1] / variant[0]);
-        } else { averageQuality.Add(0); }
+    public static void SetLocalParametersForTree(IRandom random, double shakingFactor, ISymbolicExpressionTree tree) {
+      foreach (var node in tree.IterateNodesPrefix().Where(x => x.HasLocalParameters)) {
+        if (node is VariableTreeNode variableTreeNode) {
+          var symbol = variableTreeNode.Symbol;
+          variableTreeNode.Weight = NormalDistributedRandom.NextDouble(random, symbol.WeightManipulatorMu, symbol.WeightManipulatorSigma);
+        } else {
+          node.ResetLocalParameters(random);
+        }
       }
-      int bestModelNumber = ChooseMaxElementIndex(averageQuality);
-      double socialKarte = 1.0 / (probabilities.Count * 20.0); // parameters of method
-      double stepValue = socialKarte / 5.0;
-      double totalChangeValue = 0, changeValue = 0;
-      for (int i = 0; i < probabilities.Count; i++) {
-        changeValue = CheckSocialKatre(socialKarte, probabilities[i], stepValue);
-        totalChangeValue += changeValue;
-        probabilities[i] -= changeValue;
-      }
-      probabilities[bestModelNumber] += totalChangeValue;
     }
   }
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/HeuristicLab.Algorithms.EvolvmentModelsOfModels.csproj
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/HeuristicLab.Algorithms.EvolvmentModelsOfModels.csproj	(revision 17002)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/HeuristicLab.Algorithms.EvolvmentModelsOfModels.csproj	(revision 17134)
@@ -117,22 +117,25 @@
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="EMMDisatanceMap.cs" />
-    <Compile Include="EMMMultyPointsMutator.cs" />
-    <Compile Include="EMMAlgorithm.cs" />
-    <Compile Include="EMMClustering.cs" />
-    <Compile Include="EMMBaseMap.cs" />
-    <Compile Include="EMMIslandMap.cs" />
-    <Compile Include="EMMMultyPointsMutatorNodeTypeSaving.cs" />
-    <Compile Include="EMMMutators.cs" />
-    <Compile Include="EMMSolution.cs" />
-    <Compile Include="EMMBaseAlgorithm.cs" />
-    <Compile Include="EMMNetworkMap.cs" />
-    <Compile Include="EMMSucsessMap.cs" />
-    <Compile Include="EMMZeroMap.cs" />
+    <Compile Include="FileComuncations.cs" />
+    <Compile Include="Maps\EMMDistanceMap.cs" />
+    <Compile Include="EMMOperators\EMMMultyPointsMutator.cs" />
+    <Compile Include="EMMAlgorithm\EMMAlgorithm.cs" />
+    <Compile Include="KMeansClusterizationAlgorithm.cs" />
+    <Compile Include="Maps\EMMBaseMap.cs" />
+    <Compile Include="Maps\EMMIslandMap.cs" />
+    <Compile Include="EMMOperators\EMMMultyPointsMutatorNodeTypeSaving.cs" />
+    <Compile Include="EMMOperators\EMMMutators.cs" />
+    <Compile Include="EMMAlgorithm\EMMSolution.cs" />
+    <Compile Include="EMMAlgorithm\EMMBaseAlgorithm.cs" />
+    <Compile Include="Maps\EMMNetworkMap.cs" />
+    <Compile Include="Maps\EMMSucsessMap.cs" />
+    <Compile Include="Maps\EMMZeroMap.cs" />
     <Compile Include="HelpFunctions.cs" />
-    <Compile Include="ModelClustersFrequencyAnalyzer.cs" />
+    <Compile Include="Analyzers\ModelClustersFrequencyAnalyzer.cs" />
+    <Compile Include="ModelSetPreporation.cs" />
     <Compile Include="Plugin.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="EMMRankMap.cs" />
+    <Compile Include="Maps\EMMRankMap.cs" />
+    <Compile Include="SelfConfiguration.cs" />
   </ItemGroup>
   <ItemGroup>
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/KMeansClusterizationAlgorithm.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/KMeansClusterizationAlgorithm.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/KMeansClusterizationAlgorithm.cs	(revision 17134)
@@ -0,0 +1,137 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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.Core;
+using System;
+using System.Collections.Generic;
+
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  public class KMeansClusterizationAlgorithm {
+    public int K { get; private set; }
+    public KMeansClusterizationAlgorithm() {
+    }
+    public KMeansClusterizationAlgorithm(int k) {
+      K = k;
+    }
+    public KMeansClusterizationAlgorithm(KMeansClusterizationAlgorithm old) {
+      this.K = old.K;
+    }
+    public int Apply(IRandom random, double[,] distances, List<int> numberCluster) {
+
+      K = ApplyClusteringAlgorithm(random, distances, numberCluster, K);
+      return K;
+    }
+
+    public static int ApplyClusteringAlgorithm(IRandom random, double[,] distances, List<int> numberCluster, int k) {
+      int mapSize = distances.GetLength(0);
+      List<int> centroids = new List<int>(); // capacity is equal K
+      List<double> averageClusterDistance = new List<double>();
+      List<List<int>> clusters = new List<List<int>>(); // capacity is equal K
+      CentroidsRandomSetUp(random, centroids, mapSize, k);
+      if (numberCluster.Count == 0) {
+        for (int i = 0; i < mapSize; i++) {
+          numberCluster.Add(0);
+        }
+      }
+      bool flag = true;
+      int count = 0;
+      while (flag&&(count<1000)) {
+        clusters.Clear();
+        for (int i = 0; i < k; i++) {
+          clusters.Add(new List<int>());
+
+        }
+        for (int i = 0; i < mapSize; i++) {
+          numberCluster[i] = LookCloseCentroid(centroids, distances, i, k);
+          clusters[numberCluster[i]].Add(i);
+        }
+        k = NullSizeClusterDelete(centroids, clusters, mapSize, numberCluster, k);
+        flag = false;
+        for (int i = 0; i < k; i++) {
+          AverageClusterDistanceCalculation(averageClusterDistance, distances, numberCluster, mapSize, i);
+          var newCentroid = clusters[i][HelpFunctions.ChooseMinElementIndex(averageClusterDistance)];
+          if (newCentroid != centroids[i]) {
+            flag = true;
+            centroids[i] = newCentroid;
+          }
+          averageClusterDistance.Clear();
+        }
+        count++;
+      }
+      return k;
+    }
+    private static void CentroidsRandomSetUp(IRandom random, List<int> centroids, int size, int k) {
+      for (int i = 0; i < k; i++) {
+        centroids.Add(random.Next(size));
+      }
+    }
+    private static int LookCloseCentroid(List<int> centroids, double[,] distances, int currentNumber, int k) {
+      double minDistanse = distances[currentNumber, centroids[0]];
+      int clusterNum = 0;
+      for (int i = 1; i < k; i++) {
+        if (minDistanse > distances[currentNumber, centroids[i]]) {
+          minDistanse = distances[currentNumber, centroids[i]];
+          clusterNum = i;
+        }
+      }
+      return clusterNum;
+    }
+    private static int NullSizeClusterDelete(List<int> centroids, List<List<int>> clusters, int mapSize, List<int> numberCluster, int k) {
+      int iter = 0;
+      for (int i = 0; i < k; i++) {
+        if (clusters[i - iter].Count == 0) {
+          for (int j = 0; j < mapSize; j++) {
+            if (numberCluster[j] > (i - iter))
+              numberCluster[j]--;
+          }
+
+          for (int j = 0; j < k - iter; j++) {
+            if (j != i - iter) {
+              for (int m = 0; m < clusters[j].Count; m++)
+                if (clusters[j][m] > (i - iter))
+                  (clusters[j][m])--;
+            }
+          }
+          clusters.Remove(clusters[i - iter]);
+          centroids.Remove(centroids[i - iter]);
+          iter++;
+        }
+      }
+      k -= iter;
+      return k;
+    }
+    public static void AverageClusterDistanceCalculation(List<double> averageClusterDistance, double[,] distances, List<int> numberCluster, int MapSize, int currentClusterNumber) {
+      int m = 0;
+      for (int i = 0; i < MapSize; i++) {
+        if (numberCluster[i] == currentClusterNumber) {
+          averageClusterDistance.Add(0);
+          for (int j = 0; j < MapSize; j++) {
+            if (numberCluster[j] == currentClusterNumber)
+              averageClusterDistance[m] += Math.Abs(distances[i, j]);
+          }
+          m++;
+        }
+      }
+    }
+
+
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMBaseMap.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMBaseMap.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMBaseMap.cs	(revision 17134)
@@ -0,0 +1,183 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  [StorableType("83CF9650-98FF-454B-9072-82EA4D39C752")]
+  public abstract class EMMMapBase<T> : ParameterizedNamedItem where T : class {
+    #region data members
+    [Storable]
+    public List<T> ModelSet { get; protected set; }
+    [Storable]
+    public List<List<int>> Map { get; set; }
+    public string DistanceParametr { get; set; }
+    #endregion
+    #region constructors
+    [StorableConstructor]
+    protected EMMMapBase(StorableConstructorFlag _) : base(_) { }
+    public EMMMapBase() {
+      Map = new List<List<int>>();
+      DistanceParametr = "Symbolic";
+    }
+    public EMMMapBase(EMMMapBase<T> original, Cloner cloner) : base(original, cloner) {
+      if (original.ModelSet != null) {
+        if (original.ModelSet is List<ISymbolicExpressionTree> originalSet && ModelSet is List<ISymbolicExpressionTree> set)
+          set = originalSet.Select(cloner.Clone).ToList();
+        else ModelSet = original.ModelSet.ToList(); /// check this if you want to use it
+      }
+      if (original.Map != null) {
+        Map = original.Map.Select(x => x.ToList()).ToList();
+      }
+      DistanceParametr = original.DistanceParametr;
+    }
+    #endregion
+    #region map creation functions
+
+    public abstract void CreateMap(IRandom random);
+    public void MapCreationPrepare(IEnumerable<T> trees) {
+      ModelSet = trees.ToList();
+    }
+    public virtual void CreateMap(IRandom random, ISymbolicDataAnalysisSingleObjectiveProblem problem) {
+      if (Map != null) {
+        Map.Clear();
+      }
+      CreateMap(random);
+    }
+    public virtual void CreateMap(IRandom random, double[,] totalDistance) {
+      if (Map != null) {
+        Map.Clear();
+      }
+      CreateMap(random);
+    }
+
+    protected void MapSizeCheck(int k) {
+      if (Map != null) Map.Clear();
+      else Map = new List<List<int>>();
+      if (Map.Count != k) {
+        if (Map.Count != 0) {
+          Map.Clear();
+        }
+        for (int i = 0; i < k; i++) {
+          Map.Add(new List<int>());
+        }
+      }
+    }
+    #endregion
+    #region map and files
+    public virtual void MapRead(IEnumerable<T> trees) {
+      ModelSet = trees.ToList();
+    }
+    public void WriteMapToTxtFile(IRandom random) {
+      string s = random.NextDouble().ToString();
+      string fileName = "MapToAnalize";
+      fileName += s;
+      fileName += DistanceParametr;
+      fileName += ".txt";
+      File.WriteAllLines(fileName, MapToString());
+      string fileName2 = "MapToSee";
+      fileName2 += s;
+      fileName2 += DistanceParametr;
+      fileName2 += ".txt";
+      File.WriteAllLines(fileName2, MapToSee());
+      string fileName3 = "Map";
+      fileName3 += DistanceParametr;
+      fileName3 += ".txt";
+      File.WriteAllLines(fileName3, MapToStoreInFile());
+    }
+    public string[] MapToString() { // Function that prepare Map to printing in .txt File: create a set of strings for future analyzing
+      string[] s;
+      s = new string[Map.Count];
+      for (int i = 0; i < Map.Count; i++) {
+        s[i] = i.ToString() + ": ";
+        for (int j = 0; j < Map[i].Count; j++) {
+          s[i] += Map[i][j].ToString();
+          s[i] += " ";
+        }
+        if (this is EMMIslandMap island) {
+          s[i] += "  Average distance:" + island.AverageDistance[i].ToString();
+        }
+      }
+      return s;
+    }
+    public virtual string[] MapToStoreInFile() { // Function that prepare Map to printing in .txt File: create a set of strings for future reading by computer
+      string[] s;
+      s = new string[Map.Count];
+      for (int i = 0; i < Map.Count; i++) {
+        s[i] = "";
+        for (int j = 0; j < Map[i].Count; j++) {
+          s[i] += Map[i][j].ToString();
+          if (j != (Map[i].Count - 1)) { s[i] += " "; }
+        }
+      }
+      return s;
+    }
+    public string[] MapToSee() { // Function that prepare Map to printing in .txt File: create a set of strings in human readable view
+      var fmt = new InfixExpressionFormatter();
+      string[] s;
+      s = new string[(ModelSet.Count) + 1];
+      s[0] = "ClusterNumber" + "," + "ModelNumber" + "," + "Model";
+      for (int i = 1; i < ((ModelSet.Count) + 1); i++) {
+        s[i] = "";
+        if (this is EMMIslandMap island) {
+          s[i] += island.ClusterNumber[i - 1].ToString() + ",";
+        }
+        s[i] += (i - 1).ToString() + ",";
+        if (ModelSet[i - 1] is ISymbolicExpressionTree model) {
+          s[i] += fmt.Format(model);
+        } else { s[i] += ModelSet[i - 1].ToString(); }
+      }
+      return s;
+    }
+    #endregion
+
+    #region map use functions
+    public abstract T NewModelForInizializtionNotTree(IRandom random, out int treeNumber);
+    public ISymbolicExpressionTree NewModelForInizializtion(IRandom random, out int treeNumber) {
+      treeNumber = random.Next(ModelSet.Count);
+      if (ModelSet[treeNumber] is ISymbolicExpressionTree model)
+        return (ISymbolicExpressionTree)(model.Clone());
+      return new SymbolicExpressionTree();
+    }
+    public void NodeManipulationForInizializtion(IRandom random, TreeModelTreeNode node) {
+      node.Tree = NewModelForInizializtion(random, out int treeNumber);
+      node.SetLocalParameters(random, 0.5);
+      node.TreeNumber = treeNumber;
+    }
+    public abstract ISymbolicExpressionTree NewModelForMutation(IRandom random, out int treeNumber, int parentTreeNumber);
+    public virtual void NodeForMutationChange(IRandom random, TreeModelTreeNode treeNode) {
+      int treeNumber = treeNode.TreeNumber;
+      int treeNumber2 = treeNode.TreeNumber;
+      treeNode.Tree = new SymbolicExpressionTree(NewModelForMutation(random, out treeNumber, treeNumber2).Root);
+      treeNode.TreeNumber = treeNumber;
+      HelpFunctions.SetLocalParametersForTree(random, 0.5, treeNode.Tree);
+    }
+    public virtual void MapUpDate(Dictionary<ISymbolicExpressionTree, double> population) { }
+    #endregion
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMDistanceMap.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMDistanceMap.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMDistanceMap.cs	(revision 17134)
@@ -0,0 +1,122 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  [Item("DistanceMap", "A map of models of models of models")]
+  [StorableType("456692FB-2149-4359-8106-45D59D2D7FA0")]
+  public class EMMDisatanceMap : EMMMapBase<ISymbolicExpressionTree> {
+    [Storable]
+    public List<List<double>> Probabilities { get; set; }
+    #region constructors
+    [StorableConstructor]
+    protected EMMDisatanceMap(StorableConstructorFlag _) : base(_) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EMMDisatanceMap(this, cloner);
+    }
+    public EMMDisatanceMap() : base() {
+      ModelSet = new List<ISymbolicExpressionTree>();
+      Probabilities = new List<List<double>>();
+    }
+    public EMMDisatanceMap(EMMDisatanceMap original, Cloner cloner) : base(original, cloner) {
+      if (original.Probabilities != null) {
+        Probabilities = original.Probabilities.Select(x => x.ToList()).ToList();
+      }
+    }
+    #endregion
+    #region Map Creation
+    override public void CreateMap(IRandom random) {
+      MapSizeCheck(ModelSet.Count);
+      ApplyDistanceMapCreationAlgorithm(random, ModelSetPreparation.CalculateDistances(ModelSet), Map, Probabilities);
+    }
+    override public string[] MapToStoreInFile() { // Function that prepare Map to printing in .txt File: create a set of strings for future reading by computer
+      string[] s;
+      s = new string[Map.Count];
+      for (int i = 0; i < Map.Count; i++) {
+        s[i] = "";
+        for (int j = 0; j < (Map.Count - 1); j++) {
+          s[i] += Probabilities[i][j].ToString();
+          if (j != (Map.Count - 2)) { s[i] += " "; }
+        }
+      }
+      return s;
+    }
+    override public void MapRead(IEnumerable<ISymbolicExpressionTree> trees) {
+      base.MapRead(trees);
+      MapFullment(trees.Count());
+      string fileName = ("Map" + DistanceParametr + ".txt");
+      Probabilities = FileComuncations.DoubleMatrixFromFileRead(fileName);
+    }
+    override public void CreateMap(IRandom random, ISymbolicDataAnalysisSingleObjectiveProblem problem) {
+      MapSizeCheck(ModelSet.Count);
+      if (Map != null) {
+        Map.Clear();
+      }
+      ApplyDistanceMapCreationAlgorithm(random, ModelSetPreparation.DistanceMatrixCalculation(ModelSet, DistanceParametr, problem), Map, Probabilities);
+    }
+    protected void ApplyDistanceMapCreationAlgorithm(IRandom random, double[,] distances, List<List<int>> map, List<List<double>> probabilities) {
+      int mapSize = distances.GetLength(0);
+      for (int t = 0; t < mapSize; t++) {
+        probabilities.Add(new List<double>());
+        double tempSum = 0;
+        for (int i = 0; i < mapSize; i++) {
+          tempSum += Math.Log(distances[i, t]);
+        }
+        for (int i = 0; i < mapSize; i++) {
+          if (distances[i, t].IsAlmost(0))
+            continue;
+          map[t].Add(i);
+          probabilities[t].Add(Math.Log(distances[i, t]) / tempSum);
+        }
+      }
+    }
+    protected void MapFullment(int mapSize) {
+      if (Map != null) {
+        Map.Clear();
+      }
+      for (int t = 0; t < mapSize; t++) {
+        for (int i = 0; i < mapSize; i++) {
+          if (i == t)
+            continue;
+          Map[t].Add(i);
+        }
+      }
+    }
+    #endregion
+    #region Map Apply Functions
+    public override ISymbolicExpressionTree NewModelForMutation(IRandom random, out int treeNumber, int parentTreeNumber) {
+      treeNumber = HelpFunctions.OneElementFromListProportionalSelection(random, Probabilities[parentTreeNumber]);
+      return (ISymbolicExpressionTree)ModelSet[treeNumber].Clone();
+    }
+    override public ISymbolicExpressionTree NewModelForInizializtionNotTree(IRandom random, out int treeNumber) {
+      return NewModelForInizializtion(random, out treeNumber);
+    }
+    #endregion
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMIslandMap.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMIslandMap.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMIslandMap.cs	(revision 17134)
@@ -0,0 +1,139 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using HeuristicLab.Random;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  [Item("IslandMap", "A map of models of models of models")]
+  [StorableType("E4AB04B9-FD5D-47EE-949D-243660754F3A")]
+  public class EMMIslandMap : EMMMapBase<ISymbolicExpressionTree> {
+
+    [Storable]
+    public List<int> ClusterNumber { get; set; }  // May be only Island Map really need it
+    public double[] AverageDistance { get; private set; }
+    private const string ClusterNumbersParameterName = "ClusterNumbers";
+    private const string ClusterNumbersShowParameterName = "ClusterNumbersShow";
+    public IValueParameter<IntValue> ClusterNumbersParameter {
+      get { return (IValueParameter<IntValue>)Parameters[ClusterNumbersParameterName]; }
+    }
+    public IValueParameter<IntValue> ClusterNumbersShowParameter {
+      get { return (IValueParameter<IntValue>)Parameters[ClusterNumbersShowParameterName]; }
+    }
+    public IntValue ClusterNumbers {
+      get { return ClusterNumbersParameter.Value; }
+      set { ClusterNumbersParameter.Value = value; }
+    }
+    public IntValue ClusterNumbersShow {
+      get { return ClusterNumbersShowParameter.Value; }
+      set { ClusterNumbersShowParameter.Value = value; }
+    }
+    #region constructors
+    [StorableConstructor]
+    protected EMMIslandMap(StorableConstructorFlag _) : base(_) { }
+    public EMMIslandMap() {
+      Parameters.Add(new ValueParameter<IntValue>(ClusterNumbersParameterName, "The number of clusters for model Map.", new IntValue(10)));
+      Parameters.Add(new ValueParameter<IntValue>(ClusterNumbersShowParameterName, "The number of clusters for model Map.", new IntValue(10)));
+      ModelSet = new List<ISymbolicExpressionTree>();
+      ClusterNumber = new List<int>();
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EMMIslandMap(this, cloner);
+    }
+    public EMMIslandMap(EMMIslandMap original, Cloner cloner) : base(original, cloner) {
+      if (original.ClusterNumber != null) {
+        ClusterNumber = original.ClusterNumber.ToList();
+      }
+    }
+    #endregion
+    #region Map Apply Functions
+    override public void CreateMap(IRandom random) {
+      var totalDistance = ModelSetPreparation.CalculateDistances(ModelSet); //structure distances
+      CreateMap(random, totalDistance);
+    }
+    override public void CreateMap(IRandom random, ISymbolicDataAnalysisSingleObjectiveProblem problem) {
+      CreateMap(random, ModelSetPreparation.TotalDistanceMatrixCalculation(random, problem, ModelSet, DistanceParametr));
+    }
+    override public void CreateMap(IRandom random, double[,] totalDistance) {
+      if (Map != null) {
+        Map.Clear();
+      }
+      ClusterNumbersShow.Value = KMeansClusterizationAlgorithm.ApplyClusteringAlgorithm(random, totalDistance, ClusterNumber, ClusterNumbers.Value);
+      MapSizeCheck(ClusterNumbersShow.Value);
+      for (int i = 0; i < ModelSet.Count; i++) {
+        Map[ClusterNumber[i]].Add(i);
+      }
+      AverageDistanceInClusterCalculation(totalDistance, ClusterNumbersShow.Value);
+    }
+    override public void MapRead(IEnumerable<ISymbolicExpressionTree> trees) {
+      base.MapRead(trees);
+      string fileName = ("Map" + DistanceParametr + ".txt");
+      Map = FileComuncations.IntMatrixFromFileRead(fileName);
+      ClusterNumbers.Value = Map.Count;
+      ClusterNumbersShow.Value = ClusterNumbers.Value;
+      ClusterNumbersCalculate();
+      AverageDistanceInClusterCalculation(ModelSetPreparation.CalculateDistances(ModelSet), Map.Count);
+    }
+    override public ISymbolicExpressionTree NewModelForInizializtionNotTree(IRandom random, out int treeNumber) {
+      return NewModelForInizializtion(random, out treeNumber);
+    }
+    private void AverageDistanceInClusterCalculation(double[,] distances, int k) {
+      AverageDistance = new double[k];
+      var temp = new List<double>();
+      for (int i = 0; i < k; i++) {
+        KMeansClusterizationAlgorithm.AverageClusterDistanceCalculation(temp, distances, ClusterNumber, ClusterNumber.Count, i);
+        var number = HelpFunctions.ChooseMinElementIndex(temp);
+        AverageDistance[i] = temp[number] / Map[i].Count;
+        temp.Clear();
+      }
+    }
+    public override ISymbolicExpressionTree NewModelForMutation(IRandom random, out int treeNumber, int parentTreeNumber) {
+      if (parentTreeNumber == -10) {
+        treeNumber = random.Next(ModelSet.Count);
+      } else {
+        treeNumber = Map[ClusterNumber[parentTreeNumber]].SampleRandom(random);
+      }
+      return (ISymbolicExpressionTree)ModelSet[treeNumber].Clone();
+    }
+    public void ClusterNumbersCalculate() {
+      for (int i = 0; i < Map.Count; i++) {
+        for (int j = 0; j < Map[i].Count; j++) {
+          ClusterNumber.Add(0);
+        }
+      }
+      for (int i = 0; i < Map.Count; i++) {
+        for (int j = 0; j < Map[i].Count; j++) {
+          ClusterNumber[Map[i][j]] = i;
+        }
+      }
+    }
+    #endregion
+
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMNetworkMap.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMNetworkMap.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMNetworkMap.cs	(revision 17134)
@@ -0,0 +1,123 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using HeuristicLab.Random;
+using System;
+using System.Collections.Generic;
+
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  [Item("NetworkMap", "A map of models of models of models")]
+  [StorableType("C200ECC2-6D33-4468-A538-580B07D75B3C")]
+  public class EMMNetworkMap : EMMMapBase<ISymbolicExpressionTree> {
+    private const string NegbourTypeParameterName = "NegbourType";
+    private const string NegbourNumberParameterName = "NegbourNumber";
+    public IFixedValueParameter<StringValue> NegbourTypeParameter {
+      get { return (IFixedValueParameter<StringValue>)Parameters[NegbourTypeParameterName]; }
+    }
+    public IValueParameter<IntValue> NegbourNumberParameter {
+      get { return (IValueParameter<IntValue>)Parameters[NegbourNumberParameterName]; }
+    }
+    public StringValue NegbourType {
+      get { return NegbourTypeParameter.Value; }
+      set { NegbourTypeParameter.Value.Value = value.Value; }
+    }
+    public IntValue NegbourNumber {
+      get { return NegbourNumberParameter.Value; }
+      set { NegbourNumberParameter.Value.Value = value.Value; }
+    }
+    #region constructors
+    [StorableConstructor]
+    protected EMMNetworkMap(StorableConstructorFlag _) : base(_) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EMMNetworkMap(this, cloner);
+    }
+    public EMMNetworkMap() : base() {
+      Parameters.Add(new ValueParameter<IntValue>(NegbourNumberParameterName, "The parameter for FullMap type of map creation algorithm. Use one from: 10, 20.", new IntValue(10)));
+      Parameters.Add(new FixedValueParameter<StringValue>(NegbourTypeParameterName, "The parameter for FullMap type of map creation algorithm. Use one from: Percent, Number.", new StringValue("Number")));
+      MapParameterUpdate();
+      ModelSet = new List<ISymbolicExpressionTree>();
+    }
+    public EMMNetworkMap(EMMNetworkMap original, Cloner cloner) : base(original, cloner) { NegbourNumber = original.NegbourNumber; }
+    #endregion
+    #region Map Transformation
+    override public void CreateMap(IRandom random) {
+      MapParameterUpdate();
+      if (Map != null) {
+        Map.Clear();
+      }
+      ApplyNetworkMapCreationAlgorithm(random, ModelSetPreparation.CalculateDistances(ModelSet), Map, NegbourNumber.Value);
+    }
+    override public void CreateMap(IRandom random, ISymbolicDataAnalysisSingleObjectiveProblem problem) {
+      MapParameterUpdate();
+      if (Map != null) {
+        Map.Clear();
+      }
+      ApplyNetworkMapCreationAlgorithm(random, ModelSetPreparation.DistanceMatrixCalculation(ModelSet, DistanceParametr, problem), Map, NegbourNumber.Value);
+    }
+    override public void MapRead(IEnumerable<ISymbolicExpressionTree> trees) {
+      base.MapRead(trees);
+      string fileName = ("Map" + DistanceParametr + ".txt");
+      Map = FileComuncations.IntMatrixFromFileRead(fileName);
+      NegbourNumber.Value = Map[0].Count;
+    }
+    public static void ApplyNetworkMapCreationAlgorithm(IRandom random, double[,] distances, List<List<int>> map, int neghboorNumber = 10) {
+      int mapSize = distances.GetLength(0);
+      List<double> currentList = new List<double>();
+      for (int i = 0; i < mapSize; i++) {
+        map.Add(new List<int>());
+        for (int j = 0; j < mapSize; j++) {
+          currentList.Add(distances[i, j]);
+        }
+        map[i].Add(HelpFunctions.ChooseMinElementIndex(currentList));
+        while (map[i].Count < neghboorNumber) {
+          map[i].Add(HelpFunctions.ChooseMinElementIndex(currentList, i, map[i]));
+        }
+        currentList.Clear();
+      }
+    }
+    protected void MapParameterUpdate() {
+      switch (NegbourType.Value) {
+        case "Percent": NegbourNumber.Value = Convert.ToInt32((Convert.ToDouble(ModelSet.Count)) * (Convert.ToDouble(NegbourNumber.Value)) / 100.0); break;
+        case "Number": NegbourNumber.Value = NegbourNumber.Value; break;
+        default: NegbourNumber.Value = NegbourNumber.Value; break;
+      }
+    }
+    #endregion
+    #region Dialog with surroundings
+    public override ISymbolicExpressionTree NewModelForMutation(IRandom random, out int treeNumber, int parentTreeNumber) {
+      treeNumber = Map[parentTreeNumber].SampleRandom(random);
+      return (ISymbolicExpressionTree)ModelSet[treeNumber].Clone();
+    }
+    override public ISymbolicExpressionTree NewModelForInizializtionNotTree(IRandom random, out int treeNumber) {
+      var newTree = NewModelForInizializtion(random, out treeNumber);
+      return newTree;
+    }
+    #endregion
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMRankMap.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMRankMap.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMRankMap.cs	(revision 17134)
@@ -0,0 +1,132 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  [Item("RankMap", "A map of models of models of models")]
+  [StorableType("1D4DD90E-553A-46DB-B0CD-6A899AA0B6D0")]
+  public class EMMRankMap : EMMMapBase<ISymbolicExpressionTree> { // it do not work absolutely
+    [Storable]
+    public List<List<double>> Probabilities { get; set; }
+    #region constructors
+    [StorableConstructor]
+    protected EMMRankMap(StorableConstructorFlag _) : base(_) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EMMRankMap(this, cloner);
+    }
+    public EMMRankMap() : base() {
+      ModelSet = new List<ISymbolicExpressionTree>();
+      Probabilities = new List<List<double>>();
+    }
+    public EMMRankMap(EMMRankMap original, Cloner cloner) : base(original, cloner) {
+      if (original.Probabilities != null) {
+        Probabilities = original.Probabilities.Select(x => x.ToList()).ToList();
+      }
+    }
+    #endregion
+    #region MapCreation
+    override public void CreateMap(IRandom random) {
+      MapSizeCheck(ModelSet.Count);
+      ApplyRankMapCreationAlgorithm(ModelSetPreparation.CalculateDistances(ModelSet), Map, Probabilities);
+    }
+    override public void CreateMap(IRandom random, ISymbolicDataAnalysisSingleObjectiveProblem problem) {
+      MapSizeCheck(ModelSet.Count);
+      ApplyRankMapCreationAlgorithm(ModelSetPreparation.DistanceMatrixCalculation(ModelSet, DistanceParametr, problem), Map, Probabilities);
+    }
+    override public void MapRead(IEnumerable<ISymbolicExpressionTree> trees) {
+      base.MapRead(trees);
+      MapFullment(trees.Count());
+      string fileName = ("Map" + DistanceParametr + ".txt");
+      Probabilities = FileComuncations.DoubleMatrixFromFileRead(fileName);
+    }
+    protected void MapFullment(int mapSize) {
+      if (Map != null) {
+        Map.Clear();
+      }
+      for (int t = 0; t < mapSize; t++) {
+        for (int i = 0; i < mapSize; i++) {
+          if (i == t)
+            continue;
+          Map[t].Add(i);
+        }
+      }
+    }
+    override public string[] MapToStoreInFile() { // Function that prepare Map to printing in .txt File: create a set of strings for future reading by computer
+      string[] s;
+      s = new string[Map.Count];
+      for (int i = 0; i < Map.Count; i++) {
+        s[i] = "";
+        for (int j = 0; j < (Map.Count - 1); j++) {
+          s[i] += Probabilities[i][j].ToString();
+          if (j != (Map.Count - 2)) { s[i] += " "; }
+        }
+      }
+      return s;
+    }
+    public static void ApplyRankMapCreationAlgorithm(double[,] distances, List<List<int>> map, List<List<double>> probabilities) {
+      int mapSize = distances.GetLength(0);
+      double tempSum = 0;
+      for (int i = 0; i < mapSize; i++) {
+        tempSum += i;
+      }
+      List<List<double>> currentList = new List<List<double>>();
+      for (int t = 0; t < mapSize; t++) {
+        for (int i = 0; i < mapSize; i++) {
+          if (distances[i, t].IsAlmost(0))
+            continue;
+          currentList.Add(new List<double>());
+          currentList[i].Add(i);
+          currentList[i].Add(distances[i, t]);
+        }
+        currentList.Sort((a, b) => a[1].CompareTo(b[1])); ///workable sorting
+        for (int i = 0; i < currentList.Count; i++) {
+          currentList[i].Add(currentList.Count - i);
+        }
+        probabilities.Add(new List<double>());
+        for (int i = 0; i < mapSize; i++) {
+          if (distances[i, t].IsAlmost(0))
+            continue;
+          map[t].Add(Convert.ToInt32(currentList[i][0]));
+          probabilities[t].Add(currentList[i][2] / tempSum);
+        }
+        currentList.Clear();
+      }
+    }
+    #endregion
+    #region Map Apply Functions
+    public override ISymbolicExpressionTree NewModelForMutation(IRandom random, out int treeNumber, int parentTreeNumber) {
+      treeNumber = Map[parentTreeNumber][HelpFunctions.OneElementFromListProportionalSelection(random, Probabilities[parentTreeNumber])];
+      return (ISymbolicExpressionTree)ModelSet[treeNumber].Clone();
+    }
+    override public ISymbolicExpressionTree NewModelForInizializtionNotTree(IRandom random, out int treeNumber) {
+      return NewModelForInizializtion(random, out treeNumber);
+    }
+    #endregion
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMSucsessMap.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMSucsessMap.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMSucsessMap.cs	(revision 17134)
@@ -0,0 +1,90 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using System.Collections.Generic;
+
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  [Item("SucsessMap", "A map of models of models of models")]
+  [StorableType("3880BA82-4CB0-4838-A17A-823E91BC046C")]
+  public class EMMSucsessMap : EMMMapBase<ISymbolicExpressionTree> {
+    [Storable]
+    public SelfConfiguration SelfConfigurationMechanism { get; private set; }
+    #region constructors
+    [StorableConstructor]
+    protected EMMSucsessMap(StorableConstructorFlag _) : base(_) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EMMSucsessMap(this, cloner);
+    }
+    public EMMSucsessMap() : base() {
+      ModelSet = new List<ISymbolicExpressionTree>();
+      SelfConfigurationMechanism = new SelfConfiguration();
+    }
+    public EMMSucsessMap(EMMSucsessMap original, Cloner cloner) : base(original, cloner) {
+      SelfConfigurationMechanism = new SelfConfiguration(original.SelfConfigurationMechanism, cloner);
+    }
+    #endregion
+    #region Map Creation
+    override public void CreateMap(IRandom random) {
+      if (Map != null) {
+        Map.Clear();
+      }
+      Map.Add(new List<int>());
+      MapSizeCheck(ModelSet.Count);
+      ApplySucsessMapCreationAlgorithm(random, ModelSet.Count);
+    }
+    override public void MapRead(IEnumerable<ISymbolicExpressionTree> trees) {
+      base.MapRead(trees);
+      string fileName = ("Map" + DistanceParametr + ".txt");
+      SelfConfigurationMechanism.ReadFromFile(ModelSet.Count, fileName);
+    }
+    override public string[] MapToStoreInFile() { // Function that prepare Map to printing in .txt File: create a set of strings for future reading by computer
+      string[] s;
+      s = new string[1];
+      for (int i = 0; i < Map.Count; i++) {
+        s[0] = "";
+        s[0] += SelfConfigurationMechanism.Probabilities[i].ToString();
+      }
+      return s;
+    }
+    private void ApplySucsessMapCreationAlgorithm(IRandom random, int mapSize) {
+      for (int t = 0; t < mapSize; t++) {
+        Map[t].Add(t);
+      }
+      SelfConfigurationMechanism.Initialization(mapSize);
+    }
+    public override void MapUpDate(Dictionary<ISymbolicExpressionTree, double> population) {
+      SelfConfigurationMechanism.UpDate(population);
+    }
+    #endregion
+    #region Map Apply Functions
+    public override ISymbolicExpressionTree NewModelForMutation(IRandom random, out int treeNumber, int parentTreeNumber) {
+      treeNumber = Map[SelfConfigurationMechanism.Aplay(random)][0];
+      return (ISymbolicExpressionTree)ModelSet[treeNumber].Clone();
+    }
+    override public ISymbolicExpressionTree NewModelForInizializtionNotTree(IRandom random, out int treeNumber) {
+      return NewModelForInizializtion(random, out treeNumber);
+    }
+    #endregion
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMZeroMap.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMZeroMap.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Maps/EMMZeroMap.cs	(revision 17134)
@@ -0,0 +1,55 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2019 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 HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using System.Collections.Generic;
+
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  [Item("ZeroMap", "A map of models of models of models")]
+  [StorableType("FF199AE7-DF0A-4E2A-99BC-BECD647E18F0")]
+  public class EMMZeroMap : EMMMapBase<ISymbolicExpressionTree> {
+    #region constructors
+    [StorableConstructor]
+    protected EMMZeroMap(StorableConstructorFlag _) : base(_) { }
+    public EMMZeroMap() {
+      ModelSet = new List<ISymbolicExpressionTree>();
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new EMMZeroMap(this, cloner);
+    }
+    public EMMZeroMap(EMMZeroMap original, Cloner cloner) : base(original, cloner) { }
+    #endregion
+    #region Map Apply Functions
+    override public void CreateMap(IRandom random) { }
+    override public ISymbolicExpressionTree NewModelForInizializtionNotTree(IRandom random, out int treeNumber) {
+      return NewModelForInizializtion(random, out treeNumber);
+    }
+    public override ISymbolicExpressionTree NewModelForMutation(IRandom random, out int treeNumber, int parentTreeNumber) {
+      treeNumber = random.Next(ModelSet.Count);
+      return (ISymbolicExpressionTree)ModelSet[treeNumber].Clone();
+    }
+    #endregion
+
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/ModelClustersFrequencyAnalyzer.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/ModelClustersFrequencyAnalyzer.cs	(revision 17002)
+++ 	(revision )
@@ -1,168 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2019 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 HEAL.Attic;
-using HeuristicLab.Algorithms.EvolvmentModelsOfModels;
-using HeuristicLab.Analysis;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Optimization;
-using HeuristicLab.Parameters;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  /// <summary>
-  /// Calculates the accumulated frequencies of variable-symbols over all trees in the population.
-  /// </summary>
-  [Item("SymbolicDataAnalysisModelClustersFrequencyAnalyzer", "Calculates the accumulated frequencies of Model Clusters over all trees in the population.")]
-  [StorableType("4755115D-1B73-4577-BA2A-A762AE4C3B2F")]
-  public sealed class ModelClustersFrequencyAnalyzer : SymbolicDataAnalysisAnalyzer {
-    private const string ModelClustersFrequencyParameterName = "ModelClustersFrequency";
-    private const string AggregateModelClustersParameterName = "AggregateModelClusters";
-
-    #region parameter properties
-    private const string MapParameterName = "Map";
-    public ILookupParameter<DataTable> ModelClustersFrequencyParameter {
-      get { return (ILookupParameter<DataTable>)Parameters[ModelClustersFrequencyParameterName]; }
-    }
-    public IValueLookupParameter<BoolValue> AggregateModelClustersParameter {
-      get { return (IValueLookupParameter<BoolValue>)Parameters[AggregateModelClustersParameterName]; }
-    }
-    public ILookupParameter<EMMMapBase<ISymbolicExpressionTree>> MapParameter {
-      get { return (ILookupParameter<EMMMapBase<ISymbolicExpressionTree>>)Parameters[MapParameterName]; }
-    }
-
-    #endregion
-    #region properties
-    public BoolValue AggregateModelClusters {
-      get { return AggregateModelClustersParameter.ActualValue; }
-      set { AggregateModelClustersParameter.Value = value; }
-    }
-    public DataTable ModelClustersFrequency {
-      get { return ModelClustersFrequencyParameter.ActualValue; }
-      set { ModelClustersFrequencyParameter.ActualValue = value; }
-    }
-    #endregion
-    [StorableConstructor]
-    private ModelClustersFrequencyAnalyzer(StorableConstructorFlag _) : base(_) { }
-    private ModelClustersFrequencyAnalyzer(ModelClustersFrequencyAnalyzer original, Cloner cloner)
-      : base(original, cloner) {
-    }
-    public ModelClustersFrequencyAnalyzer()
-      : base() {
-      Parameters.Add(new LookupParameter<DataTable>(ModelClustersFrequencyParameterName, "The relative Model Clusters reference frequencies aggregated over all trees in the population."));
-      Parameters.Add(new ValueLookupParameter<BoolValue>(AggregateModelClustersParameterName, "Switch that determines whether all references to factor Model Clusters should be aggregated regardless of the value. Turn off to analyze all factor variable references with different values separately.", new BoolValue(true)));
-      Parameters.Add(new LookupParameter<EMMMapBase<ISymbolicExpressionTree>>(MapParameterName));
-    }
-
-    [StorableHook(HookType.AfterDeserialization)]
-    private void AfterDeserialization() {
-      // BackwardsCompatibility3.3
-      #region Backwards compatible code, remove with 3.4
-      if (!Parameters.ContainsKey(AggregateModelClustersParameterName)) {
-        Parameters.Add(new ValueLookupParameter<BoolValue>(AggregateModelClustersParameterName, "Switch that determines whether all references to factor Model Clusters should be aggregated regardless of the value. Turn off to analyze all factor Model Clusters references with different values separately.", new BoolValue(true)));
-      }
-      #endregion
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new ModelClustersFrequencyAnalyzer(this, cloner);
-    }
-
-    public override IOperation Apply() {
-      ItemArray<ISymbolicExpressionTree> expressions = SymbolicExpressionTreeParameter.ActualValue;
-      ResultCollection results = ResultCollection;
-      DataTable datatable;
-      if (ModelClustersFrequencyParameter.ActualValue == null) {
-        datatable = new DataTable("ModelClusters frequencies", "Relative frequency of ModelClusters references aggregated over the whole population.");
-        datatable.VisualProperties.XAxisTitle = "Generation";
-        datatable.VisualProperties.YAxisTitle = "Relative ModelClusters Frequency";
-        ModelClustersFrequencyParameter.ActualValue = datatable;
-        results.Add(new Result("ModelClusters frequencies", "Relative frequency of ModelClusters references aggregated over the whole population.", datatable));
-      }
-
-      datatable = ModelClustersFrequencyParameter.ActualValue;
-      // all rows must have the same number of values so we can just take the first
-      int numberOfValues = datatable.Rows.Select(r => r.Values.Count).DefaultIfEmpty().First();
-
-      foreach (var pair in CalculateModelClustersFrequency(expressions, MapParameter.ActualValue)) {
-        if (!datatable.Rows.ContainsKey(pair.Key)) {
-          // initialize a new row for the variable and pad with zeros
-          DataRow row = new DataRow(pair.Key, "", Enumerable.Repeat(0.0, numberOfValues));
-          row.VisualProperties.StartIndexZero = true;
-          datatable.Rows.Add(row);
-        }
-        datatable.Rows[pair.Key].Values.Add(Math.Round(pair.Value, 3));
-      }
-
-      // add a zero for each data row that was not modified in the previous loop 
-      foreach (var row in datatable.Rows.Where(r => r.Values.Count != numberOfValues + 1))
-        row.Values.Add(0.0);
-
-      return base.Apply();
-    }
-
-    public static IEnumerable<KeyValuePair<string, double>> CalculateModelClustersFrequency(IEnumerable<ISymbolicExpressionTree> trees, EMMMapBase<ISymbolicExpressionTree> map) {
-      var modelClustersFrequency = trees
-          .SelectMany(t => GetModelClustersReferences(t, map))
-          .GroupBy(pair => pair.Key, pair => pair.Value)
-          .ToDictionary(g => g.Key, g => g.Sum());
-
-      double totalNumberOfSymbols = modelClustersFrequency.Values.Sum();
-
-      foreach (var pair in modelClustersFrequency.OrderBy(p => p.Key, new NaturalStringComparer()))
-        yield return new KeyValuePair<string, double>(pair.Key, pair.Value / totalNumberOfSymbols);
-    }
-
-    private static IEnumerable<KeyValuePair<string, double>> GetModelClustersReferences(ISymbolicExpressionTree tree, EMMMapBase<ISymbolicExpressionTree> map) {
-      Dictionary<string, double> references = new Dictionary<string, double>();
-      if (map is EMMIslandMap island) {
-        foreach (var treeNode in tree.IterateNodesPrefix().OfType<TreeModelTreeNode>()) {
-          string referenceId = "no";
-
-          referenceId = "Cluster " + island.ClusterNumber[treeNode.TreeNumber];
-          if (references.ContainsKey(referenceId)) {
-            int a = (int)references[referenceId];
-            a++;
-            references[referenceId] = a;
-          } else {
-            references[referenceId] = 1;
-          }
-        }
-      } else {
-        if (map is EMMSucsessMap sMap) {
-          for (int i = 0; i < map.ModelSet.Count; i++) {
-            string referenceId = "Tree Probability" + i;
-            references[referenceId] = sMap.Probabilities[i];
-          }
-        } else {
-          string referenceId = "no";
-          references[referenceId] = 0;
-        }
-      }
-      return references;
-    }
-  }
-}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/ModelSetPreporation.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/ModelSetPreporation.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/ModelSetPreporation.cs	(revision 17134)
@@ -0,0 +1,418 @@
+﻿using HEAL.Attic;
+using HeuristicLab.Algorithms.DataAnalysis;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Problems.DataAnalysis;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using HeuristicLab.Random;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using CancellationToken = System.Threading.CancellationToken;
+using ExecutionContext = HeuristicLab.Core.ExecutionContext;
+
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  [Item("ModelSetPreparation", "Model Set preparation algorithm.")]
+  [Creatable(CreatableAttribute.Categories.Algorithms, Priority = 125)]
+  [StorableType("3C5DF308-DB79-4ACD-894B-F795F081726B")]
+  public class ModelSetPreparation : FixedDataAnalysisAlgorithm<ISymbolicDataAnalysisSingleObjectiveProblem> {
+    #region data members
+    [Storable]
+    protected ExecutionContext executionContext;
+    [Storable]
+    protected ExecutionState previousExecutionState;
+    [Storable]
+    protected IEnumerable<ISymbolicExpressionTree> trees;
+    [Storable]
+    protected ExecutionState currentExecutionState;
+    #endregion
+
+    #region parameters
+    private const string SeedParameterName = "Seed";
+    private const string SetSeedRandomlyParameterName = "SetSeedRandomly";
+    private const string RandomParameterName = "Random";
+    private const string InputFileParameterName = "InputFile";
+    private const string AlgorithmImplementationTypeParameterName = "AlgorithmImplementationType";
+    private const string GoalParameterName = "Goal";
+    private const string DistanceTypeParameterName = "DistanceType";
+    private const string MapParameterName = "Map";
+
+    public IFixedValueParameter<IntValue> SeedParameter {
+      get { return (IFixedValueParameter<IntValue>)Parameters[SeedParameterName]; }
+    }
+    public IConstrainedValueParameter<StringValue> AlgorithmImplementationTypeParameter {
+      get { return (IConstrainedValueParameter<StringValue>)Parameters[AlgorithmImplementationTypeParameterName]; }
+    }
+    public IConstrainedValueParameter<StringValue> GoalParameter {
+      get { return (IConstrainedValueParameter<StringValue>)Parameters[GoalParameterName]; }
+    }
+    public IConstrainedValueParameter<StringValue> DistanceTypeParameter {
+      get { return (IConstrainedValueParameter<StringValue>)Parameters[DistanceTypeParameterName]; }
+    }
+    public IConstrainedValueParameter<EMMMapBase<ISymbolicExpressionTree>> MapParameter {
+      get { return (IConstrainedValueParameter<EMMMapBase<ISymbolicExpressionTree>>)Parameters[MapParameterName]; }
+    }
+    public IFixedValueParameter<StringValue> InputFileParameter {
+      get { return (IFixedValueParameter<StringValue>)Parameters[InputFileParameterName]; }
+    }
+    public IFixedValueParameter<BoolValue> SetSeedRandomlyParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[SetSeedRandomlyParameterName]; }
+    }
+    public IValueParameter<IRandom> RandomParameter {
+      get { return (IValueParameter<IRandom>)Parameters[RandomParameterName]; }
+    }
+    #endregion
+
+    #region parameter properties
+    public int Seed {
+      get { return SeedParameter.Value.Value; }
+      set { SeedParameter.Value.Value = value; }
+    }
+    public StringValue AlgorithmImplemetationType {
+      get { return AlgorithmImplementationTypeParameter.Value; }
+      set { AlgorithmImplementationTypeParameter.Value.Value = value.Value; }
+    }
+    public StringValue Goal {
+      get { return GoalParameter.Value; }
+      set { GoalParameter.Value.Value = value.Value; }
+    }
+    public StringValue DistanceType {
+      get { return DistanceTypeParameter.Value; }
+      set { DistanceTypeParameter.Value.Value = value.Value; }
+    }
+    public EMMMapBase<ISymbolicExpressionTree> Map {
+      get { return MapParameter.Value; }
+      set { MapParameter.Value = value; }
+    }
+    public StringValue InputFile {
+      get { return InputFileParameter.Value; }
+      set { InputFileParameter.Value.Value = value.Value; }
+    }
+    public bool SetSeedRandomly {
+      get { return SetSeedRandomlyParameter.Value.Value; }
+      set { SetSeedRandomlyParameter.Value.Value = value; }
+    }
+    #endregion
+
+    #region constructors
+    public ModelSetPreparation() {
+
+      Parameters.Add(new FixedValueParameter<IntValue>(SeedParameterName, "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
+      Parameters.Add(new FixedValueParameter<StringValue>(InputFileParameterName, "The file with set of models that will be.", new StringValue("input.txt")));
+      Parameters.Add(new ConstrainedValueParameter<StringValue>(AlgorithmImplementationTypeParameterName, "The Type of possible algorithm implementation, choose one: OnlyMap, Full, Read."));
+      Parameters.Add(new ConstrainedValueParameter<StringValue>(GoalParameterName, "The goal of algorithm implementation, choose one: ToSee, ToWork, Full."));
+      Parameters.Add(new ConstrainedValueParameter<StringValue>(DistanceTypeParameterName, "The Type of possible distance calculator for case of only distance calculation."));
+      Parameters.Add(new ConstrainedValueParameter<EMMMapBase<ISymbolicExpressionTree>>(MapParameterName, "The type of map creation algorithm. Use one from: IslandMap, NetworkMap."));
+      Parameters.Add(new FixedValueParameter<BoolValue>(SetSeedRandomlyParameterName, "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
+
+      Parameters.Add(new ValueParameter<IRandom>(RandomParameterName, new MersenneTwister()));
+
+      //begin hack ...
+      InputFile.ValueChanged += InputFile_ValueChanged;
+      InfixExpressionParser parser = new InfixExpressionParser();
+      trees = File.ReadAllLines(InputFileParameter.Value.Value).Select(parser.Parse).ToArray();
+      // end hack
+
+      ProblemChanged += ModelSetPreporation_ProblemChanged;
+      MapParameterUpdate();
+
+    }
+
+    // also hack !!!!!!!!!!!!!!!!!!!!!!!!!
+    private void InputFile_ValueChanged(object sender, EventArgs e) {
+      InfixExpressionParser parser = new InfixExpressionParser();
+      trees = File.ReadAllLines(InputFileParameter.Value.Value).Select(parser.Parse);
+    }
+    // remove again !!!!!!!!!!!!!!!!!!!!!! 
+
+    private void ModelSetPreporation_ProblemChanged(object sender, EventArgs e) {
+      if (Problem != null) {
+        Problem.SymbolicExpressionTreeInterpreter = new SymbolicDataAnalysisExpressionTreeBatchInterpreter();
+      }
+    }
+    protected void MapParameterUpdate() {
+
+      var mapTypes = new EMMMapBase<ISymbolicExpressionTree>[]
+      {
+        new EMMZeroMap (),
+        new EMMIslandMap(),
+        new EMMNetworkMap(),
+        new EMMDisatanceMap(),
+        new EMMRankMap(),
+        new EMMSucsessMap ()
+      };
+      foreach (var t in mapTypes) {
+        MapParameter.ValidValues.Add(t);
+      }
+      var algorithmType = new StringValue[]
+        {
+          new StringValue ("DistanceCalculation"),
+          new StringValue ("OnlyMap"),
+          new StringValue ("Statistic")
+        };
+      foreach (var t in algorithmType) {
+        AlgorithmImplementationTypeParameter.ValidValues.Add(t);
+      }
+      var goal = new StringValue[]
+  {
+          new StringValue ("ToWork"),
+          new StringValue ("ToSee"),
+          new StringValue ("Full")
+  };
+      foreach (var t in goal) {
+        GoalParameter.ValidValues.Add(t);
+      }
+      var distanceType = new StringValue[]
+        {
+          new StringValue("MSE"),
+          new StringValue("PearsonsRSquared"),
+          new StringValue ("Covariance"),
+          new StringValue ("MaxAbsoluteError"),
+          new StringValue ("MeanAbsoluteError"),
+          new StringValue ("Symbolic")
+        };
+      foreach (var t in distanceType) {
+        DistanceTypeParameter.ValidValues.Add(t);
+      }
+    }
+
+    protected ModelSetPreparation(ModelSetPreparation original, Cloner cloner) : base(original, cloner) {
+
+      previousExecutionState = original.previousExecutionState;
+      if (original.executionContext != null) {
+        executionContext = cloner.Clone(original.executionContext);
+      }
+      // hack
+      trees = original.trees.Select(x => cloner.Clone(x)).ToArray();
+    }
+
+    [StorableConstructor]
+    protected ModelSetPreparation(StorableConstructorFlag _) : base(_) { }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ModelSetPreparation(this, cloner);
+    }
+    #endregion
+
+    #region technical stuff
+    public override void Prepare() {
+      base.Prepare();
+    }
+
+    protected override void Initialize(CancellationToken cancellationToken) {
+      base.Initialize(cancellationToken);
+    }
+
+    public override bool SupportsPause => true;
+
+    // implements random number generation from https://en.wikipedia.org/wiki/Dirichlet_distribution#Random_number_generation
+
+    #region operator wiring and events
+    private void ParameterizeStochasticOperator(IOperator op) {
+      IStochasticOperator stochasticOp = op as IStochasticOperator;
+      if (stochasticOp != null) {
+        stochasticOp.RandomParameter.ActualName = "Random";
+        stochasticOp.RandomParameter.Hidden = true;
+      }
+    }
+    protected void ExecuteOperation(ExecutionContext executionContext, CancellationToken cancellationToken, IOperation operation) {
+      Stack<IOperation> executionStack = new Stack<IOperation>();
+      executionStack.Push(operation);
+      while (executionStack.Count > 0) {
+        cancellationToken.ThrowIfCancellationRequested();
+        IOperation next = executionStack.Pop();
+        if (next is OperationCollection coll) {
+          for (int i = coll.Count - 1; i >= 0; i--)
+            if (coll[i] != null) executionStack.Push(coll[i]);
+        } else if (next is IAtomicOperation op) {
+          next = op.Operator.Execute((IExecutionContext)op, cancellationToken);
+          if (next != null) executionStack.Push(next);
+        }
+      }
+    }
+
+    protected override void OnProblemChanged() {
+      base.OnProblemChanged();
+    }
+
+    protected override void OnExecutionStateChanged() {
+      previousExecutionState = currentExecutionState;
+      currentExecutionState = ExecutionState;
+      base.OnExecutionStateChanged();
+    }
+
+    protected override void OnStopped() {
+      if (executionContext != null) {
+        if (executionContext.Scope != null) {
+          if (executionContext.Scope.SubScopes != null) {
+            executionContext.Scope.SubScopes.Clear();
+          }
+        }
+      }
+      base.OnStopped();
+    }
+    #endregion
+    #endregion
+
+    #region algorithm implementation
+    protected override void Run(CancellationToken cancellationToken) {
+      Map.DistanceParametr = DistanceType.Value;
+      //distance calculation or reading that should be done in any cases
+      string fileNameForWatch = "DistanceMatrix_Watch" + DistanceType + ".txt";
+      string fileName = "DistanceMatrix_" + DistanceType + ".txt";
+      double[,] totalDistance;
+      if (AlgorithmImplemetationType.Value == "DistanceCalculation") {
+        totalDistance = TotalDistanceMatrixCalculation(RandomParameter.Value, Problem, trees.ToList(), DistanceType.Value);
+        if (Goal.Value != "ToWork") {
+          FileComuncations.DoubleMatrixPrint(fileNameForWatch, totalDistance, trees.Count());
+        }
+        if (Goal.Value != "ToSee") {
+          FileComuncations.DoubleMatrixSerialize(fileName, totalDistance);
+        }
+      } else {
+        totalDistance = FileComuncations.DoubleMatrixDeserialize(fileName);
+        // totalDistance = FileComuncations.DoubleMatrixFromFileRead(fileName, trees.Count());
+      }
+
+      if (AlgorithmImplemetationType.Value == "Statistic") {
+        var statistic = new int[trees.Count(), trees.Count()];
+        for (int i = 0; i < trees.Count(); i++) {
+          for (int j = 0; j < trees.Count(); j++)
+            statistic[i, j] = 0;
+        }
+        var maps = new List<List<List<int>>>();
+        int repetitionNumber = 10;
+        Map.MapCreationPrepare(trees);
+        for (int i = 0; i < repetitionNumber; i++) {
+          Map.CreateMap(RandomParameter.Value, totalDistance);
+          maps.Add(Map.Map);
+          CheckClusters(statistic);
+          Map.Map.Clear();
+        }
+      } else { // Simple map creation case
+        Map.MapCreationPrepare(trees);
+        Map.CreateMap(RandomParameter.Value, totalDistance);
+        Map.WriteMapToTxtFile(RandomParameter.Value);// This should be deactivated in case of using HIVE. HIVE can not work with it.
+      }
+    }
+    protected void CheckClusters(int[,] info) {
+      // ToDo: It should be realized for statistics collection
+    }
+    #region distance manipulation
+
+    public static double[,] DistanceMatrixCalculation(List<ISymbolicExpressionTree> trees, string distanceType, ISymbolicDataAnalysisSingleObjectiveProblem Problem) {
+      var problemData = (IRegressionProblemData)Problem.ProblemData;
+      var dataset = problemData.Dataset;
+      var rows = problemData.TrainingIndices;
+      var interpreter = Problem.SymbolicExpressionTreeInterpreter;
+      string[] toWrite = new string[trees.Count()];
+      int i = 0;
+      var treeValues = new List<List<double>>();
+      if (distanceType != "Symbolic") {
+        foreach (var tree in trees) {
+          treeValues.Add(interpreter.GetSymbolicExpressionTreeValues(tree, dataset, rows).ToList());
+        }
+      }
+      double[,] distances = new double[trees.Count, trees.Count];
+      OnlineCalculatorError err;
+      switch (distanceType) {
+        case "MSE":
+          for (i = 0; i < trees.Count - 1; i++) {
+            for (int j = i + 1; j < trees.Count; j++) {
+              distances[j, i] = distances[i, j] = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(treeValues[i], treeValues[j], out err); ;
+            }
+          }
+          break;
+        case "PearsonsRSquared":
+          for (i = 0; i < trees.Count - 1; i++) {
+            for (int j = i + 1; j < trees.Count; j++) {
+              distances[j, i] = distances[i, j] = OnlinePearsonsRCalculator.Calculate(treeValues[i], treeValues[j], out err); ;
+            }
+          }
+          break;
+        case "Covariance":
+          for (i = 0; i < trees.Count - 1; i++) {
+            for (int j = i + 1; j < trees.Count; j++) {
+              distances[j, i] = distances[i, j] = OnlineCovarianceCalculator.Calculate(treeValues[i], treeValues[j], out err); ;
+            }
+          }
+          break;
+        case "MaxAbsoluteError":
+          for (i = 0; i < trees.Count - 1; i++) {
+            for (int j = i + 1; j < trees.Count; j++) {
+              distances[j, i] = distances[i, j] = OnlineMaxAbsoluteErrorCalculator.Calculate(treeValues[i], treeValues[j], out err); ;
+            }
+          }
+          break;
+        case "MeanAbsoluteError":
+          for (i = 0; i < trees.Count - 1; i++) {
+            for (int j = i + 1; j < trees.Count; j++) {
+              distances[j, i] = distances[i, j] = OnlineMeanAbsoluteErrorCalculator.Calculate(treeValues[i], treeValues[j], out err); ;
+            }
+          }
+          break;
+        case "Symbolic":
+          distances = SymbolicExpressionTreeHash.ComputeSimilarityMatrix(trees, simplify: false, strict: true);
+          for (i = 0; i < trees.Count - 1; i++) {
+            for (int j = i + 1; j < trees.Count; j++) {
+              distances[j, i] = distances[i, j] = 1 - distances[i, j];
+            }
+          }
+          break;
+      }
+
+      return distances;
+    }
+    public static double[,] CalculateDistances(List<ISymbolicExpressionTree> treesSet) {
+      double[,] distances;
+      distances = SymbolicExpressionTreeHash.ComputeSimilarityMatrix(treesSet, simplify: false, strict: true);
+      for (int i = 0; i < treesSet.Count - 1; i++) {
+        for (int j = i + 1; j < treesSet.Count; j++) {
+          distances[j, i] = distances[i, j] = 1 - distances[i, j];
+        }
+      }
+      return distances;
+    }
+    public static double[,] TotalDistanceMatrixCalculation(IRandom random, ISymbolicDataAnalysisSingleObjectiveProblem problem, List<ISymbolicExpressionTree> treesSet, string distanceType) {
+      var setSize = treesSet.Count();
+      var totalDistance = new double[setSize, setSize];
+      var treeSetTemp = new List<ISymbolicExpressionTree>();
+      foreach (var tree in treesSet) {
+        treeSetTemp.Add((ISymbolicExpressionTree)tree.Clone());
+      }
+      if (distanceType != "Symbolic") {
+
+        int repitNumber = 10;
+        totalDistance = new double[setSize, setSize];
+        for (int i = 0; i < setSize; i++) {
+          for (int j = 0; j < setSize; j++) {
+            totalDistance[i, j] = 0;
+          }
+        }
+        for (int i = 0; i < repitNumber; i++) {
+          foreach (var tree in treeSetTemp) {
+            HelpFunctions.SetLocalParametersForTree(random, 0.5, tree);
+          }
+          var distanceMatrix = DistanceMatrixCalculation(treeSetTemp, distanceType, problem);
+          for (int t = 0; t < setSize; t++) {
+            for (int j = 0; j < setSize; j++) {
+              totalDistance[t, j] += Math.Abs(distanceMatrix[t, j]) / repitNumber;
+            }
+          }
+        }
+      } else {
+        foreach (var tree in treeSetTemp) {
+          HelpFunctions.SetLocalParametersForTree(random, 0.5, tree);
+        }
+        totalDistance = CalculateDistances(treeSetTemp);
+      }
+      return totalDistance;
+    }
+    #endregion 
+    #endregion
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/SelfConfiguration.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/SelfConfiguration.cs	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/SelfConfiguration.cs	(revision 17134)
@@ -0,0 +1,138 @@
+﻿using HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  [Item("SelfConfiguration", "A fluent realization of self-configuration mechanism")]
+  [StorableType("7888A6B9-CDC8-42A0-BDA6-F9D89A56067A")]
+  public class SelfConfiguration : Item {
+    #region data members
+    [Storable]
+    public List<double> Probabilities { get; private set; }
+    [Storable]
+    protected List<List<double>> SucsessStatistics { get; private set; }
+    [Storable]
+    public double SocialKarte { get; private set; } // parameters of method
+    [Storable]
+    public double StepValue { get; private set; }
+    [Storable]
+    protected List<int> ChoiseForPopulation { get; private set; }
+    #endregion
+    #region constructors
+    public SelfConfiguration() : base() {
+      SucsessStatistics = new List<List<double>>();
+      Probabilities = new List<double>();
+      ChoiseForPopulation = new List<int>();
+    }
+    public SelfConfiguration(SelfConfiguration original, Cloner cloner) : base(original, cloner) {
+      SucsessStatistics = original.SucsessStatistics.Select(x => x.ToList()).ToList();
+      Probabilities = original.Probabilities.ToList();
+      SocialKarte = original.SocialKarte;
+      StepValue = original.StepValue;
+    }
+    [StorableConstructor]
+    protected SelfConfiguration(StorableConstructorFlag _) : base(_) {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SelfConfiguration(this, cloner);
+    }
+    #endregion
+    #region dialog functions
+    public void Initialization(int size) {
+      for (int t = 0; t < size; t++) {
+        Probabilities.Add(1.0 / ((double)(size))); // uniform distribution as start point
+      }
+      SocialKarte = 1.0 / (size * 20.0); // parameters of method
+      StepValue = SocialKarte / 5.0;
+    }
+    public void ReadFromFile(int size, string fileName) {
+      SocialKarte = 1.0 / (size * 20.0); // parameters of method
+      StepValue = SocialKarte / 5.0;
+      var temp = FileComuncations.DoubleMatrixFromFileRead(fileName);
+      Probabilities = temp[0];
+    }
+    public int Aplay(IRandom random) {
+      return HelpFunctions.OneElementFromListProportionalSelection(random, Probabilities);
+    }
+    public int Aplay(int individNumber) {
+      return ChoiseForPopulation[individNumber];
+    }
+    public void DecisionForPopulation(int size, IRandom random) {
+      if (ChoiseForPopulation != null) {
+        ChoiseForPopulation.Clear();
+      }
+      for (int i = 0; i < size; i++) {
+        ChoiseForPopulation.Add(HelpFunctions.OneElementFromListProportionalSelection(random, Probabilities));
+      }
+    }
+    #region probabilities updating
+    public void UpDate(Dictionary<ISymbolicExpressionTree, double> population) {
+      SucsessStatisticCollection(population);
+      ProbabilitiesUpDate();
+    }
+    public void UpDate(double[] population) {
+      SucsessStatisticCollection(population);
+      ProbabilitiesUpDate();
+    }
+    private void SucsessStatisticCollection(double[] qualities) {
+      if (SucsessStatistics.Count != 0)
+        SucsessStatistics.Clear();
+      for (int t = 0; t < Probabilities.Count; t++) {
+        SucsessStatistics.Add(new List<double>());
+        SucsessStatistics[t].Add(t);
+        SucsessStatistics[t].Add(0);
+      }
+      for (int i = 0; i < ChoiseForPopulation.Count; i++) {
+        SucsessStatistics[ChoiseForPopulation[i]][1] = qualities[i];
+      }
+    }
+    private void SucsessStatisticCollection(Dictionary<ISymbolicExpressionTree, double> population) {
+      if (SucsessStatistics.Count != 0)
+        SucsessStatistics.Clear();
+      for (int t = 0; t < Probabilities.Count; t++) {
+        SucsessStatistics.Add(new List<double>());
+        SucsessStatistics[t].Add(0);
+        SucsessStatistics[t].Add(0);
+      }
+      foreach (var solution in population) {
+        TreeCheck(solution.Key, solution.Value);
+      }
+    }
+    private void TreeCheck(ISymbolicExpressionTree tree, double treeQuality) {
+      foreach (var treeNode in tree.IterateNodesPrefix().OfType<TreeModelTreeNode>()) {
+        SucsessStatistics[treeNode.TreeNumber][0] += 1;
+        SucsessStatistics[treeNode.TreeNumber][1] += treeQuality;
+      }
+    }
+    private void ProbabilitiesUpDate() {
+      var averageQuality = new List<double>();
+      foreach (var variant in SucsessStatistics) {
+        if (variant[0] > 0.005) {
+          averageQuality.Add(variant[1] / variant[0]);
+        } else { averageQuality.Add(0); }
+      }
+      int bestModelNumber = HelpFunctions.ChooseMaxElementIndex(averageQuality);
+      double totalChangeValue = 0, changeValue = 0;
+      for (int i = 0; i < Probabilities.Count; i++) {
+        changeValue = CheckSocialKatre(Probabilities[i]);
+        totalChangeValue += changeValue;
+        Probabilities[i] -= changeValue;
+      }
+      Probabilities[bestModelNumber] += totalChangeValue;
+    }
+    private double CheckSocialKatre(double value) {
+      if (value > (SocialKarte + StepValue))
+        return StepValue;
+      else if (value > SocialKarte)
+        return (value - SocialKarte);
+      else return 0;
+    }
+    #endregion
+    #endregion
+  }
+}
Index: branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/InfixExpressionFormatter.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/InfixExpressionFormatter.cs	(revision 17002)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/InfixExpressionFormatter.cs	(revision 17134)
@@ -20,12 +20,12 @@
 #endregion
 
+using HEAL.Attic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using System;
 using System.Globalization;
 using System.Linq;
 using System.Text;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HEAL.Attic;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -58,5 +58,5 @@
     /// <param name="formatString">The format string for numeric parameters (e.g. \"G4\" to limit to 4 digits, default is \"G\")</param>
     /// <returns>Infix expression</returns>
-    public string Format(ISymbolicExpressionTree symbolicExpressionTree, NumberFormatInfo numberFormat, string formatString="G") {
+    public string Format(ISymbolicExpressionTree symbolicExpressionTree, NumberFormatInfo numberFormat, string formatString = "G") {
       // skip root and start symbols
       StringBuilder strBuilder = new StringBuilder();
@@ -182,4 +182,7 @@
           else
             strBuilder.Append("(").Append(constNode.Value.ToString(formatString, numberFormat)).Append(")"); // (-1
+        } else if (node.Symbol is TreeModel) {
+          var modelNode = node as TreeModelTreeNode;
+          strBuilder.Append(modelNode.TreeToString());
         }
       }
Index: branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/BatchOperations.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/BatchOperations.cs	(revision 17002)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/BatchOperations.cs	(revision 17134)
@@ -101,5 +101,5 @@
     public static void CubeRoot(double[] a, double[] b) {
       for (int i = 0; i < BATCHSIZE; ++i)
-        a[i] = Math.Pow(b[i], 1d / 3d);
+        a[i] = b[i] < 0 ? -Math.Pow(-b[i], 1d / 3d) : Math.Pow(b[i], 1d / 3d);
     }
 
Index: branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ModelTreeNode.cs
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ModelTreeNode.cs	(revision 17002)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ModelTreeNode.cs	(revision 17134)
@@ -94,4 +94,9 @@
       return s;
     }
+    public string TreeToString() {
+      var fmt = new InfixExpressionFormatter();
+      string s = fmt.Format(Tree);
+      return s;
+    }
   }
 }
Index: branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/new-analyzers.patch
===================================================================
--- branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/new-analyzers.patch	(revision 17134)
+++ branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/new-analyzers.patch	(revision 17134)
@@ -0,0 +1,326 @@
+Index: 3.4/Analyzers/MinAverageMaxSymbolicExpressionNeastedTreeSyzeAnalyzer.cs
+===================================================================
+--- 3.4/Analyzers/MinAverageMaxSymbolicExpressionNeastedTreeSyzeAnalyzer.cs	(nonexistent)
++++ 3.4/Analyzers/MinAverageMaxSymbolicExpressionNeastedTreeSyzeAnalyzer.cs	(working copy)
+@@ -0,0 +1,95 @@
++ï»¿
++#region License Information
++/* HeuristicLab
++ * Copyright (C) 2002-2018 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 System;
++using HeuristicLab.Analysis;
++using HeuristicLab.Common;
++using HeuristicLab.Core;
++using HeuristicLab.Data;
++using HeuristicLab.Operators;
++using HeuristicLab.Parameters;
++using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
++using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
++using HeuristicLab.Problems.DataAnalysis.Symbolic;
++using System.Collections.Generic;
++using System.Linq;
++using HeuristicLab.Optimization;
++
++namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
++  /// <summary>
++  /// An operator that tracks the min average and max length of symbolic expression trees.
++  /// </summary>
++  [Item("MinAverageMaxSymbolicExpressionNeastedTreeSizeAnalyzer", "An operator that tracks the min avgerage and max Neasted Tree Size of symbolic expression trees.")]
++  [StorableClass]
++  public sealed class MinAverageMaxSymbolicExpressionNeastedTreeSizeAnalyzer : SymbolicDataAnalysisAnalyzer, ISymbolicExpressionTreeAnalyzer {
++    private const string ResultsParameterName = "Results";
++    private const string MinMaxAvgNeastedTreeSizeResultName = "MinMaxAvgNeastedTreeSize";
++
++    #region parameter properties
++    public ValueLookupParameter<VariableCollection> ResultsParameter {
++      get { return (ValueLookupParameter<VariableCollection>)Parameters[ResultsParameterName]; }
++    }
++    #endregion
++
++    [StorableConstructor]
++    private MinAverageMaxSymbolicExpressionNeastedTreeSizeAnalyzer(bool deserializing) : base() { }
++    private MinAverageMaxSymbolicExpressionNeastedTreeSizeAnalyzer(MinAverageMaxSymbolicExpressionNeastedTreeSizeAnalyzer original, Cloner cloner)
++      : base(original, cloner) {
++      AfterDeserialization();
++    }
++    public MinAverageMaxSymbolicExpressionNeastedTreeSizeAnalyzer()
++      : base() {
++    }
++
++    [StorableHook(HookType.AfterDeserialization)]
++    private void AfterDeserialization() { }
++
++    public override IDeepCloneable Clone(Cloner cloner) {
++      return new MinAverageMaxSymbolicExpressionNeastedTreeSizeAnalyzer(this, cloner);
++    }
++
++    public override IOperation Apply() {
++      var trees = SymbolicExpressionTreeParameter.ActualValue;
++      //var variablesNumber = new DoubleArray(trees.Length);
++      var variablesNumber = trees.Select(tree => tree.IterateNodesPostfix().Sum(n => n.GetLength())).ToArray();
++      var min = variablesNumber.Min();
++      var max = variablesNumber.Max();
++      var avg = variablesNumber.Average();
++
++      DataTable table;
++      if (ResultCollection.ContainsKey(MinMaxAvgNeastedTreeSizeResultName)) {
++        table = (DataTable)ResultCollection[MinMaxAvgNeastedTreeSizeResultName].Value;
++      } else {
++        table = new DataTable("Tree Variables Number");
++        ResultCollection.Add(new Result(MinMaxAvgNeastedTreeSizeResultName, table));
++        table.Rows.Add(new DataRow("Min") { VisualProperties = { StartIndexZero = true } });
++        table.Rows.Add(new DataRow("Max") { VisualProperties = { StartIndexZero = true } });
++        table.Rows.Add(new DataRow("Avg") { VisualProperties = { StartIndexZero = true } });
++      }
++      table.Rows["Min"].Values.Add(min);
++      table.Rows["Max"].Values.Add(max);
++      table.Rows["Avg"].Values.Add(avg);
++
++      return base.Apply();
++    }
++  }
++}
+Index: 3.4/Analyzers/MinAverageMaxSymbolicExpressionTreeComplexcityAnalyzer.cs
+===================================================================
+--- 3.4/Analyzers/MinAverageMaxSymbolicExpressionTreeComplexcityAnalyzer.cs	(nonexistent)
++++ 3.4/Analyzers/MinAverageMaxSymbolicExpressionTreeComplexcityAnalyzer.cs	(working copy)
+@@ -0,0 +1,108 @@
++ï»¿
++#region License Information
++/* HeuristicLab
++ * Copyright (C) 2002-2018 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 System;
++using HeuristicLab.Analysis;
++using HeuristicLab.Common;
++using HeuristicLab.Core;
++using HeuristicLab.Data;
++using HeuristicLab.Operators;
++using HeuristicLab.Parameters;
++using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
++using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
++using HeuristicLab.Problems.DataAnalysis.Symbolic;
++using System.Collections.Generic;
++using System.Linq;
++using HeuristicLab.Optimization;
++
++namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
++  /// <summary>
++  /// An operator that tracks the min average and max length of symbolic expression trees.
++  /// </summary>
++  [Item("MinAverageMaxSymbolicExpressionTreeComplexityAnalyzer", "An operator that tracks the min avgerage and max Complexity of symbolic expression trees.")]
++  [StorableClass]
++  public sealed class MinAverageMaxSymbolicExpressionTreeComplexityAnalyzer : SymbolicDataAnalysisAnalyzer, ISymbolicExpressionTreeAnalyzer {
++    private const string ResultsParameterName = "Results";
++    private const string MinMaxAvgComplexityResultName = "MinMaxAvgTreeComplexity";
++
++    #region parameter properties
++    public ValueLookupParameter<VariableCollection> ResultsParameter {
++      get { return (ValueLookupParameter<VariableCollection>)Parameters[ResultsParameterName]; }
++    }
++    #endregion
++
++    [StorableConstructor]
++    private MinAverageMaxSymbolicExpressionTreeComplexityAnalyzer(bool deserializing) : base() { }
++    private MinAverageMaxSymbolicExpressionTreeComplexityAnalyzer(MinAverageMaxSymbolicExpressionTreeComplexityAnalyzer original, Cloner cloner)
++      : base(original, cloner) {
++      AfterDeserialization();
++    }
++    public MinAverageMaxSymbolicExpressionTreeComplexityAnalyzer()
++      : base() {
++    }
++
++    [StorableHook(HookType.AfterDeserialization)]
++    private void AfterDeserialization() {}
++
++    public override IDeepCloneable Clone(Cloner cloner) {
++      return new MinAverageMaxSymbolicExpressionTreeComplexityAnalyzer(this, cloner);
++    }
++
++    public override IOperation Apply() {
++      var trees = SymbolicExpressionTreeParameter.ActualValue;
++      var complexities = trees.Select(SymbolicDataAnalysisModelComplexityCalculator.CalculateComplexity).ToArray();
++
++      var min = complexities.Min();
++      var max = complexities.Max();
++      var avg = complexities.Average();
++
++      //double min = complexities[0], max = complexities[0], avg = 0;
++
++      //foreach (var c in complexities) {
++      //  if (min > c) {
++      //    min = c;
++      //  }
++      //  if (max < c) {
++      //    max = c;
++      //  }
++      //  avg += c;
++      //}
++      //avg /= complexities.Length;
++
++      DataTable table;
++      if (ResultCollection.ContainsKey(MinMaxAvgComplexityResultName)) {
++        table = (DataTable)ResultCollection[MinMaxAvgComplexityResultName].Value;
++      } else {
++        table = new DataTable("Tree Complexity");
++        ResultCollection.Add(new Result(MinMaxAvgComplexityResultName, table));
++        table.Rows.Add(new DataRow("Min") { VisualProperties = { StartIndexZero = true } });
++        table.Rows.Add(new DataRow("Max") { VisualProperties = { StartIndexZero = true } });
++        table.Rows.Add(new DataRow("Avg") { VisualProperties = { StartIndexZero = true } });
++      }
++      table.Rows["Min"].Values.Add(min);
++      table.Rows["Max"].Values.Add(max);
++      table.Rows["Avg"].Values.Add(avg);
++
++      return base.Apply();
++    }
++  }
++}
+Index: 3.4/Analyzers/MinAverageMaxSymbolicExpressionTreeVariablesNumberAnalyzer.cs
+===================================================================
+--- 3.4/Analyzers/MinAverageMaxSymbolicExpressionTreeVariablesNumberAnalyzer.cs	(nonexistent)
++++ 3.4/Analyzers/MinAverageMaxSymbolicExpressionTreeVariablesNumberAnalyzer.cs	(working copy)
+@@ -0,0 +1,94 @@
++ï»¿#region License Information
++/* HeuristicLab
++ * Copyright (C) 2002-2018 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 System;
++using HeuristicLab.Analysis;
++using HeuristicLab.Common;
++using HeuristicLab.Core;
++using HeuristicLab.Data;
++using HeuristicLab.Operators;
++using HeuristicLab.Parameters;
++using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
++using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
++using HeuristicLab.Problems.DataAnalysis.Symbolic;
++using System.Collections.Generic;
++using System.Linq;
++using HeuristicLab.Optimization;
++
++namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
++  /// <summary>
++  /// An operator that tracks the min average and max length of symbolic expression trees.
++  /// </summary>
++  [Item("MinAverageMaxSymbolicExpressionTreeVariablesNumberAnalyzer", "An operator that tracks the min avgerage and max VariablesNumber of symbolic expression trees.")]
++  [StorableClass]
++  public sealed class MinAverageMaxSymbolicExpressionTreeVariablesNumberAnalyzer : SymbolicDataAnalysisAnalyzer, ISymbolicExpressionTreeAnalyzer {
++    private const string ResultsParameterName = "Results";
++    private const string MinMaxAvgVariablesNumberResultName = "MinMaxAvgTreeVariablesNumber";
++
++    #region parameter properties
++    public ValueLookupParameter<VariableCollection> ResultsParameter {
++      get { return (ValueLookupParameter<VariableCollection>)Parameters[ResultsParameterName]; }
++    }
++    #endregion
++
++    [StorableConstructor]
++    private MinAverageMaxSymbolicExpressionTreeVariablesNumberAnalyzer(bool deserializing) : base() { }
++    private MinAverageMaxSymbolicExpressionTreeVariablesNumberAnalyzer(MinAverageMaxSymbolicExpressionTreeVariablesNumberAnalyzer original, Cloner cloner)
++      : base(original, cloner) {
++      AfterDeserialization();
++    }
++    public MinAverageMaxSymbolicExpressionTreeVariablesNumberAnalyzer()
++      : base() {
++    }
++
++    [StorableHook(HookType.AfterDeserialization)]
++    private void AfterDeserialization() { }
++
++    public override IDeepCloneable Clone(Cloner cloner) {
++      return new MinAverageMaxSymbolicExpressionTreeVariablesNumberAnalyzer(this, cloner);
++    }
++
++    public override IOperation Apply() {
++      var trees = SymbolicExpressionTreeParameter.ActualValue;
++      //var variablesNumber = new DoubleArray(trees.Length);
++      var variablesNumber = trees.Select(tree => tree.IterateNodesPostfix().OfType<IVariableTreeNode>().Count()).ToArray();
++      var min = variablesNumber.Min();
++      var max = variablesNumber.Max();
++      var avg = variablesNumber.Average();
++
++      DataTable table;
++      if (ResultCollection.ContainsKey(MinMaxAvgVariablesNumberResultName)) {
++        table = (DataTable)ResultCollection[MinMaxAvgVariablesNumberResultName].Value;
++      } else {
++        table = new DataTable("Tree Variables Number");
++        ResultCollection.Add(new Result(MinMaxAvgVariablesNumberResultName, table));
++        table.Rows.Add(new DataRow("Min") { VisualProperties = { StartIndexZero = true } });
++        table.Rows.Add(new DataRow("Max") { VisualProperties = { StartIndexZero = true } });
++        table.Rows.Add(new DataRow("Avg") { VisualProperties = { StartIndexZero = true } });
++      }
++      table.Rows["Min"].Values.Add(min);
++      table.Rows["Max"].Values.Add(max);
++      table.Rows["Avg"].Values.Add(avg);
++
++      return base.Apply();
++    }
++  }
++}
+Index: 3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
+===================================================================
+--- 3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(revision 16364)
++++ 3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(working copy)
+@@ -126,6 +126,9 @@
+     <Reference Include="System.Xml" />
+   </ItemGroup>
+   <ItemGroup>
++    <Compile Include="Analyzers\MinAverageMaxSymbolicExpressionNeastedTreeSyzeAnalyzer.cs" />
++    <Compile Include="Analyzers\MinAverageMaxSymbolicExpressionTreeVariablesNumberAnalyzer.cs" />
++    <Compile Include="Analyzers\MinAverageMaxSymbolicExpressionTreeComplexcityAnalyzer.cs" />
+     <Compile Include="Analyzers\SymbolicDataAnalysisBottomUpDiversityAnalyzer.cs" />
+     <Compile Include="Analyzers\SymbolicDataAnalysisBuildingBlockAnalyzer.cs" />
+     <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectivePruningAnalyzer.cs" />
