- Timestamp:
- 09/15/15 00:10:33 (9 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Analyzers/GenealogyAnalyzer.cs
r12892 r12951 55 55 private const string EnableManipulatorTrackingParameterName = "EnableManipulatorTracking"; 56 56 private const string EnableSolutionCreatorTrackingParameterName = "EnableSolutionCreatorTracking"; // should always be enabled. maybe superfluous 57 private const string TrimOlderGenerationsParameterName = "TrimOlderGenerations"; 57 58 #endregion parameter names 58 59 59 60 #region parameter properties 61 62 public IFixedValueParameter<BoolValue> TrimOlderGenerationsParameter { 63 get { return (IFixedValueParameter<BoolValue>)Parameters[TrimOlderGenerationsParameterName]; } 64 } 65 60 66 public IScopeTreeLookupParameter<DoubleValue> QualityParameter { 61 67 get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters[QualityParameterName]; } … … 142 148 public BoolValue EnableSolutionCreatorTracking { 143 149 get { return EnableSolutionCreatorTrackingParameter.Value; } 150 } 151 152 public bool TrimOlderGenerations { 153 get { return TrimOlderGenerationsParameter.Value.Value; } 144 154 } 145 155 #endregion properties … … 164 174 Parameters.Add(new ValueParameter<IManipulatorOperator<T>>(BeforeManipulatorOperatorParameterName)); 165 175 Parameters.Add(new ValueParameter<IManipulatorOperator<T>>(AfterManipulatorOperatorParameterName)); 176 Parameters.Add(new FixedValueParameter<BoolValue>(TrimOlderGenerationsParameterName, "Remove all the generations older than the last generation from the genealoy graph to save memory.")); 166 177 #endregion add parameters 167 178 } … … 201 212 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(QualityParameterName, "The individual qualities.")); 202 213 } 214 if (!Parameters.ContainsKey(TrimOlderGenerationsParameterName)) 215 Parameters.Add(new FixedValueParameter<BoolValue>(TrimOlderGenerationsParameterName, "Remove all the generations older than the last generation from the genealoy graph to save memory.")); 203 216 } 204 217 … … 318 331 genealogyGraph.RemoveVertices(discarded); 319 332 333 //trim 334 if (TrimOlderGenerations) { 335 for (int i = 0; i < generation - 1; ++i) { 336 var vertices = genealogyGraph.GetByRank(i).ToList(); 337 genealogyGraph.RemoveVertices(vertices); 338 } 339 } 340 320 341 return base.Apply(); 321 342 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/BeforeManipulatorOperator.cs
r11858 r12951 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 29 29 [StorableClass] 30 30 [Item("AfterCrossoverOperator", "Performs an action after the crossover operator is applied.")] 31 public class BeforeManipulatorOperator<T> : EvolutionTrackingOperator<T>, IManipulatorOperator<T> where T : class, IItem {31 public class BeforeManipulatorOperator<T> : EvolutionTrackingOperator<T>, IManipulatorOperator<T> where T : class, IItem { 32 32 private const string ChildParameterName = "Child"; 33 33 -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/Operators/EvolutionTrackingOperator.cs
r11227 r12951 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 31 31 [Item("EvolutionTrackingOperator", "A base operator which facilitates access to the genealogy graph.")] 32 32 [StorableClass] 33 public class EvolutionTrackingOperator<T> : SingleSuccessorOperator where T : class, IItem {33 public class EvolutionTrackingOperator<T> : SingleSuccessorOperator where T : class, IItem { 34 34 // evolution tracking-related parameters 35 private const string resultsParameterName = "Results";36 private const string populationGraphParameterName = "PopulationGraph";37 private const string generationsParameterName = "Generations";35 private const string ResultsParameterName = "Results"; 36 private const string PopulationGraphParameterName = "PopulationGraph"; 37 private const string GenerationsParameterName = "Generations"; 38 38 39 39 public ILookupParameter<ResultCollection> ResultsParameter { 40 get { return (ILookupParameter<ResultCollection>)Parameters[ resultsParameterName]; }40 get { return (ILookupParameter<ResultCollection>)Parameters[ResultsParameterName]; } 41 41 } 42 42 public ILookupParameter<IntValue> GenerationsParameter { 43 get { return (ILookupParameter<IntValue>)Parameters[ generationsParameterName]; }43 get { return (ILookupParameter<IntValue>)Parameters[GenerationsParameterName]; } 44 44 } 45 45 public ResultCollection Results { … … 52 52 get { 53 53 IResult result; 54 if (!Results.ContainsKey( populationGraphParameterName)) {55 result = new Result( populationGraphParameterName, new GenealogyGraph<T>());54 if (!Results.ContainsKey(PopulationGraphParameterName)) { 55 result = new Result(PopulationGraphParameterName, new GenealogyGraph<T>()); 56 56 Results.Add(result); 57 57 } else { 58 result = Results[ populationGraphParameterName];58 result = Results[PopulationGraphParameterName]; 59 59 } 60 60 var graph = (GenealogyGraph<T>)result.Value; … … 63 63 } 64 64 public EvolutionTrackingOperator() { 65 Parameters.Add(new LookupParameter<IntValue>( generationsParameterName));66 Parameters.Add(new LookupParameter<ResultCollection>( resultsParameterName));65 Parameters.Add(new LookupParameter<IntValue>(GenerationsParameterName)); 66 Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName)); 67 67 } 68 68 protected EvolutionTrackingOperator(EvolutionTrackingOperator<T> original, Cloner cloner)
Note: See TracChangeset
for help on using the changeset viewer.