Index: branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/DefaultSymbolicExpressionGrammar.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/DefaultSymbolicExpressionGrammar.cs	(revision 5712)
+++ 	(revision )
@@ -1,330 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
-  /// <summary>
-  /// The default symbolic expression grammar stores symbols and syntactic constraints for symbols.
-  /// Symbols are treated as equvivalent if they have the same name.
-  /// Syntactic constraints limit the number of allowed sub trees for a node with a symbol and which symbols are allowed 
-  /// in the sub-trees of a symbol (can be specified for each sub-tree index separately).
-  /// </summary>
-  [StorableClass]
-  [Item("DefaultSymbolicExpressionGrammar", "Represents a grammar that defines the syntax of symbolic expression trees.")]
-  public abstract class DefaultSymbolicExpressionGrammar : Item, ISymbolicExpressionTreeGrammar {
-
-    #region properties for separation between implementation and persistence
-    [Storable]
-    private IEnumerable<KeyValuePair<string, int>> MinSubTreeCount {
-      get { return minSubTreeCount.AsEnumerable(); }
-      set { minSubTreeCount = value.ToDictionary(x => x.Key, x => x.Value); }
-    }
-
-    [Storable]
-    private IEnumerable<KeyValuePair<string, int>> MaxSubTreeCount {
-      get { return maxSubTreeCount.AsEnumerable(); }
-      set { maxSubTreeCount = value.ToDictionary(x => x.Key, x => x.Value); }
-    }
-
-    [Storable]
-    private IEnumerable<KeyValuePair<string, IEnumerable<IEnumerable<string>>>> AllowedChildSymbols {
-      get {
-        return (from parentEntry in allowedChildSymbols
-                let setEnumeration = parentEntry.Value.Select(set => set.AsEnumerable()).ToList()
-                select new KeyValuePair<string, IEnumerable<IEnumerable<string>>>(parentEntry.Key, setEnumeration))
-                .ToList();
-      }
-      set {
-        allowedChildSymbols = new Dictionary<string, List<List<string>>>();
-        foreach (var pair in value) {
-          allowedChildSymbols[pair.Key] = new List<List<string>>();
-          foreach (var entry in pair.Value) {
-            var hashSet = new List<string>();
-            foreach (string child in entry) {
-              hashSet.Add(child);
-            }
-            allowedChildSymbols[pair.Key].Add(hashSet);
-          }
-        }
-      }
-    }
-    [Storable]
-    private IEnumerable<KeyValuePair<string, ISymbol>> AllSymbols {
-      get { return allSymbols.AsEnumerable(); }
-      set { allSymbols = value.ToDictionary(x => x.Key, x => x.Value); }
-    }
-    #endregion
-
-    private Dictionary<string, int> minSubTreeCount;
-    private Dictionary<string, int> maxSubTreeCount;
-    private Dictionary<string, List<List<string>>> allowedChildSymbols;
-    private Dictionary<string, ISymbol> allSymbols;
-    [Storable]
-    private ISymbol startSymbol;
-
-    [StorableConstructor]
-    protected DefaultSymbolicExpressionGrammar(bool deserializing)
-      : base(deserializing) {
-      cachedMinExpressionLength = new Dictionary<string, int>();
-      cachedMaxExpressionLength = new Dictionary<string, int>();
-      cachedMinExpressionDepth = new Dictionary<string, int>();
-    }
-    // cloning ctor
-    protected DefaultSymbolicExpressionGrammar(DefaultSymbolicExpressionGrammar original, Cloner cloner)
-      : base(original, cloner) {
-      this.cachedMinExpressionLength = new Dictionary<string, int>();
-      this.cachedMaxExpressionLength = new Dictionary<string, int>();
-      this.cachedMinExpressionDepth = new Dictionary<string, int>();
-      minSubTreeCount = new Dictionary<string, int>(original.minSubTreeCount);
-      maxSubTreeCount = new Dictionary<string, int>(original.maxSubTreeCount);
-
-      allSymbols = new Dictionary<string, ISymbol>();
-      foreach (ISymbol symbol in original.allSymbols.Values.Select(s => cloner.Clone(s)))
-        allSymbols.Add(symbol.Name, symbol);
-
-      startSymbol = cloner.Clone<ISymbol>(original.startSymbol);
-      allowedChildSymbols = new Dictionary<string, List<List<string>>>();
-      foreach (var entry in original.allowedChildSymbols) {
-        allowedChildSymbols[entry.Key] = new List<List<string>>(entry.Value.Count);
-        foreach (var set in entry.Value) {
-          allowedChildSymbols[entry.Key].Add(new List<string>(set));
-        }
-      }
-    }
-    protected DefaultSymbolicExpressionGrammar()
-      : base() {
-      this.minSubTreeCount = new Dictionary<string, int>();
-      this.maxSubTreeCount = new Dictionary<string, int>();
-      this.allowedChildSymbols = new Dictionary<string, List<List<string>>>();
-      this.allSymbols = new Dictionary<string, ISymbol>();
-      this.cachedMinExpressionLength = new Dictionary<string, int>();
-      this.cachedMaxExpressionLength = new Dictionary<string, int>();
-      this.cachedMinExpressionDepth = new Dictionary<string, int>();
-
-      this.startSymbol = new StartSymbol();
-      this.AddSymbol(startSymbol);
-      this.SetMinSubtreeCount(startSymbol, 1);
-      this.SetMaxSubtreeCount(startSymbol, 1);
-    }
-
-    protected DefaultSymbolicExpressionGrammar(ISymbolicExpressionTreeGrammar grammar)
-      : base() {
-      Cloner cloner = new Cloner();
-      this.cachedMinExpressionLength = new Dictionary<string, int>();
-      this.cachedMaxExpressionLength = new Dictionary<string, int>();
-      this.cachedMinExpressionDepth = new Dictionary<string, int>();
-
-      this.minSubTreeCount = new Dictionary<string, int>();
-      this.maxSubTreeCount = new Dictionary<string, int>();
-      this.allowedChildSymbols = new Dictionary<string, List<List<string>>>();
-      this.allSymbols = new Dictionary<string, ISymbol>();
-
-      this.StartSymbol = (ISymbol)cloner.Clone(grammar.StartSymbol);
-
-      foreach (ISymbol symbol in grammar.Symbols) {
-        ISymbol clonedSymbol = (ISymbol)cloner.Clone(symbol);
-        this.AddSymbol(clonedSymbol);
-        this.SetMinSubtreeCount(clonedSymbol, grammar.GetMinSubtreeCount(symbol));
-        this.SetMaxSubtreeCount(clonedSymbol, grammar.GetMaxSubtreeCount(symbol));
-      }
-
-      foreach (ISymbol parent in grammar.Symbols) {
-        for (int i = 0; i < grammar.GetMaxSubtreeCount(parent); i++) {
-          foreach (ISymbol child in grammar.Symbols) {
-            if (grammar.IsAllowedChild(parent, child, i)) {
-              this.SetAllowedChild((ISymbol)cloner.Clone(parent), (ISymbol)cloner.Clone(child), i);
-            }
-          }
-        }
-      }
-    }
-
-    public void Clear() {
-      minSubTreeCount.Clear();
-      maxSubTreeCount.Clear();
-      allowedChildSymbols.Clear();
-      allSymbols.Clear();
-
-      cachedMaxExpressionLength.Clear();
-      cachedMinExpressionLength.Clear();
-      cachedMinExpressionDepth.Clear();
-
-      startSymbol = new StartSymbol();
-      AddSymbol(startSymbol);
-      SetMinSubtreeCount(startSymbol, 1);
-      SetMaxSubtreeCount(startSymbol, 1);
-    }
-
-    #region ISymbolicExpressionGrammar Members
-    public ISymbol StartSymbol {
-      get { return startSymbol; }
-      set { startSymbol = value; }
-    }
-
-    public void AddSymbol(ISymbol symbol) {
-      if (ContainsSymbol(symbol)) throw new ArgumentException("Symbol " + symbol + " is already defined.");
-      allSymbols.Add(symbol.Name, symbol);
-      allowedChildSymbols[symbol.Name] = new List<List<string>>();
-      ClearCaches();
-    }
-
-    public void RemoveSymbol(ISymbol symbol) {
-      foreach (var parent in Symbols) {
-        for (int i = 0; i < GetMaxSubtreeCount(parent); i++)
-          if (IsAllowedChild(parent, symbol, i))
-            allowedChildSymbols[parent.Name][i].Remove(symbol.Name);
-      }
-      allSymbols.Remove(symbol.Name);
-      minSubTreeCount.Remove(symbol.Name);
-      maxSubTreeCount.Remove(symbol.Name);
-      allowedChildSymbols.Remove(symbol.Name);
-      ClearCaches();
-    }
-
-    public IEnumerable<ISymbol> Symbols {
-      get { return allSymbols.Values.AsEnumerable(); }
-    }
-
-    public bool ContainsSymbol(ISymbol symbol) {
-      return allSymbols.ContainsKey(symbol.Name);
-    }
-
-    public void SetAllowedChild(ISymbol parent, ISymbol child, int argumentIndex) {
-      if (!ContainsSymbol(parent)) throw new ArgumentException("Unknown symbol: " + parent, "parent");
-      if (!ContainsSymbol(child)) throw new ArgumentException("Unknown symbol: " + child, "child");
-      if (argumentIndex >= GetMaxSubtreeCount(parent)) throw new ArgumentException("Symbol " + parent + " can have only " + GetMaxSubtreeCount(parent) + " subtrees.");
-      allowedChildSymbols[parent.Name][argumentIndex].Add(child.Name);
-      ClearCaches();
-    }
-
-    public bool IsAllowedChild(ISymbol parent, ISymbol child, int argumentIndex) {
-      if (!ContainsSymbol(parent)) throw new ArgumentException("Unknown symbol: " + parent, "parent");
-      if (!ContainsSymbol(child)) throw new ArgumentException("Unknown symbol: " + child, "child");
-      if (argumentIndex >= GetMaxSubtreeCount(parent)) throw new ArgumentException("Symbol " + parent + " can have only " + GetMaxSubtreeCount(parent) + " subtrees.");
-      return allowedChildSymbols[parent.Name][argumentIndex].Contains(child.Name);
-    }
-
-    public IEnumerable<ISymbol> GetAllowedSymbols(ISymbol parent, int argumentIndex) {
-      return allowedChildSymbols[parent.Name][argumentIndex].Select(x => allSymbols[x]);
-    }
-
-    private Dictionary<string, int> cachedMinExpressionLength;
-    public int GetMinExpressionLength(ISymbol symbol) {
-      if (!ContainsSymbol(symbol)) throw new ArgumentException("Unknown symbol: " + symbol);
-      if (!cachedMinExpressionLength.ContainsKey(symbol.Name)) {
-        cachedMinExpressionLength[symbol.Name] = int.MaxValue; // prevent infinite recursion
-        long sumOfMinExpressionLengths = 1 + (from argIndex in Enumerable.Range(0, GetMinSubtreeCount(symbol))
-                                              let minForSlot = (long)(from s in Symbols
-                                                                      where IsAllowedChild(symbol, s, argIndex)
-                                                                      select GetMinExpressionLength(s)).DefaultIfEmpty(0).Min()
-                                              select minForSlot).DefaultIfEmpty(0).Sum();
-
-        cachedMinExpressionLength[symbol.Name] = (int)Math.Min(sumOfMinExpressionLengths, int.MaxValue);
-      }
-      return cachedMinExpressionLength[symbol.Name];
-    }
-
-    private Dictionary<string, int> cachedMaxExpressionLength;
-    public int GetMaxExpressionLength(ISymbol symbol) {
-      if (!ContainsSymbol(symbol)) throw new ArgumentException("Unknown symbol: " + symbol);
-      if (!cachedMaxExpressionLength.ContainsKey(symbol.Name)) {
-        cachedMaxExpressionLength[symbol.Name] = int.MaxValue; // prevent infinite recursion
-        long sumOfMaxTrees = 1 + (from argIndex in Enumerable.Range(0, GetMaxSubtreeCount(symbol))
-                                  let maxForSlot = (long)(from s in Symbols
-                                                          where IsAllowedChild(symbol, s, argIndex)
-                                                          select GetMaxExpressionLength(s)).DefaultIfEmpty(0).Max()
-                                  select maxForSlot).DefaultIfEmpty(0).Sum();
-        long limit = int.MaxValue;
-        cachedMaxExpressionLength[symbol.Name] = (int)Math.Min(sumOfMaxTrees, limit);
-      }
-      return cachedMaxExpressionLength[symbol.Name];
-    }
-
-    private Dictionary<string, int> cachedMinExpressionDepth;
-    public int GetMinExpressionDepth(ISymbol symbol) {
-      if (!ContainsSymbol(symbol)) throw new ArgumentException("Unknown symbol: " + symbol);
-      if (!cachedMinExpressionDepth.ContainsKey(symbol.Name)) {
-        cachedMinExpressionDepth[symbol.Name] = int.MaxValue; // prevent infinite recursion
-        cachedMinExpressionDepth[symbol.Name] = 1 + (from argIndex in Enumerable.Range(0, GetMinSubtreeCount(symbol))
-                                                     let minForSlot = (from s in Symbols
-                                                                       where IsAllowedChild(symbol, s, argIndex)
-                                                                       select GetMinExpressionDepth(s)).DefaultIfEmpty(0).Min()
-                                                     select minForSlot).DefaultIfEmpty(0).Max();
-      }
-      return cachedMinExpressionDepth[symbol.Name];
-    }
-
-    public void SetMaxSubtreeCount(ISymbol symbol, int nSubTrees) {
-      if (!ContainsSymbol(symbol)) throw new ArgumentException("Unknown symbol: " + symbol);
-      maxSubTreeCount[symbol.Name] = nSubTrees;
-      while (allowedChildSymbols[symbol.Name].Count <= nSubTrees)
-        allowedChildSymbols[symbol.Name].Add(new List<string>());
-      while (allowedChildSymbols[symbol.Name].Count > nSubTrees) {
-        allowedChildSymbols[symbol.Name].RemoveAt(allowedChildSymbols[symbol.Name].Count - 1);
-      }
-      ClearCaches();
-    }
-
-    public void SetMinSubtreeCount(ISymbol symbol, int nSubTrees) {
-      if (!ContainsSymbol(symbol)) throw new ArgumentException("Unknown symbol: " + symbol);
-      minSubTreeCount[symbol.Name] = nSubTrees;
-      ClearCaches();
-    }
-
-    public int GetMinSubtreeCount(ISymbol symbol) {
-      if (!ContainsSymbol(symbol)) throw new ArgumentException("Unknown symbol: " + symbol);
-      return minSubTreeCount[symbol.Name];
-    }
-
-    public int GetMaxSubtreeCount(ISymbol symbol) {
-      if (!ContainsSymbol(symbol)) throw new ArgumentException("Unknown symbol: " + symbol);
-      return maxSubTreeCount[symbol.Name];
-    }
-    #endregion
-
-    private void ClearCaches() {
-      cachedMinExpressionLength.Clear();
-      cachedMaxExpressionLength.Clear();
-      cachedMinExpressionDepth.Clear();
-    }
-
-    protected void InitializeShallowClone(DefaultSymbolicExpressionGrammar original) {
-      minSubTreeCount = new Dictionary<string, int>(original.minSubTreeCount);
-      maxSubTreeCount = new Dictionary<string, int>(original.maxSubTreeCount);
-
-      allSymbols = new Dictionary<string, ISymbol>(original.allSymbols);
-      startSymbol = original.startSymbol;
-      allowedChildSymbols = new Dictionary<string, List<List<string>>>(original.allowedChildSymbols.Count);
-      foreach (var entry in original.allowedChildSymbols) {
-        allowedChildSymbols[entry.Key] = new List<List<string>>(entry.Value.Count);
-        foreach (var set in entry.Value) {
-          allowedChildSymbols[entry.Key].Add(new List<string>(set));
-        }
-      }
-    }
-  }
-}
Index: branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/GlobalSymbolicExpressionGrammar.cs
===================================================================
--- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/GlobalSymbolicExpressionGrammar.cs	(revision 5712)
+++ 	(revision )
@@ -1,187 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Linq;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
-  [StorableClass]
-  [Item("GlobalSymbolicExpressionGrammar", "Represents a grammar that defines the syntax of symbolic expression trees.")]
-  public sealed class GlobalSymbolicExpressionGrammar : DefaultSymbolicExpressionGrammar {
-    [Storable]
-    private int minFunctionDefinitions;
-    public int MinFunctionDefinitions {
-      get { return minFunctionDefinitions; }
-      set {
-        minFunctionDefinitions = value;
-        UpdateAdfConstraints();
-      }
-    }
-    [Storable]
-    private int maxFunctionDefinitions;
-    public int MaxFunctionDefinitions {
-      get { return maxFunctionDefinitions; }
-      set {
-        maxFunctionDefinitions = value;
-        UpdateAdfConstraints();
-      }
-    }
-    [Storable]
-    private int minFunctionArguments;
-    public int MinFunctionArguments {
-      get { return minFunctionArguments; }
-      set {
-        minFunctionArguments = value;
-      }
-    }
-    [Storable]
-    private int maxFunctionArguments;
-    public int MaxFunctionArguments {
-      get { return maxFunctionArguments; }
-      set {
-        maxFunctionArguments = value;
-      }
-    }
-
-    [Storable]
-    private Defun defunSymbol;
-
-    [StorableConstructor]
-    private GlobalSymbolicExpressionGrammar(bool deserializing) : base(deserializing) { }
-    private GlobalSymbolicExpressionGrammar(GlobalSymbolicExpressionGrammar original, Cloner cloner)
-      : base(original, cloner) {
-      defunSymbol = (Defun)cloner.Clone(original.defunSymbol);
-      maxFunctionArguments = original.maxFunctionArguments;
-      minFunctionArguments = original.minFunctionArguments;
-      maxFunctionDefinitions = original.maxFunctionDefinitions;
-      minFunctionDefinitions = original.minFunctionDefinitions;
-    }
-
-    public GlobalSymbolicExpressionGrammar(ISymbolicExpressionTreeGrammar mainBranchGrammar)
-      : base(mainBranchGrammar) {
-      maxFunctionArguments = 3;
-      maxFunctionDefinitions = 3;
-
-      ProgramRootSymbol programRootSymbol = Symbols.OfType<ProgramRootSymbol>().FirstOrDefault();
-      if (programRootSymbol == null) {
-        programRootSymbol = new ProgramRootSymbol();
-        AddSymbol(programRootSymbol);
-      }
-      StartSymbol = programRootSymbol;
-
-      defunSymbol = Symbols.OfType<Defun>().FirstOrDefault();
-      if (defunSymbol == null) {
-        defunSymbol = new Defun();
-        AddSymbol(defunSymbol);
-      }
-
-      SetMinSubtreeCount(StartSymbol, minFunctionDefinitions + 1); // min number of ADF + 1 for RPB
-      SetMaxSubtreeCount(StartSymbol, maxFunctionDefinitions + 1); // max number of ADF + 1 for RPB
-      // defun can have only one child
-      SetMinSubtreeCount(defunSymbol, 1); 
-      SetMaxSubtreeCount(defunSymbol, 1);
-
-
-      // the start symbol of the mainBranchGrammar is allowed as the result producing branch
-      SetAllowedChild(StartSymbol, Symbols.Where(s => s.Name == mainBranchGrammar.StartSymbol.Name).First(), 0);
-
-      // defuns are allowed as children on the same level and after RPB
-      for (int i = 0; i < maxFunctionDefinitions; i++) {
-        // +1 because RPB has index 0
-        SetAllowedChild(StartSymbol, defunSymbol, i + 1); 
-      }
-
-      // every symbol of the mainBranchGrammar that is allowed as child of the start symbol is also allowed as direct child of defun
-      foreach (var symb in mainBranchGrammar.Symbols) {
-        if (mainBranchGrammar.IsAllowedChild(mainBranchGrammar.StartSymbol, symb, 0))
-          SetAllowedChild(defunSymbol, Symbols.Where(s => s.Name == symb.Name).First(), 0);
-      }
-    }
-
-    [Obsolete]
-    private void Initialize(ISymbolicExpressionTreeGrammar mainBranchGrammar) {
-      base.Clear();
-
-      // remove the start symbol of the default grammar
-      RemoveSymbol(StartSymbol);
-
-      StartSymbol = new ProgramRootSymbol();
-      defunSymbol = new Defun();
-      AddSymbol(StartSymbol);
-      AddSymbol(defunSymbol);
-
-      SetMinSubtreeCount(StartSymbol, minFunctionDefinitions + 1);
-      SetMaxSubtreeCount(StartSymbol, maxFunctionDefinitions + 1);
-      SetMinSubtreeCount(defunSymbol, 1);
-      SetMaxSubtreeCount(defunSymbol, 1);
-
-      // ADF branches maxFunctionDefinitions 
-      for (int argumentIndex = 1; argumentIndex < maxFunctionDefinitions + 1; argumentIndex++) {
-        SetAllowedChild(StartSymbol, defunSymbol, argumentIndex);
-      }
-
-      if (mainBranchGrammar != null) {
-        // copy symbols from mainBranchGrammar
-        foreach (var symb in mainBranchGrammar.Symbols) {
-          AddSymbol(symb);
-          SetMinSubtreeCount(symb, mainBranchGrammar.GetMinSubtreeCount(symb));
-          SetMaxSubtreeCount(symb, mainBranchGrammar.GetMaxSubtreeCount(symb));
-        }
-
-        // the start symbol of the mainBranchGrammar is allowed as the result producing branch
-        SetAllowedChild(StartSymbol, mainBranchGrammar.StartSymbol, 0);
-
-        // copy syntax constraints from mainBranchGrammar
-        foreach (var parent in mainBranchGrammar.Symbols) {
-          for (int i = 0; i < mainBranchGrammar.GetMaxSubtreeCount(parent); i++) {
-            foreach (var child in mainBranchGrammar.Symbols) {
-              if (mainBranchGrammar.IsAllowedChild(parent, child, i)) {
-                SetAllowedChild(parent, child, i);
-              }
-            }
-          }
-        }
-
-        // every symbol of the mainBranchGrammar that is allowed as child of the start symbol is also allowed as direct child of defun
-        foreach (var symb in mainBranchGrammar.Symbols) {
-          if (mainBranchGrammar.IsAllowedChild(mainBranchGrammar.StartSymbol, symb, 0))
-            SetAllowedChild(defunSymbol, symb, 0);
-        }
-      }
-    }
-    private void UpdateAdfConstraints() {
-      SetMinSubtreeCount(StartSymbol, minFunctionDefinitions + 1);
-      SetMaxSubtreeCount(StartSymbol, maxFunctionDefinitions + 1);
-
-      // ADF branches maxFunctionDefinitions 
-      for (int argumentIndex = 1; argumentIndex < maxFunctionDefinitions + 1; argumentIndex++) {
-        SetAllowedChild(StartSymbol, defunSymbol, argumentIndex);
-      }
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new GlobalSymbolicExpressionGrammar(this, cloner);
-    }
-  }
-}
