Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm.cs	(revision 16733)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMAlgorithm.cs	(revision 16734)
@@ -37,5 +37,5 @@
   [Item("EvolvmentModelsOfModels Algorithm ", "EMM implementation")]
   [Creatable(CreatableAttribute.Categories.PopulationBasedAlgorithms, Priority = 125)]
-  [StorableType("D02C50E5-8325-496F-8DEA-C23651756846")]
+  [StorableType("AD23B21F-089A-4C6C-AD2E-1B01E7939CF5")]
   public class EMMAlgorithm : EvolvmentModelsOfModelsAlgorithmBase {
     public EMMMapTreeModel Map { get; private set; }
@@ -57,11 +57,39 @@
       InfixExpressionParser parser = new InfixExpressionParser();
       var trees = File.ReadAllLines(InputFileParameter.Value.Value).Select(parser.Parse);
-      Map = new EMMMapTreeModel(RandomParameter.Value, trees, ClusterNumbersParameter.Value.Value);
-      ClusterNumbersParameter.Value.Value = Map.K;
-      if (previousExecutionState != ExecutionState.Paused) {
-        InitializeAlgorithm(cancellationToken);
-      }
-      globalScope.Variables.Add(new Variable("TreeModelMap", Map));
-      EMMEvolutionaryAlgorithmRun(cancellationToken);
+      // this.Problem.SymbolicExpressionTreeGrammar;
+      /*   Problem.ProblemData.Dataset.ColumnNames.Take(2).ToList();
+         trees.First().Root.Grammar.ContainsSymbol((IVariable)a).
+           = this.Problem.SymbolicExpressionTreeGrammar;*/
+      int flag = 1;
+      switch (flag) {
+        case 0: // for case when we want only create map, and do  not want made somting also.
+          Map = new EMMMapTreeModel(RandomParameter.Value, trees, ClusterNumbersParameter.Value.Value);
+          ClusterNumbersParameter.Value.Value = Map.K;
+          File.WriteAllLines("Map.txt", Map.MapToString());
+          File.WriteAllLines("MapToSee.txt", Map.MapToSee());
+          globalScope = new Scope("Global Scope");
+          executionContext = new ExecutionContext(null, this, globalScope);
+          break;
+        case 1: // for case when we want read existed map and work with it;
+          Map = new EMMMapTreeModel(RandomParameter.Value, trees);
+          ClusterNumbersParameter.Value.Value = Map.K;
+          if (previousExecutionState != ExecutionState.Paused) {
+            InitializeAlgorithm(cancellationToken);
+          }
+          globalScope.Variables.Add(new Variable("TreeModelMap", Map));
+          EMMEvolutionaryAlgorithmRun(cancellationToken);
+          break;
+
+        default: //for case of usial from zero step starting
+          Map = new EMMMapTreeModel(RandomParameter.Value, trees, ClusterNumbersParameter.Value.Value);
+          ClusterNumbersParameter.Value.Value = Map.K;
+          if (previousExecutionState != ExecutionState.Paused) {
+            InitializeAlgorithm(cancellationToken);
+          }
+          globalScope.Variables.Add(new Variable("TreeModelMap", Map));
+          EMMEvolutionaryAlgorithmRun(cancellationToken);
+          break;
+      }
+
     }
     private void EMMEvolutionaryAlgorithmRun(CancellationToken cancellationToken) {
@@ -201,5 +229,5 @@
         foreach (var node in tree.IterateNodesPostfix().OfType<TreeModelTreeNode>()) {
           node.Tree = Map.NewModelForInizializtion(random, out int cluster, out int treeNumber);
-          node.Tree.Root.ShakeLocalParameters(random, 0.5);
+          node.SetLocalParameters(random, 0.5);
           node.ClusterNumer = cluster;
           node.TreeNumber = treeNumber;
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMBaseAlgorithm.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMBaseAlgorithm.cs	(revision 16733)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMBaseAlgorithm.cs	(revision 16734)
@@ -40,5 +40,5 @@
 namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
   [Item("MOEADAlgorithmBase", "Base class for all MOEA/D algorithm variants.")]
-  [StorableType("DD721D8A-A4DE-44C1-8D83-7888E8433B5F")]
+  [StorableType("A56A396B-965A-4ADE-8A2B-AE3A45F9C239")]
   public abstract class EvolvmentModelsOfModelsAlgorithmBase : FixedDataAnalysisAlgorithm<ISymbolicDataAnalysisSingleObjectiveProblem> {
     #region data members
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMapBase.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMapBase.cs	(revision 16733)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMapBase.cs	(revision 16734)
@@ -25,5 +25,5 @@
 
 namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [StorableType("8A5818D6-2B74-4148-AFBC-D36CE6256406")]
+  [StorableType("83CF9650-98FF-454B-9072-82EA4D39C752")]
   public abstract class EMMMapBase<T> : Item where T : class {
     public List<T> ModelSet { get; set; }
@@ -34,5 +34,5 @@
 
     protected abstract void CalculateDistances();
-    public abstract void CreateMap(IRandom random, int k);
+    protected abstract void CreateMap(IRandom random, int k);
     public abstract T NewModelForInizializtion(IRandom random, out int cluster, out int treeNumber);
 
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMapTreeModel.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMapTreeModel.cs	(revision 16733)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMapTreeModel.cs	(revision 16734)
@@ -26,9 +26,10 @@
 using HeuristicLab.Problems.DataAnalysis.Symbolic;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 
 namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [StorableType("A9AE93F0-E589-44D0-AD34-0E3AA358D669")]
   [Item("TreeModelMap", "A map of models of models of models")]
+  [StorableType("E4AB04B9-FD5D-47EE-949D-243660754F3A")]
   public class EMMMapTreeModel : EMMMapBase<ISymbolicExpressionTree> {
     #region conctructors
@@ -62,4 +63,19 @@
       CreateMap(random, k);
     }
+    public EMMMapTreeModel(IRandom random, IEnumerable<ISymbolicExpressionTree> trees) : this(1) {
+      ModelSet = trees.ToList();
+      string input = File.ReadAllText("Map.txt");
+
+      int i = 0;
+      foreach (var row in input.Split('\n')) {
+        Map.Add(new List<int>());
+        foreach (var col in row.Trim().Split(' ')) {
+          Map[i].Add(int.Parse(col.Trim()));
+        }
+        i++;
+      }
+      K = Map.Count;
+      MapPreparation();
+    }
     public override IDeepCloneable Clone(Cloner cloner) {
       return new EMMMapTreeModel(this, cloner);
@@ -75,5 +91,5 @@
       }
     }
-    override public void CreateMap(IRandom random, int k) {
+    override protected void CreateMap(IRandom random, int k) {
       K = k;
       //Clusterization
@@ -96,4 +112,16 @@
       }
     }
+    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;
+        }
+      }
+    }
     #endregion
     #region Dialog with surroudings
@@ -103,4 +131,26 @@
       return (ISymbolicExpressionTree)ModelSet[treeNumber].Clone();
     }
+    public string[] MapToString() {
+      string[] s;
+      s = new string[K];
+      for (int i = 0; i < K; i++) {
+        s[i] = "";
+        for (int j = 0; j < Map[i].Count; j++) {
+          s[i] += Map[i][j].ToString();
+          s[i] += " ";
+        }
+      }
+      return s;
+    }
+    public string[] MapToSee() {
+      var fmt = new InfixExpressionFormatter();
+      string[] s;
+      s = new string[(ModelSet.Count) + 1];
+      s[0] = "ClusterNumber" + "," + "Modfelnumber" + "," + "Model";
+      for (int i = 1; i < ((ModelSet.Count) + 1); i++) {
+        s[i] = ClusterNumber[i - 1].ToString() + "," + (i - 1).ToString() + "," + fmt.Format(ModelSet[i - 1]);
+      }
+      return s;
+    }
 
     #endregion
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMutators.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMutators.cs	(revision 16733)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMMutators.cs	(revision 16734)
@@ -32,6 +32,6 @@
 
 namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
-  [StorableType("92D37E9F-8726-4524-AF8F-F3787641F7B9")]
   [Item("EMMChangeNodeTypeManipulation", "Selects a random tree node and changes the symbol.")]
+  [StorableType("990D3946-7F06-48B4-B8DB-F8E308D6304D")]
   public sealed class EMMMutators : SymbolicExpressionTreeManipulator {
     private const int MAX_TRIES = 100;
@@ -125,8 +125,8 @@
             int p = random.Next(map.Count);
             if (child is TreeModelTreeNode chNode) // in real life never bacame true. It need some cheking
-              p = chNode.ClusterNumer;
+            { p = chNode.ClusterNumer; }
             treeNode.TreeNumber = map[p].SampleRandom(random).Value;
             treeNode.Tree = (ISymbolicExpressionTree)modelSet[treeNode.TreeNumber].Clone();
-            treeNode.Tree.Root.ShakeLocalParameters(random, 0.5);
+            treeNode.SetLocalParameters(random, 0.5);
           } else
             newNode.ResetLocalParameters(random);
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMSolution.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMSolution.cs	(revision 16733)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMSolution.cs	(revision 16734)
@@ -26,4 +26,5 @@
 // Can be deleted potnetinaly
 namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
+  [StorableType("AB38211D-5F52-4420-A606-1C3CB58BA27C")]
   public interface IEMMSolution : IItem {
     IItem Individual { get; set; }
@@ -31,5 +32,5 @@
   }
   [Item("EMMSolution", "Represents a solution inside the EMM population")]
-  [StorableType("708BDF29-AD3F-4AFC-83AE-551A27FF45A0")]
+  [StorableType("C0E63430-5000-4592-BBE4-2D3E0EE1AE3F")]
   public class EMMSolution : Item, IEMMSolution {
     [Storable]
@@ -69,5 +70,5 @@
   }
   [Item("EMMSolution", "Represents a solution inside the EMM population")]
-  [StorableType("36929CD1-63A5-4270-8C65-2A8177BCA0AE")]
+  [StorableType("559EA31B-2263-4233-900C-EC62120EE580")]
   public class EMMSolution<T> : EMMSolution where T : class, IItem {
     public new T Individual {
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Plugin.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Plugin.cs	(revision 16733)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/Plugin.cs	(revision 16734)
@@ -26,5 +26,5 @@
   /// Plugin class for HeuristicLab.Algorithms.EMMAlgorithm plugin.
   /// </summary>
-  [Plugin("HeuristicLab.Algorithms.EMMAlgorithm", "3.3.15.16565")]
+  [Plugin("HeuristicLab.Algorithms.EMMAlgorithm", "3.3.15.16722")]
   [PluginFile("HeuristicLab.Algorithms.EMMAlgorithm-3.3.dll", PluginFileType.Assembly)]
   [PluginDependency("HeuristicLab.Analysis", "3.3")]
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/ModelClustersFrequencyAnalyzer.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/ModelClustersFrequencyAnalyzer.cs	(revision 16734)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/ModelClustersFrequencyAnalyzer.cs	(revision 16734)
@@ -0,0 +1,141 @@
+﻿#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
+    public ILookupParameter<DataTable> ModelClustersFrequencyParameter {
+      get { return (ILookupParameter<DataTable>)Parameters[ModelClustersFrequencyParameterName]; }
+    }
+    public IValueLookupParameter<BoolValue> AggregateModelClustersParameter {
+      get { return (IValueLookupParameter<BoolValue>)Parameters[AggregateModelClustersParameterName]; }
+    }
+    #endregion
+    #region properties
+    public BoolValue AggregateModelClusters {
+      get { return AggregateModelClustersParameter.ActualValue; }
+      set { AggregateModelClustersParameter.Value = 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 16734)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/ModelsFrequencyAnalyzer.cs	(revision 16734)
@@ -0,0 +1,147 @@
+﻿#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("SymbolicDataAnalysisModelsFrequencyAnalyzer", "Calculates the accumulated frequencies of Model Clusters over all trees in the population.")]
+  [StorableType("0A5EAD1D-89E1-4D89-935C-2CBC142834EE")]
+  public sealed class ModelsFrequencyAnalyzer : SymbolicDataAnalysisAnalyzer {
+    private const string ModelsFrequencyParameterName = "ModelsFrequency";
+    private const string AggregateModelParameterName = "AggregateModelClusters";
+
+    #region parameter properties
+    public ILookupParameter<DataTable> ModelFrequencyParameter {
+      get { return (ILookupParameter<DataTable>)Parameters[ModelsFrequencyParameterName]; }
+    }
+    public IValueLookupParameter<BoolValue> AggregateModelParameter {
+      get { return (IValueLookupParameter<BoolValue>)Parameters[AggregateModelParameterName]; }
+    }
+    #endregion
+    #region properties
+    public BoolValue AggregateModel {
+      get { return AggregateModelParameter.ActualValue; }
+      set { AggregateModelParameter.Value = value; }
+    }
+    #endregion
+    [StorableConstructor]
+    private ModelsFrequencyAnalyzer(StorableConstructorFlag _) : base(_) { }
+    private ModelsFrequencyAnalyzer(ModelsFrequencyAnalyzer original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public ModelsFrequencyAnalyzer()
+      : base() {
+      Parameters.Add(new LookupParameter<DataTable>(ModelsFrequencyParameterName, "The relative Model Clusters reference frequencies aggregated over all trees in the population."));
+      Parameters.Add(new ValueLookupParameter<BoolValue>(AggregateModelParameterName, "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(AggregateModelParameterName)) {
+        Parameters.Add(new ValueLookupParameter<BoolValue>(AggregateModelParameterName, "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 ModelsFrequencyAnalyzer(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      ItemArray<ISymbolicExpressionTree> expressions = SymbolicExpressionTreeParameter.ActualValue;
+      ResultCollection results = ResultCollection;
+      DataTable datatable;
+      if (ModelFrequencyParameter.ActualValue == null) {
+        datatable = new DataTable("Model frequencies", "Relative frequency of Model references aggregated over the whole population.");
+        datatable.VisualProperties.XAxisTitle = "Generation";
+        datatable.VisualProperties.YAxisTitle = "Relative Model Frequency";
+        ModelFrequencyParameter.ActualValue = datatable;
+        results.Add(new Result("Model frequencies", "Relative frequency of Modelreferences aggregated over the whole population.", datatable));
+      }
+      /* DoubleMatrix map;
+       if (results.ContainsKey("My Map")) {
+         map = (DoubleMatrix)results["My Map"];
+       } else {
+         int generations = 100;
+         map = new DoubleMatrix(generations, expressions.Length);
+       }*/
+      datatable = ModelFrequencyParameter.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 CalculateModelFrequency(expressions).OrderByDescending(x => x.Value)) {
+        //var pair in CalculateModelFrequency(expressions).OrderByDescending(x => x.Value).Take(10)
+        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>> CalculateModelFrequency(IEnumerable<ISymbolicExpressionTree> trees) {
+      var modelFrequency = trees
+          .SelectMany(t => GetModelReferences(t))
+          .GroupBy(pair => pair.Key, pair => pair.Value)
+          .ToDictionary(g => g.Key, g => (double)g.Sum());
+
+      double totalNumberOfSymbols = modelFrequency.Values.Sum();
+
+      foreach (var pair in modelFrequency.OrderBy(p => p.Key, new NaturalStringComparer()))
+        yield return new KeyValuePair<string, double>(pair.Key, pair.Value / totalNumberOfSymbols);
+    }
+
+    private static IEnumerable<KeyValuePair<string, int>> GetModelReferences(ISymbolicExpressionTree tree) {
+      Dictionary<string, int> references = new Dictionary<string, int>();
+      foreach (var treeNode in tree.IterateNodesPrefix().OfType<TreeModelTreeNode>()) {
+        string referenceId = "Model " + treeNode.TreeNumber;
+        if (references.ContainsKey(referenceId)) {
+          references[referenceId]++;
+        } else {
+          references[referenceId] = 1;
+        }
+      }
+      return references;
+    }
+  }
+}
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisVariableFrequencyAnalyzer.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisVariableFrequencyAnalyzer.cs	(revision 16733)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisVariableFrequencyAnalyzer.cs	(revision 16734)
@@ -20,7 +20,5 @@
 #endregion
 
-using System;
-using System.Collections.Generic;
-using System.Linq;
+using HEAL.Attic;
 using HeuristicLab.Analysis;
 using HeuristicLab.Common;
@@ -30,5 +28,7 @@
 using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
-using HEAL.Attic;
+using System;
+using System.Collections.Generic;
+using System.Linq;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
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 16733)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj	(revision 16734)
@@ -216,4 +216,6 @@
     <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" />
     <Compile Include="Analyzers\SymbolicDataAnalysisBuildingBlockAnalyzer.cs" />
@@ -232,4 +234,5 @@
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Analyzers\SymbolicDataAnalysisVariableFrequencyAnalyzer.cs" />
     <Compile Include="Converters\LinearModelToTreeConverter.cs" />
     <Compile Include="Converters\TreeSimplifier.cs" />
@@ -260,5 +263,4 @@
     <Compile Include="SymbolicDataAnalysisModelComplexityCalculator.cs" />
     <Compile Include="SymbolicDataAnalysisExpressionPruningOperator.cs" />
-    <Compile Include="Analyzers\SymbolicDataAnalysisVariableFrequencyAnalyzer.cs" />
     <Compile Include="Analyzers\SymbolicDataAnalysisAlleleFrequencyAnalyzer.cs" />
     <Compile Include="Creators\MultiSymbolicDataAnalysisExpressionCreator.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 16733)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/ModelTreeNode.cs	(revision 16734)
@@ -25,9 +25,8 @@
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
 using HeuristicLab.Random;
-using System.Collections.Generic;
-
+using System.Linq;
 
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableType("38C37AED-5B9D-488E-8785-D8FF541D9B4C")]
+  [StorableType("44B25E73-6C4D-404C-93E5-42B7D2807CF7")]
   public sealed class TreeModelTreeNode : SymbolicExpressionTreeTerminalNode {
     public new TreeModel Symbol {
@@ -71,33 +70,28 @@
       get { return true; }
     }
-    //public override void ResetLocalParameters(IRandom random, List<ISymbolicExpressionTree> modelSet, List<List<int>> map, List<int> cLusterNumber) {
-    //  base.ResetLocalParameters(random);
-    //  if (ClusterNumer < 0) {
-    //    //Tree = map.NewModelForInizializtion(ClusterNumer, random);
-    //    var selectedNodelNumber = random.Next(modelSet.Count);
-    //    ClusterNumer = cLusterNumber[selectedNodelNumber];
-    //    TreeNumber = selectedNodelNumber;
-    //    Tree = (ISymbolicExpressionTree)modelSet[selectedNodelNumber].Clone();
-    //  } else {
-    //    //New Model For Mutation Adding
-    //    var selectedNodelNumber = random.Next(map[ClusterNumer].Count);
-    //    TreeNumber = selectedNodelNumber;
-    //    Tree = (ISymbolicExpressionTree)modelSet[map[ClusterNumer][selectedNodelNumber]].Clone();
-    //  }
-
-    //}
-
     public override void ShakeLocalParameters(IRandom random, double shakingFactor) {
       base.ShakeLocalParameters(random, shakingFactor);
-      List<ISymbolicExpressionTreeNode> parametricNodes = new List<ISymbolicExpressionTreeNode>();
-      Tree.Root.ForEachNodePostfix(n => {
-        if (n.HasLocalParameters) parametricNodes.Add(n);
-      });
-      if (parametricNodes.Count > 0) {
+      var parametricNodes = Tree.IterateNodesPrefix().Where(x => x.HasLocalParameters).ToList();
+      if (parametricNodes.Any()) {
         var selectedPoint = parametricNodes.SampleRandom(random);
-        selectedPoint.ShakeLocalParameters(random, shakingFactor);
+        if (selectedPoint is VariableTreeNode variableTreeNode) {
+          var symbol = variableTreeNode.Symbol;
+          variableTreeNode.Weight = NormalDistributedRandom.NextDouble(random, symbol.WeightManipulatorMu, symbol.WeightManipulatorSigma);
+        } else {
+          selectedPoint.ShakeLocalParameters(random, shakingFactor);
+        }
+
       }
     }
-
+    public void SetLocalParameters(IRandom random, double shakingFactor) {
+      foreach (var node in Tree.IterateNodesPrefix().Where(x => x.HasLocalParameters)) {
+        if (node is VariableTreeNode variableTreeNode) {
+          var symbol = variableTreeNode.Symbol;
+          variableTreeNode.Weight = NormalDistributedRandom.NextDouble(random, symbol.WeightManipulatorMu, symbol.WeightManipulatorSigma);
+        } else {
+          node.ResetLocalParameters(random);
+        }
+      }
+    }
     public override IDeepCloneable Clone(Cloner cloner) {
       return new TreeModelTreeNode(this, cloner);
@@ -106,5 +100,5 @@
     public override string ToString() {
 
-      string s = "model" +" " +TreeNumber.ToString()+"\n " + new InfixExpressionFormatter().Format(tree);
+      string s = "model" + " " + TreeNumber.ToString() + "\n " + new InfixExpressionFormatter().Format(tree);
       return s;
     }
Index: /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/TreeModel.cs
===================================================================
--- /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/TreeModel.cs	(revision 16733)
+++ /branches/2988_ModelsOfModels2/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/TreeModel.cs	(revision 16734)
@@ -20,11 +20,9 @@
 #endregion
 
-using System;
-using System.Collections.Generic;
+using HEAL.Attic;
 using HeuristicLab.Common;
 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HEAL.Attic;
 namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
-  [StorableType("F8A6AD96-28D9-4BEC-8392-8B7BA824B085")]
+  [StorableType("6F628649-7C71-49F3-862A-0BAB4BADF964")]
   public sealed class TreeModel : Symbol {
 
@@ -39,8 +37,9 @@
     [StorableConstructor]
     private TreeModel(StorableConstructorFlag _) : base(_) { }
-    private TreeModel(TreeModel original, Cloner cloner) : base(original, cloner) {   }
-    public TreeModel() : base("TreeModel", "Represents a TreeModel.") {    }
+    private TreeModel(TreeModel original, Cloner cloner) : base(original, cloner) { }
+    public TreeModel() : base("TreeModel", "Represents a TreeModel.") { }
     public override ISymbolicExpressionTreeNode CreateTreeNode() {
-      return new TreeModelTreeNode(this); }  
+      return new TreeModelTreeNode(this);
+    }
 
     public override IDeepCloneable Clone(Cloner cloner) {
