Changeset 13527 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers
- Timestamp:
- 01/16/16 15:39:03 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisGeneticOperatorImprovementAnalyzer.cs
r13495 r13527 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using System.Linq; 23 24 using HeuristicLab.Analysis; … … 103 104 var populationSize = population.Length; 104 105 105 var vertices = population.Select(graph.GetByContent).ToList(); 106 // var vertices = population.Select(graph.GetByContent).ToList(); 107 var crossoverChildren = new List<IGenealogyGraphNode<ISymbolicExpressionTree>>(); 108 var mutationChildren = new List<IGenealogyGraphNode<ISymbolicExpressionTree>>(); 109 var vertices = graph.Vertices.Where(x => x.Rank > generation - 1); 110 foreach (var v in vertices) { 111 if (v.InDegree == 2) { 112 crossoverChildren.Add(v); 113 } else { 114 var parent = v.Parents.First(); 115 // mutation is always preceded by mutation 116 // so the parent vertex should have an intermediate rank 117 // otherwise, it is the previos generation elite 118 if (parent.Rank.IsAlmost(generation - 1) && parent.IsElite) 119 continue; 120 mutationChildren.Add(v); 121 } 122 } 106 123 DataTable table; 107 124 #region crossover improvement … … 118 135 table = (DataTable)Results["Crossover improvement"].Value; 119 136 } 120 var crossoverChildren = vertices.Where(x => x.InDegree == 2).ToList();121 if (CountIntermediateChildren)122 crossoverChildren.AddRange(vertices.Where(x => x.InDegree == 1).Select(v => v.Parents.First()).Where(p => p.Rank.IsAlmost(generation - 0.5))); // add intermediate children123 137 124 138 var avgCrossoverParentQuality = crossoverChildren.SelectMany(x => x.Parents).Average(x => x.Quality); … … 148 162 } 149 163 150 var mutationChildren = vertices.Where(x => x.InDegree == 1).ToList();151 152 164 var avgMutationParentQuality = mutationChildren.SelectMany(x => x.Parents).Average(x => x.Quality); 153 165 var avgMutationChildQuality = mutationChildren.Average(x => x.Quality);
Note: See TracChangeset
for help on using the changeset viewer.