Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm.cs	(revision 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm.cs	(revision 17002)
@@ -29,5 +29,4 @@
 using HeuristicLab.Selection;
 using System.Collections.Generic;
-using System.IO;
 using System.Linq;
 using CancellationToken = System.Threading.CancellationToken;
@@ -35,14 +34,10 @@
 
 namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [Item("EvolvmentModelsOfModels Algorithm ", "EMM implementation")]
+  [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) {
-      //if (original.Map != null) {
-      //  Map = cloner.Clone(original.Map);
-      //}
-    }
+    protected EMMAlgorithm(EMMAlgorithm original, Cloner cloner) : base(original, cloner) { }
     public override IDeepCloneable Clone(Cloner cloner) {
       return new EMMAlgorithm(this, cloner);
@@ -53,15 +48,12 @@
 
     protected override void Run(CancellationToken cancellationToken) {
-      InfixExpressionParser parser = new InfixExpressionParser();
-      var trees = File.ReadAllLines(InputFileParameter.Value.Value).Select(parser.Parse);
       if (AlgorithmImplemetationType.Value == "Read") {
         Map.MapRead(RandomParameter.Value, trees, "Map.txt");
       } else {
-        Map.MapCreationPrepare(RandomParameter.Value, trees, ClusterNumbersParameter.Value.Value);
+        Map.MapCreationPrepare(trees);
         Map.CreateMap(RandomParameter.Value, ClusterNumbersParameter.Value.Value);
-       // Map.WriteMapToTxtFile(RandomParameter.Value);
-      }
-
-      ClusterNumbersShowParameter.Value.Value = Map.K;
+        // Map.WriteMapToTxtFile(RandomParameter.Value); хайв этого не любит.. ворчит
+      }
+      ClusterNumbersShowParameter.Value.Value = Map.Map.Count;
 
       if (AlgorithmImplemetationType.Value == "OnlyMap") {
@@ -74,4 +66,6 @@
         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);
       }
@@ -84,9 +78,7 @@
       bestSelector.QualityParameter.ActualName = "Quality";
 
-      var populationSize = PopulationSize.Value;
       var maximumEvaluatedSolutions = MaximumEvaluatedSolutions.Value;
       var crossover = Crossover;
       var selector = Selector;
-      var groupSize = GroupSize.Value;
       var crossoverProbability = CrossoverProbability.Value;
       var mutator = Mutator;
@@ -143,8 +135,7 @@
             var op3 = executionContext.CreateChildOperation(evaluator, childScope);
             ExecuteOperation(executionContext, innerToken, op3);
-            var qualities = (DoubleValue)childScope.Variables["Quality"].Value;
-            var childSolution = new EMMSolution(childScope);
-            // set child qualities
-            childSolution.Qualities = qualities;
+            //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));
@@ -152,5 +143,4 @@
             Population.Add(new EMMSolution(selected.SubScopes[i]));
           }
-
           if (EvaluatedSolutions >= maximumEvaluatedSolutions) {
             break;
@@ -158,4 +148,17 @@
 
         }
+        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
@@ -170,9 +173,8 @@
 
       // set the execution context for parameters to allow lookup
-      foreach (var parameter in Problem.Parameters.OfType<IValueParameter>()) {  // 
-                                                                                 // we need all of these in order for the wiring of the operators to work
-        globalScope.Variables.Add(new Core.Variable(parameter.Name, parameter.Value));
-      }
-      globalScope.Variables.Add(new Core.Variable("Results", Results)); // make results available as a parameter for analyzers etc.
+      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;
@@ -180,31 +182,17 @@
       rand.Reset(Seed);
 
-      var populationSize = PopulationSize.Value;
-
       InitializePopulation(executionContext, cancellationToken, rand);
-
-      // initialize data structures for map clustering
-      //var models = new ItemList<ISymbolicExpressionTree>(Map.ModelSet);
-      //var map = new ItemList<ItemList<IntValue>>();
-      //foreach (var list in Map.Map) {
-      //  map.Add(new ItemList<IntValue>(list.Select(x => new IntValue(x))));
-      //}
-      //var clusterNumber = new ItemList<IntValue>(Map.ClusterNumber.Select(x => new IntValue(x)));
-      //globalScope.Variables.Add(new Variable("Models", models));
-      //globalScope.Variables.Add(new Variable("Map", map));
-      //globalScope.Variables.Add(new Variable("ClusterNumber", clusterNumber));
-
-      EvaluatedSolutions = populationSize;
+      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 evaluator = Problem.Evaluator;
-      var populationSize = PopulationSize.Value;
-      Population = new List<IEMMSolution>(populationSize);
-
       var parentScope = executionContext.Scope; //main scope for the next step work
-      // first, create all individuals
-      for (int i = 0; i < populationSize; ++i) {
+                                                // 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));
@@ -212,32 +200,23 @@
         var tree = (ISymbolicExpressionTree)childScope.Variables[name].Value;
         foreach (var node in tree.IterateNodesPostfix().OfType<TreeModelTreeNode>()) {
-          node.Tree = Map.NewModelForInizializtion(random, out int cluster, out int treeNumber);
-          node.SetLocalParameters(random, 0.5);
-          node.ClusterNumer = cluster;
-          node.TreeNumber = treeNumber;
+          Map.NodeManipulationForInizializtion(random, node);
         }
         parentScope.SubScopes.Add(childScope);
       }
-
       // then, evaluate them and update qualities
-      for (int i = 0; i < populationSize; ++i) {
+      for (int i = 0; i < PopulationSize.Value; ++i) {
         var childScope = parentScope.SubScopes[i];
         ExecuteOperation(executionContext, cancellationToken, executionContext.CreateChildOperation(evaluator, childScope));
-
-        var qualities = (DoubleValue)childScope.Variables["Quality"].Value;
-        var solution = new EMMSolution(childScope);  // Create solution and push individual inside
-
-        solution.Qualities = qualities;
-        Population.Add(solution);  // push solution to Population 
-      }
-    }
+        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 creator = Problem.SolutionCreator;
-      var name = ((ISymbolicExpressionTreeCreator)creator).SymbolicExpressionTreeParameter.ActualName;
+      var name = ((ISymbolicExpressionTreeCreator)Problem.SolutionCreator).SymbolicExpressionTreeParameter.ActualName;
       var tree = (ISymbolicExpressionTree)childScope.Variables[name].Value;
-      var evaluator = problem.Evaluator;
       var oldTree = tree.Clone();
-      ExecuteOperation(executionContext, cancellationToken, executionContext.CreateChildOperation(evaluator, childScope));
+      ExecuteOperation(executionContext, cancellationToken, executionContext.CreateChildOperation(problem.Evaluator, childScope));
       var rand = RandomParameter.Value;
       if (SetSeedRandomly) Seed = RandomSeedGenerator.GetSeed();
@@ -259,17 +238,20 @@
       return maxStepNumber;
     }
-    void ModelChange(TreeModelTreeNode a, IRandom rand, CancellationToken cancellationToken, IScope childScope) {
-      int treeNumber = a.TreeNumber;
-      var oldSubTree = (ISymbolicExpressionTree)a.Tree.Clone();
+    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 = Map.ClusterNumber[treeNumber];
+      int cluster;
+      if (Map is EMMIslandMap map)
+        cluster = map.ClusterNumber[treeNumber];
+      else cluster = treeNumber;
       int newTreeNumber = rand.Next(Map.Map[cluster].Count);
-      a.Tree = (ISymbolicExpressionTree)Map.ModelSet[newTreeNumber].Clone();
-      a.Tree.Root.ShakeLocalParameters(rand, 1);
+      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) {
-        a.Tree = (ISymbolicExpressionTree)oldSubTree.Clone();
+        tree.Tree = (ISymbolicExpressionTree)oldSubTree.Clone();
         ((DoubleValue)childScope.Variables["Quality"].Value).Value = oldQuality;
       }
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMBaseAlgorithm.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMBaseAlgorithm.cs	(revision 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMBaseAlgorithm.cs	(revision 17002)
@@ -35,4 +35,5 @@
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using CancellationToken = System.Threading.CancellationToken;
@@ -56,4 +57,6 @@
     [Storable]
     protected ExecutionState previousExecutionState;
+    [Storable]
+    protected IEnumerable<ISymbolicExpressionTree> trees;
 
     [Storable]
@@ -77,5 +80,5 @@
     private const string ClusterNumbersParameterName = "ClusterNumbers";
     private const string ClusterNumbersShowParameterName = "ClusterNumbersShow";
-    private const string AlgorithmImplementationTypeParameterName = "AlgorithmImplemetationType";
+    private const string AlgorithmImplementationTypeParameterName = "AlgorithmImplementationType";
     private const string MapParameterName = "Map";
     private const string NegbourTypeParameterName = "NegbourType";
@@ -250,7 +253,21 @@
       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) {
@@ -271,5 +288,9 @@
       {
         new EMMIslandMap(),
-        new EMMNetworkMap(neghboorNumber)
+        new EMMNetworkMap(neghboorNumber),
+        new EMMDisatanceMap(),
+        new EMMRankMap(),
+        new EMMSucsessMap (),
+        new EMMZeroMap ()
       };
       foreach (var t in mapTypes) {
@@ -314,4 +335,7 @@
         globalScope = cloner.Clone(original.globalScope);
       }
+
+      // hack
+      trees = original.trees.Select(x => cloner.Clone(x)).ToArray();
     }
 
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMBaseMap.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMBaseMap.cs	(revision 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMBaseMap.cs	(revision 17002)
@@ -25,4 +25,5 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using HeuristicLab.Random;
 using System.Collections.Generic;
 using System.IO;
@@ -32,48 +33,14 @@
   [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<int> ClusterNumber { get; set; }
-    [Storable]
     public List<List<int>> Map { get; set; }
-    [Storable]
-    public double[,] Distances { get; set; }
-    [Storable]
-    public int K { get; protected set; }
-
-    protected void CalculateDistances() {
-      if (ModelSet is List<ISymbolicExpressionTree> set) {
-        Distances = SymbolicExpressionTreeHash.ComputeSimilarityMatrix(set, simplify: false, strict: true);
-      } else { /// for future work
-        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];
-        }
-      }
-
-    }
-    public abstract void CreateMap(IRandom random, int k);
-    public abstract T NewModelForInizializtionNotTree(IRandom random, out int cluster, out int treeNumber);
-    public ISymbolicExpressionTree NewModelForInizializtion(IRandom random, out int cluster, out int treeNumber) {
-      treeNumber = random.Next(ModelSet.Count);
-      cluster = ClusterNumber[treeNumber];
-      if (ModelSet[treeNumber] is ISymbolicExpressionTree model)
-        return (ISymbolicExpressionTree)(model.Clone());
-      return new SymbolicExpressionTree();
-    }
-
+    #endregion
+    #region constructors
     [StorableConstructor]
     protected EMMMapBase(StorableConstructorFlag _) : base(_) { }
-    protected EMMMapBase() : this(1) { }
-    public EMMMapBase(int k) {
-      K = k;
-      ClusterNumber = new List<int>();
+    public EMMMapBase() {
       Map = new List<List<int>>();
     }
@@ -84,35 +51,52 @@
         else ModelSet = original.ModelSet.ToList(); /// check this if you want to use it
       }
-      if (original.ClusterNumber != null) {
-        ClusterNumber = original.ClusterNumber.ToList();
-      }
       if (original.Map != null) {
         Map = original.Map.Select(x => x.ToList()).ToList();
       }
-      K = original.K;
     }
-    //public EMMMapBase(IRandom random, IEnumerable<T> trees, int k) : this(k) {
-    //  // constructor that should be used in case of creation of a new map from the start point
-    //  ModelSet = trees.ToList();
-    //  CalculateDistances();
-    //  CreateMap(random, k);
-    //}
-    //public EMMMapBase(IRandom random, IEnumerable<T> trees, string fileName = "Map.txt") : this(1) {
-    //  // constructor that shoud be used in case of using of "old" map, that was previously created and now shoud be readed from file
-    //  ModelSet = trees.ToList();
-    //  MapFromFileRead(fileName);
-    //  K = Map.Count;
-    //  MapPreparation();
-    //}
-    public void MapCreationPrepare(IRandom random, IEnumerable<T> trees, int k) {
+    #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();
-      CalculateDistances();
-      CreateMap(random, k);
     }
+
+    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);
-      K = Map.Count;
-      MapPreparation();
+      if (this is EMMIslandMap island) { island.ClusterNumbersCalculate(); }
       if (this is EMMNetworkMap one) { one.NeghboorNumber = Map[0].Count; }
     }
@@ -126,10 +110,10 @@
       fileName2 += s;
       fileName2 += ".txt";
-      File.WriteAllLines(fileName, MapToSee());
+      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[K];
-      for (int i = 0; i < K; i++) {
+      s = new string[Map.Count];
+      for (int i = 0; i < Map.Count; i++) {
         s[i] = "";
         for (int j = 0; j < Map[i].Count; j++) {
@@ -146,5 +130,9 @@
       s[0] = "ClusterNumber" + "," + "ModelNumber" + "," + "Model";
       for (int i = 1; i < ((ModelSet.Count) + 1); i++) {
-        s[i] = ClusterNumber[i - 1].ToString() + "," + (i - 1).ToString() + ",";
+        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);
@@ -164,28 +152,39 @@
       }
     }
-    protected void MapSizeCheck() {
-      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 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);
         }
       }
     }
-    protected void MapPreparation() {
-      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;
-        }
-      }
-    }
+    public virtual void MapUpDate(Dictionary<ISymbolicExpressionTree, double> population) { }
+    #endregion
   }
 }
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMDisatanceMap.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMDisatanceMap.cs	(revision 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMDisatanceMap.cs	(revision 17002)
@@ -1,6 +1,28 @@
-﻿using HEAL.Attic;
+﻿#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;
 
@@ -9,42 +31,46 @@
   [StorableType("456692FB-2149-4359-8106-45D59D2D7FA0")]
   public class EMMDisatanceMap : EMMMapBase<ISymbolicExpressionTree> {
-
-    // Under the work now. Do not take into account =)
+    [Storable]
+    public List<List<double>> Probabilities { get; set; }
     #region conctructors
     [StorableConstructor]
     protected EMMDisatanceMap(StorableConstructorFlag _) : base(_) { }
-    public EMMDisatanceMap() : this(1) { }
     public override IDeepCloneable Clone(Cloner cloner) {
       return new EMMDisatanceMap(this, cloner);
     }
-    public EMMDisatanceMap(int k) : base(k) { ModelSet = new List<ISymbolicExpressionTree>(); }
+    public EMMDisatanceMap() : base() { ModelSet = new List<ISymbolicExpressionTree>(); }
     public EMMDisatanceMap(EMMDisatanceMap original, Cloner cloner) : base(original, cloner) { }
     #endregion
-    #region MapApplayFunctions
+    #region MapCreation
     override public void CreateMap(IRandom random, int k) {
-      K = Map.Count;
-      ApplyDistanceMapCreationAlgorithm(random, Distances, Map, K);
-      for (int i = 0; i < Map.Count; i++) {
-        ClusterNumber.Add(i);
+
+      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);
+        }
       }
     }
-    public static void ApplyDistanceMapCreationAlgorithm(IRandom random, double[,] distances, List<List<int>> map, int k, 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 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 cluster, out int treeNumber) {
-      return NewModelForInizializtion(random, out cluster, out treeNumber);
+    override public ISymbolicExpressionTree NewModelForInizializtionNotTree(IRandom random, out int treeNumber) {
+      return NewModelForInizializtion(random, out treeNumber);
     }
     #endregion
Index: anches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMGrammar.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMGrammar.cs	(revision 17001)
+++ 	(revision )
@@ -1,177 +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 System.Collections.Generic;
-using System.Linq;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HEAL.Attic;
-using HeuristicLab.Problems.DataAnalysis.Symbolic;
-
-namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [StorableType("44B0829C-1CB5-4BE9-9514-BBA54FAB2912")]
-  [Item("EMMGrammar", "Represents a grammar for functional expressions using all available functions.")]
-  public class EMMGrammar : SymbolicExpressionGrammar, ISymbolicDataAnalysisGrammar {
-    [StorableConstructor]
-    protected EMMGrammar(StorableConstructorFlag _) : base(_) { }
-    protected EMMGrammar(EMMGrammar original, Cloner cloner) : base(original, cloner) { }
-    public EMMGrammar()
-      : base(ItemAttribute.GetName(typeof(EMMGrammar)), ItemAttribute.GetDescription(typeof(EMMGrammar))) {
-      Initialize();
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new EMMGrammar(this, cloner);
-    }
-
-    private void Initialize() {
-      var add = new Addition();
-      var sub = new Subtraction();
-      var mul = new Multiplication();
-      var div = new Division();
-      var aq = new AnalyticQuotient();
-      var mean = new Average();
-      var sin = new Sine();
-      var cos = new Cosine();
-      var tan = new Tangent();
-      var log = new Logarithm();
-      var abs = new Absolute();
-      var pow = new Power();
-      pow.InitialFrequency = 0.0;
-      var square = new Square();
-      square.InitialFrequency = 0.0;
-      var cube = new Cube();
-      cube.InitialFrequency = 0.0;
-      var root = new Root();
-      root.InitialFrequency = 0.0;
-      var sqrt = new SquareRoot();
-      sqrt.InitialFrequency = 0.0;
-      var cubeRoot = new CubeRoot();
-      cubeRoot.InitialFrequency = 0.0;
-      var airyA = new AiryA();
-      airyA.InitialFrequency = 0.0;
-      var airyB = new AiryB();
-      airyB.InitialFrequency = 0.0;
-      var bessel = new Bessel();
-      bessel.InitialFrequency = 0.0;
-      var cosineIntegral = new CosineIntegral();
-      cosineIntegral.InitialFrequency = 0.0;
-      var dawson = new Dawson();
-      dawson.InitialFrequency = 0.0;
-      var erf = new Erf();
-      erf.InitialFrequency = 0.0;
-      var expIntegralEi = new ExponentialIntegralEi();
-      expIntegralEi.InitialFrequency = 0.0;
-      var fresnelCosineIntegral = new FresnelCosineIntegral();
-      fresnelCosineIntegral.InitialFrequency = 0.0;
-      var fresnelSineIntegral = new FresnelSineIntegral();
-      fresnelSineIntegral.InitialFrequency = 0.0;
-      var gamma = new Gamma();
-      gamma.InitialFrequency = 0.0;
-      var hypCosineIntegral = new HyperbolicCosineIntegral();
-      hypCosineIntegral.InitialFrequency = 0.0;
-      var hypSineIntegral = new HyperbolicSineIntegral();
-      hypSineIntegral.InitialFrequency = 0.0;
-      var norm = new Norm();
-      norm.InitialFrequency = 0.0;
-      var psi = new Psi();
-      psi.InitialFrequency = 0.0;
-      var sineIntegral = new SineIntegral();
-      sineIntegral.InitialFrequency = 0.0;
-
-      var exp = new Exponential();
-      var @if = new IfThenElse();
-      var gt = new GreaterThan();
-      var lt = new LessThan();
-      var and = new And();
-      var or = new Or();
-      var not = new Not();
-      var xor = new Xor();
-
-      var timeLag = new TimeLag();
-      timeLag.InitialFrequency = 0.0;
-      var integral = new Integral();
-      integral.InitialFrequency = 0.0;
-      var derivative = new Derivative();
-      derivative.InitialFrequency = 0.0;
-
-      var variableCondition = new VariableCondition();
-      variableCondition.InitialFrequency = 0.0;
-
-      var constant = new Constant();
-      var treeModel = new TreeModel();
-      constant.MinValue = -20;
-      constant.MaxValue = 20;
-      var variableSymbol = new HeuristicLab.Problems.DataAnalysis.Symbolic.Variable();
-      var binFactorVariable = new BinaryFactorVariable();
-      var factorVariable = new FactorVariable();
-      var laggedVariable = new LaggedVariable();
-      laggedVariable.InitialFrequency = 0.0;
-      var autoregressiveVariable = new AutoregressiveTargetVariable();
-      autoregressiveVariable.InitialFrequency = 0.0;
-      autoregressiveVariable.Enabled = false;
-
-      var allSymbols = new List<Symbol>() { add, sub, mul, div, aq, mean, abs, sin, cos, tan, log, square, cube, pow, sqrt, cubeRoot, root, exp,
-        airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, fresnelCosineIntegral, fresnelSineIntegral, gamma, hypCosineIntegral, hypSineIntegral, norm, psi, sineIntegral,
-        @if, gt, lt, and, or, not,xor, timeLag, integral, derivative, constant, variableSymbol, binFactorVariable, factorVariable, laggedVariable,autoregressiveVariable, variableCondition,
-        treeModel};
-      var unaryFunctionSymbols = new List<Symbol>() { abs, square, sqrt, cube, cubeRoot, sin, cos, tan, log, exp, not, timeLag, integral, derivative,
-        airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, fresnelCosineIntegral, fresnelSineIntegral, gamma, hypCosineIntegral, hypSineIntegral, norm, psi, sineIntegral
-      };
-
-      var binaryFunctionSymbols = new List<Symbol>() { pow, root, gt, lt, aq, variableCondition };
-      var ternarySymbols = new List<Symbol>() { add, sub, mul, div, mean, and, or, xor };
-      var terminalSymbols = new List<Symbol>() { variableSymbol, binFactorVariable, factorVariable, constant, laggedVariable, autoregressiveVariable, treeModel };
-
-      foreach (var symb in allSymbols)
-        AddSymbol(symb);
-
-      foreach (var funSymb in ternarySymbols) {
-        SetSubtreeCount(funSymb, 1, 3);
-      }
-      foreach (var funSymb in unaryFunctionSymbols) {
-        SetSubtreeCount(funSymb, 1, 1);
-      }
-      foreach (var funSymb in binaryFunctionSymbols) {
-        SetSubtreeCount(funSymb, 2, 2);
-      }
-      foreach (var terminalSymbol in terminalSymbols) {
-        SetSubtreeCount(terminalSymbol, 0, 0);
-      }
-
-      SetSubtreeCount(@if, 3, 3);
-
-
-      // allow each symbol as child of the start symbol
-      foreach (var symb in allSymbols) {
-        AddAllowedChildSymbol(StartSymbol, symb);
-        AddAllowedChildSymbol(DefunSymbol, symb);
-      }
-
-      // allow each symbol as child of every other symbol (except for terminals that have maxSubtreeCount == 0)
-      foreach (var parent in allSymbols.Except(terminalSymbols)) {
-        foreach (var child in allSymbols)
-          AddAllowedChildSymbol(parent, child);
-      }
-    }
-  }
-}
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMIslandMap.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMIslandMap.cs	(revision 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMIslandMap.cs	(revision 17002)
@@ -24,5 +24,7 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Random;
 using System.Collections.Generic;
+using System.Linq;
 
 namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
@@ -30,26 +32,54 @@
   [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() : this(1) { }
+    public EMMIslandMap() {
+      ModelSet = new List<ISymbolicExpressionTree>();
+      ClusterNumber = new List<int>();
+    }
     public override IDeepCloneable Clone(Cloner cloner) {
       return new EMMIslandMap(this, cloner);
     }
-    public EMMIslandMap(int k) : base(k) { ModelSet = new List<ISymbolicExpressionTree>(); }
-    public EMMIslandMap(EMMIslandMap original, Cloner cloner) : base(original, cloner) { }
-    // public EMMIslandMap(IRandom random, IEnumerable<ISymbolicExpressionTree> trees, int k, int neghboorNumber) : base(random, trees, k) { }
-    //public EMMIslandMap(IRandom random, IEnumerable<ISymbolicExpressionTree> trees, string fileName = "Map.txt") : base(random, trees, fileName) { }
+    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, Distances, ClusterNumber, k);
-      MapSizeCheck();
+
+      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 cluster, out int treeNumber) {
-      return NewModelForInizializtion(random, out cluster, out treeNumber);
+    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 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMultyPointsMutator.cs	(revision 17002)
@@ -27,5 +27,4 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Problems.DataAnalysis.Symbolic;
-using HeuristicLab.Random;
 using System.Collections.Generic;
 using System.Linq;
@@ -44,5 +43,4 @@
     }
     public List<ISymbolicExpressionTree> ModelSet => MapParameter.ActualValue.ModelSet;
-    public List<int> ClusterNumber => MapParameter.ActualValue.ClusterNumber;
     public List<List<int>> Map => MapParameter.ActualValue.Map;
     public PercentValue MutationProbability => MutationProbabilityParameter.ActualValue;
@@ -61,5 +59,5 @@
 
     protected override void Manipulate(IRandom random, ISymbolicExpressionTree symbolicExpressionTree) {
-      EMMOnePointMutatorPart(random, symbolicExpressionTree, ModelSet, ClusterNumber, Map, MutationProbability);
+      EMMOnePointMutatorPart(random, symbolicExpressionTree, ModelSet, Map, MutationProbability);
     }
     private static bool SymbolTypeCheck(ISymbol nSymbol, IEnumerable<ISymbol> allSymbols) {
@@ -70,5 +68,5 @@
       return false;
     }
-    public static void EMMOnePointMutatorPart(IRandom random, ISymbolicExpressionTree symbolicExpressionTree, List<ISymbolicExpressionTree> modelSet, List<int> clusterNumber, List<List<int>> map, PercentValue mutationProbability) {
+    public void EMMOnePointMutatorPart(IRandom random, ISymbolicExpressionTree symbolicExpressionTree, List<ISymbolicExpressionTree> modelSet, List<List<int>> map, PercentValue mutationProbability) {
 
       List<ISymbol> allowedSymbols = new List<ISymbol>();
@@ -93,5 +91,5 @@
             }
             int pTemp = random.Next(map.Count);
-            if (node is TreeModelTreeNode treeNode) { pTemp = treeNode.ClusterNumer; } //remeber the cluster number
+            if (node is TreeModelTreeNode treeNode) { pTemp = treeNode.TreeNumber; } //remeber the cluster number
             var weights = allowedSymbols.Select(s => s.InitialFrequency).ToList(); // set up probabilities
 
@@ -102,8 +100,6 @@
 
             if (node is TreeModelTreeNode treeNode2) { // make rigth mutation for tree model
-              treeNode2.TreeNumber = map[pTemp].SampleRandom(random);
-              treeNode2.Tree = (ISymbolicExpressionTree)modelSet[treeNode2.TreeNumber].Clone();
-              treeNode2.ClusterNumer = pTemp;
-              treeNode2.SetLocalParameters(random, 1);
+              treeNode2.TreeNumber = pTemp;
+              MapParameter.ActualValue.NodeForMutationChange(random, treeNode2);
             } else if (node.HasLocalParameters) { // make local parametrs set up for other node types
               node.ResetLocalParameters(random);
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMultyPointsMutatorNodeTypeSaving.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMultyPointsMutatorNodeTypeSaving.cs	(revision 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMultyPointsMutatorNodeTypeSaving.cs	(revision 17002)
@@ -27,5 +27,4 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Problems.DataAnalysis.Symbolic;
-using HeuristicLab.Random;
 using System.Collections.Generic;
 using System.Linq;
@@ -42,5 +41,4 @@
     }
     public List<ISymbolicExpressionTree> ModelSet => MapParameter.ActualValue.ModelSet;
-    public List<int> ClusterNumber => MapParameter.ActualValue.ClusterNumber;
     public List<List<int>> Map => MapParameter.ActualValue.Map;
 
@@ -64,5 +62,5 @@
 
     protected override void Manipulate(IRandom random, ISymbolicExpressionTree symbolicExpressionTree) {
-      EMMOnePointMutatorPart(random, symbolicExpressionTree, ModelSet, ClusterNumber, Map, MutationProbability);
+      EMMOnePointMutatorPart(random, symbolicExpressionTree, ModelSet, Map, MutationProbability);
     }
     private static bool SymbolTypeCheck(ISymbol nSymbol, IEnumerable<ISymbol> allSymbols) {
@@ -73,5 +71,5 @@
       return false;
     }
-    public static void EMMOnePointMutatorPart(IRandom random, ISymbolicExpressionTree symbolicExpressionTree, List<ISymbolicExpressionTree> modelSet, List<int> clusterNumber, List<List<int>> map, PercentValue mutationProbability) {
+    public void EMMOnePointMutatorPart(IRandom random, ISymbolicExpressionTree symbolicExpressionTree, List<ISymbolicExpressionTree> modelSet, List<List<int>> map, PercentValue mutationProbability) {
 
       List<ISymbol> allowedSymbols = new List<ISymbol>();
@@ -95,6 +93,6 @@
               allowedSymbols.Add(node.Symbol);
             }
-            int pTemp = random.Next(map.Count);
-            if (node is TreeModelTreeNode treeNode) { pTemp = treeNode.ClusterNumer; } //remeber the cluster number
+            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
 
@@ -105,8 +103,6 @@
 
             if (node is TreeModelTreeNode treeNode2) { // make rigth mutation for tree model
-              treeNode2.TreeNumber = map[pTemp].SampleRandom(random);
-              treeNode2.Tree = (ISymbolicExpressionTree)modelSet[treeNode2.TreeNumber].Clone();
-              treeNode2.ClusterNumer = pTemp;
-              treeNode2.SetLocalParameters(random, 1);
+              treeNode2.TreeNumber = pTemp;
+              MapParameter.ActualValue.NodeForMutationChange(random, treeNode2);
             } else if (node.HasLocalParameters) { // make local parametrs set up for other node types
               node.ResetLocalParameters(random);
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMutators.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMutators.cs	(revision 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMutators.cs	(revision 17002)
@@ -23,9 +23,7 @@
 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;
@@ -43,5 +41,4 @@
 
     public List<ISymbolicExpressionTree> ModelSet => MapParameter.ActualValue.ModelSet;
-    public List<int> ClusterNumber => MapParameter.ActualValue.ClusterNumber;
     public List<List<int>> Map => MapParameter.ActualValue.Map;
 
@@ -58,7 +55,7 @@
 
     protected override void Manipulate(IRandom random, ISymbolicExpressionTree symbolicExpressionTree) {
-      EMMMutatorsPart(random, symbolicExpressionTree, ModelSet, ClusterNumber, Map);
+      EMMMutatorsPart(random, symbolicExpressionTree, ModelSet, Map);
     }
-    public static void EMMMutatorsPart(IRandom random, ISymbolicExpressionTree symbolicExpressionTree, List<ISymbolicExpressionTree> modelSet, List<int> clusterNumber, List<List<int>> map) {
+    public void EMMMutatorsPart(IRandom random, ISymbolicExpressionTree symbolicExpressionTree, List<ISymbolicExpressionTree> modelSet, List<List<int>> map) {
       List<ISymbol> allowedSymbols = new List<ISymbol>();
       ISymbolicExpressionTreeNode parent;
@@ -109,10 +106,8 @@
 
         if (newNode is TreeModelTreeNode treeNode) {
-          int p = random.Next(map.Count);
-          if (child is TreeModelTreeNode chNode) { p = chNode.ClusterNumer; }
-          treeNode.TreeNumber = map[p].SampleRandom(random);
-          treeNode.Tree = (ISymbolicExpressionTree)modelSet[treeNode.TreeNumber].Clone();
-          treeNode.ClusterNumer = p;
-          treeNode.SetLocalParameters(random, 0.5);
+          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);
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMNetworkMap.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMNetworkMap.cs	(revision 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMNetworkMap.cs	(revision 17002)
@@ -24,4 +24,5 @@
 using HeuristicLab.Core;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Random;
 using System.Collections.Generic;
 
@@ -42,24 +43,10 @@
     }
     public EMMNetworkMap(EMMNetworkMap original, Cloner cloner) : base(original, cloner) { NeghboorNumber = original.NeghboorNumber; }
-    //public EMMNetworkMap(IRandom random, IEnumerable<ISymbolicExpressionTree> trees, int k, int neghboorNumber = 10) : this(neghboorNumber) {
-    //  // constructor that should be used in case of creation of a new map from the start point
-    //  ModelSet = trees.ToList();
-    //  CalculateDistances();
-    //  NeghboorNumber = neghboorNumber; // this shoud be done before map creation, so it is impossible to create tree wisout it
-    //  CreateMap(random, k);
-    //}
-    //public EMMNetworkMap(IRandom random, IEnumerable<ISymbolicExpressionTree> trees, string fileName = "Map.txt") : base(random, trees, fileName) {
-    //  NeghboorNumber = Map[0].Count;
-    //}
     #endregion
     #region MapTransformation
     override public void CreateMap(IRandom random, int k) {
-      K = Map.Count;
-      ApplyNetworkMapCreationAlgorithm(random, Distances, Map, K, NeghboorNumber);
-      for (int i = 0; i < Map.Count; i++) {
-        ClusterNumber.Add(i);
-      }
+      ApplyNetworkMapCreationAlgorithm(random, CalculateDistances(), Map, NeghboorNumber);
     }
-    public static void ApplyNetworkMapCreationAlgorithm(IRandom random, double[,] distances, List<List<int>> map, int k, int neghboorNumber = 10) {
+    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>();
@@ -78,6 +65,10 @@
     #endregion
     #region Dialog with surroudings
-    override public ISymbolicExpressionTree NewModelForInizializtionNotTree(IRandom random, out int cluster, out int treeNumber) {
-      var newTree = NewModelForInizializtion(random, out cluster, out treeNumber);
+    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;
     }
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMRankMap.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMRankMap.cs	(revision 17002)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMRankMap.cs	(revision 17002)
@@ -0,0 +1,91 @@
+﻿#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 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMSolution.cs	(revision 17002)
@@ -45,5 +45,8 @@
       Individual = individual;
     }
-
+    public EMMSolution(IScope scope) {
+      Individual = scope;
+      Qualities = (DoubleValue)scope.Variables["Quality"].Value;
+    }
     public EMMSolution(IItem individual, DoubleValue qualities) {
       Individual = individual;
@@ -62,6 +65,6 @@
 
     protected EMMSolution(EMMSolution original, Cloner cloner) : base(original, cloner) {
-      Qualities = original.Qualities;
-      Individual = (IItem)original.Individual.Clone(cloner);
+      Qualities = cloner.Clone(original.Qualities);
+      Individual = cloner.Clone(original.Individual);
     }
 
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMSucsessMap.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMSucsessMap.cs	(revision 17002)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMSucsessMap.cs	(revision 17002)
@@ -0,0 +1,100 @@
+﻿#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)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMZeroMap.cs	(revision 17002)
@@ -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 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/HelpFunctions.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/HelpFunctions.cs	(revision 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/HelpFunctions.cs	(revision 17002)
@@ -1,11 +1,38 @@
-﻿using System;
+﻿#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;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using HEAL.Attic;
 
 namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
   class HelpFunctions {
+    public static int OneElementFromListProportionalSelection(IRandom random, List<double> list) {
+      double selectedQuality = random.NextDouble() * list.Sum();
+      int index = 0;
+      double currentQuality = list[index];
+      while ((currentQuality < selectedQuality) && (index < list.Count)) {
+        index++;
+        currentQuality += list[index];
+      }
+      return index;
+    }
     public static int ChooseMinElementIndex(List<double> distances, int currentElement, List<int> previousNumbers) {
       double minValue = 100;
@@ -28,4 +55,5 @@
       return minElementNumber;
     }
+
     public static bool CheckNumberIsInList(int number, List<int> priviousNumber) {
       foreach (var pNum in priviousNumber) {
@@ -46,4 +74,41 @@
       return minElementNumber;
     }
+    public static int ChooseMaxElementIndex(List<double> averageClusterDistance) {
+      double maxValue = averageClusterDistance[0];
+      int maxElementNumber = 0;
+      for (int i = 1; i < averageClusterDistance.Count(); i++) {
+        if (averageClusterDistance[i] > maxValue) {
+          maxValue = averageClusterDistance[i];
+          maxElementNumber = i;
+        }
+      }
+      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); }
+      }
+      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 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/HeuristicLab.Algorithms.EvolvmentModelsOfModels.csproj	(revision 17002)
@@ -128,7 +128,11 @@
     <Compile Include="EMMBaseAlgorithm.cs" />
     <Compile Include="EMMNetworkMap.cs" />
+    <Compile Include="EMMSucsessMap.cs" />
+    <Compile Include="EMMZeroMap.cs" />
     <Compile Include="HelpFunctions.cs" />
+    <Compile Include="ModelClustersFrequencyAnalyzer.cs" />
     <Compile Include="Plugin.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="EMMRankMap.cs" />
   </ItemGroup>
   <ItemGroup>
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/ModelClustersFrequencyAnalyzer.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/ModelClustersFrequencyAnalyzer.cs	(revision 17002)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/ModelClustersFrequencyAnalyzer.cs	(revision 17002)
@@ -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("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: anches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Plugin.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Plugin.cs	(revision 17001)
+++ 	(revision )
@@ -1,45 +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.PluginInfrastructure;
-
-namespace HeuristicLab.Algorithms.EMMAlgorithm {
-  /// <summary>
-  /// Plugin class for HeuristicLab.Algorithms.EMMAlgorithm plugin.
-  /// </summary>
-  [Plugin("HeuristicLab.Algorithms.EMMAlgorithm", "3.3.15.16760")]
-  [PluginFile("HeuristicLab.Algorithms.EMMAlgorithm-3.3.dll", PluginFileType.Assembly)]
-  [PluginDependency("HeuristicLab.Analysis", "3.3")]
-  [PluginDependency("HeuristicLab.Collections", "3.3")]
-  [PluginDependency("HeuristicLab.Common", "3.3")]
-  [PluginDependency("HeuristicLab.Core", "3.3")]
-  [PluginDependency("HeuristicLab.Data", "3.3")]
-  [PluginDependency("HeuristicLab.Operators", "3.3")]
-  [PluginDependency("HeuristicLab.Optimization", "3.3")]
-  [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")]
-  [PluginDependency("HeuristicLab.Parameters", "3.3")]
-  [PluginDependency("HeuristicLab.Persistence", "3.3")]
-  [PluginDependency("HeuristicLab.Random", "3.3")]
-  [PluginDependency("HeuristicLab.Selection", "3.3")]
-  [PluginDependency("HeuristicLab.Attic", "1.0")]
-  public class HeuristicLabAlgorithmsEMMAlgorithmPlugin : PluginBase {
-  }
-}
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Plugin.cs.frame
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Plugin.cs.frame	(revision 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Plugin.cs.frame	(revision 17002)
@@ -28,4 +28,5 @@
   [Plugin("HeuristicLab.Algorithms.EMMAlgorithm", "3.3.15.$WCREV$")]
   [PluginFile("HeuristicLab.Algorithms.EMMAlgorithm-3.3.dll", PluginFileType.Assembly)]
+  [PluginDependency("HeuristicLab.Algorithms.DataAnalysis", "3.4")]
   [PluginDependency("HeuristicLab.Analysis", "3.3")]
   [PluginDependency("HeuristicLab.Collections", "3.3")]
@@ -33,9 +34,9 @@
   [PluginDependency("HeuristicLab.Core", "3.3")]
   [PluginDependency("HeuristicLab.Data", "3.3")]
+  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")]
   [PluginDependency("HeuristicLab.Operators", "3.3")]
   [PluginDependency("HeuristicLab.Optimization", "3.3")]
-  [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")]
   [PluginDependency("HeuristicLab.Parameters", "3.3")]
-  [PluginDependency("HeuristicLab.Persistence", "3.3")]
+  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")]
   [PluginDependency("HeuristicLab.Random", "3.3")]
   [PluginDependency("HeuristicLab.Selection", "3.3")]
Index: anches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/ModelClustersFrequencyAnalyzer.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/ModelClustersFrequencyAnalyzer.cs	(revision 17001)
+++ 	(revision )
@@ -1,147 +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.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
-    [Storable]
-    public ILookupParameter<DataTable> ModelClustersFrequencyParameter {
-      get { return (ILookupParameter<DataTable>)Parameters[ModelClustersFrequencyParameterName]; }
-    }
-    [Storable]
-    public IValueLookupParameter<BoolValue> AggregateModelClustersParameter {
-      get { return (IValueLookupParameter<BoolValue>)Parameters[AggregateModelClustersParameterName]; }
-    }
-    #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)));
-    }
-
-    [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)) {
-        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) {
-      var modelClustersFrequency = trees
-          .SelectMany(t => GetModelClustersReferences(t))
-          .GroupBy(pair => pair.Key, pair => pair.Value)
-          .ToDictionary(g => g.Key, g => (double)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, int>> GetModelClustersReferences(ISymbolicExpressionTree tree) {
-      Dictionary<string, int> references = new Dictionary<string, int>();
-      foreach (var treeNode in tree.IterateNodesPrefix().OfType<TreeModelTreeNode>()) {
-        string referenceId = "Cluster " + treeNode.ClusterNumer;
-        if (references.ContainsKey(referenceId)) {
-          references[referenceId]++;
-        } else {
-          references[referenceId] = 1;
-        }
-      }
-      return references;
-    }
-  }
-}
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/ModelsFrequencyAnalyzer.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/ModelsFrequencyAnalyzer.cs	(revision 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/ModelsFrequencyAnalyzer.cs	(revision 17002)
@@ -43,9 +43,9 @@
 
     #region parameter properties
-    [Storable]
+
     public ILookupParameter<DataTable> ModelFrequencyParameter {
       get { return (ILookupParameter<DataTable>)Parameters[ModelsFrequencyParameterName]; }
     }
-    [Storable]
+
     public IValueLookupParameter<BoolValue> AggregateModelParameter {
       get { return (IValueLookupParameter<BoolValue>)Parameters[AggregateModelParameterName]; }
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/TerminalNodesFrequencyAnalyzer.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/TerminalNodesFrequencyAnalyzer.cs	(revision 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/TerminalNodesFrequencyAnalyzer.cs	(revision 17002)
@@ -43,9 +43,7 @@
 
     #region parameter properties
-    [Storable]
     public ILookupParameter<DataTable> TerminalNodesFrequencyParameter {
       get { return (ILookupParameter<DataTable>)Parameters[TerminalNodesFrequencyParameterName]; }
     }
-    [Storable]
     public IValueLookupParameter<BoolValue> AggregateTerminalNodesParameter {
       get { return (IValueLookupParameter<BoolValue>)Parameters[AggregateTerminalNodesParameterName]; }
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(revision 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(revision 17002)
@@ -216,5 +216,4 @@
     <Compile Include="Analyzers\MinAverageMaxSymbolicExpressionTreeVariablesNumberAnalyzer.cs" />
     <Compile Include="Analyzers\MinAverageMaxSymbolicExpressionTreeComplexcityAnalyzer.cs" />
-    <Compile Include="Analyzers\ModelClustersFrequencyAnalyzer.cs" />
     <Compile Include="Analyzers\ModelsFrequencyAnalyzer.cs" />
     <Compile Include="Analyzers\SymbolicDataAnalysisBottomUpDiversityAnalyzer.cs" />
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 17001)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ModelTreeNode.cs	(revision 17002)
@@ -39,10 +39,6 @@
       set { tree = value; }
     }
-    int clusterNumer = -10;
-    int treeNumber = 0;
-    public int ClusterNumer {
-      get { return clusterNumer; }
-      set { clusterNumer = value; }
-    }
+    [Storable]
+    int treeNumber = -10;
     public int TreeNumber {
       get { return treeNumber; }
@@ -51,19 +47,14 @@
 
     [StorableConstructor]
-    private TreeModelTreeNode(StorableConstructorFlag _) : base(_) {
-      ClusterNumer = -10;
-    }
+    private TreeModelTreeNode(StorableConstructorFlag _) : base(_) { }
 
     private TreeModelTreeNode(TreeModelTreeNode original, Cloner cloner)
       : base(original, cloner) {
       tree = (ISymbolicExpressionTree)original.tree.Clone(cloner);
-      ClusterNumer = original.ClusterNumer;
       TreeNumber = original.TreeNumber;
     }
 
     private TreeModelTreeNode() : base() { }
-    public TreeModelTreeNode(TreeModel treeModelSymbol) : base(treeModelSymbol) {
-      ClusterNumer = -10;
-    }
+    public TreeModelTreeNode(TreeModel treeModelSymbol) : base(treeModelSymbol) { }
 
     public override bool HasLocalParameters {
