Changeset 12892 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Analyzers/GenealogyAnalyzer.cs
- Timestamp:
- 08/23/15 13:21:12 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Analyzers/GenealogyAnalyzer.cs
r12891 r12892 22 22 using System.Collections.Generic; 23 23 using System.Linq; 24 using HeuristicLab.Analysis;25 24 using HeuristicLab.Common; 26 25 using HeuristicLab.Core; … … 34 33 [StorableClass] 35 34 [Item("GenealogyAnalyzer", "An analyzer which performs the necessary instrumentation to record the evolution of a genetic algorithm.")] 36 public class GenealogyAnalyzer<T> : SingleSuccessorOperator, IAnalyzer35 public abstract class GenealogyAnalyzer<T> : SingleSuccessorOperator, IAnalyzer 37 36 where T : class, IItem { 38 37 #region parameter names … … 146 145 #endregion properties 147 146 148 p ublicGenealogyAnalyzer() {147 protected GenealogyAnalyzer() { 149 148 #region add parameters 150 149 // the instrumented operators … … 166 165 Parameters.Add(new ValueParameter<IManipulatorOperator<T>>(AfterManipulatorOperatorParameterName)); 167 166 #endregion add parameters 168 }169 170 public override IDeepCloneable Clone(Cloner cloner) {171 return new GenealogyAnalyzer<T>(this, cloner);172 167 } 173 168 … … 246 241 } 247 242 243 protected abstract void EvaluateIntermediateChildren(); 244 248 245 public override IOperation Apply() { 249 246 IGenealogyGraph<T> genealogyGraph; … … 273 270 int index = 0; 274 271 T elite = null; 275 272 // identify previous elite individual 276 273 for (int i = 0; i < population.Length; ++i) { 277 274 if (genealogyGraph.GetByContent(population[i]).Rank.Equals(generation - 1)) { … … 281 278 } 282 279 } 283 280 // add current elite and connect with previous 284 281 #region add elite in the graph and connect it with the previous elite 285 282 if (elite != null) { … … 303 300 vertex.Quality = qualities[i].Value; 304 301 } 302 // update qualities for intermediate vertices 303 EvaluateIntermediateChildren(); 304 305 305 // remove extra graph nodes (added by the instrumented operators in the case of offspring selection) 306 306 var pop = new HashSet<T>(population);
Note: See TracChangeset
for help on using the changeset viewer.