- Timestamp:
- 07/29/09 18:28:45 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-Refactoring-713/sources/HeuristicLab.GP/3.3/Logging/TreeArityAnalyser.cs
r698 r2210 30 30 using HeuristicLab.Constraints; 31 31 using System.Diagnostics; 32 using HeuristicLab.GP.Interfaces; 32 33 33 34 namespace HeuristicLab.GP { … … 43 44 public TreeArityAnalyser() 44 45 : base() { 45 AddVariableInfo(new VariableInfo("FunctionTree", "The tree to mutate", typeof(IFunctionTree), VariableKind.In));46 AddVariableInfo(new VariableInfo("FunctionTree", "The tree to analyse", typeof(IGeneticProgrammingModel), VariableKind.In)); 46 47 AddVariableInfo(new VariableInfo("Histogram", "The histogram of arities over all functions in all functiontrees", typeof(ItemList<ItemList<IntData>>), VariableKind.New | VariableKind.Out)); 47 48 } … … 69 70 70 71 private ItemList<ItemList<IntData>> GetArityHistogram(IScope subScope) { 71 I FunctionTree tree = GetVariableValue<IFunctionTree>("FunctionTree", subScope, false);72 IGeneticProgrammingModel gpModel = GetVariableValue<IGeneticProgrammingModel>("FunctionTree", subScope, false); 72 73 List<int> arities = new List<int>(); 73 Arities( tree, arities);74 Arities(gpModel.FunctionTree, arities); 74 75 var histogram = arities.GroupBy(x => x, (g, xs) => new { Group = g, Count = xs.Count() }).OrderBy(g=>g.Group); // count number of distinct arities 75 76 ItemList<ItemList<IntData>> result = new ItemList<ItemList<IntData>>();
Note: See TracChangeset
for help on using the changeset viewer.