Changeset 12287 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Timestamp:
- 04/06/15 16:39:55 (10 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisBottomUpDiversityAnalyzer.cs
r12155 r12287 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Data; 26 using HeuristicLab.Parameters; 25 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 28 … … 29 31 [StorableClass] 30 32 public class SymbolicDataAnalysisBottomUpDiversityAnalyzer : PopulationSimilarityAnalyzer { 33 private const string MatchConstantValuesParameterName = "MatchConstantValues"; 34 private const string MatchVariableWeightsParameterName = "MatchVariableWeights"; 35 36 public IFixedValueParameter<BoolValue> MatchConstantValuesParameter { 37 get { return (IFixedValueParameter<BoolValue>)Parameters[MatchConstantValuesParameterName]; } 38 } 39 40 public IFixedValueParameter<BoolValue> MatchVariableWeightsParameter { 41 get { return (IFixedValueParameter<BoolValue>)Parameters[MatchVariableWeightsParameterName]; } 42 } 43 44 public bool MatchConstantValues { 45 get { return MatchConstantValuesParameter.Value.Value; } 46 set { 47 MatchConstantValuesParameter.Value.Value = value; 48 49 } 50 } 51 52 public bool MatchVariableWeights { 53 get { return MatchVariableWeightsParameter.Value.Value; } 54 set { 55 MatchVariableWeightsParameter.Value.Value = value; 56 } 57 } 58 31 59 [StorableConstructor] 32 60 protected SymbolicDataAnalysisBottomUpDiversityAnalyzer(bool deserializing) : base(deserializing) { } … … 44 72 DiversityResultName = "Genotypic Diversity"; 45 73 UpdateCounterParameter.ActualName = "GenotypicDiversityAnalyzerUpdateCounter"; 74 75 Parameters.Add(new FixedValueParameter<BoolValue>(MatchConstantValuesParameterName, new BoolValue(true))); 76 Parameters.Add(new FixedValueParameter<BoolValue>(MatchVariableWeightsParameterName, new BoolValue(true))); 77 } 78 79 public override IOperation Apply() { 80 var bus = (SymbolicExpressionTreeBottomUpSimilarityCalculator)SimilarityCalculatorParameter.Value; 81 bus.MatchConstantValues = MatchConstantValues; 82 bus.MatchVariableWeights = MatchVariableWeights; 83 return base.Apply(); 46 84 } 47 85 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterCrossoverOperator.cs
r11694 r12287 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. … … 30 30 31 31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 32 [StorableClass] 33 [Item("SymbolicDataAnalysisExpressionAfterCrossoverOperator", "An operator that compares the crossover child with the parent and saves the swapped fragment.")] 32 34 public class SymbolicDataAnalysisExpressionAfterCrossoverOperator : AfterCrossoverOperator<ISymbolicExpressionTree> { 33 35 public SymbolicDataAnalysisExpressionAfterCrossoverOperator() { } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterManipulatorOperator.cs
r11726 r12287 28 28 29 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 30 [StorableClass] 31 [Item("SymbolicDataAnalysisExpressionAfterManipulatorOperator", "An operator that compares the mutation child with the parent and saves the modified fragment.")] 30 32 public class SymbolicDataAnalysisExpressionAfterManipulatorOperator : AfterManipulatorOperator<ISymbolicExpressionTree> { 31 33 public SymbolicDataAnalysisExpressionAfterManipulatorOperator() { } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionBeforeCrossoverOperator.cs
r11925 r12287 28 28 29 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 30 [StorableClass] 31 [Item("SymbolicDataAnalysisExpressionBeforeCrossoverOperator", "An operator which runs before crossover and enables the tracking of genetic fragments.")] 30 32 public class SymbolicDataAnalysisExpressionBeforeCrossoverOperator : BeforeCrossoverOperator<ISymbolicExpressionTree> { 31 33 public SymbolicDataAnalysisExpressionBeforeCrossoverOperator() { } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionBeforeManipulatorOperator.cs
r11855 r12287 28 28 29 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 30 [StorableClass] 31 [Item("SymbolicDataAnalysisExpressionBeforeManipulatorOperator", "An operator which sets up tracking for mutation fragments.")] 30 32 public class SymbolicDataAnalysisExpressionBeforeManipulatorOperator : BeforeManipulatorOperator<ISymbolicExpressionTree> { 31 33 public SymbolicDataAnalysisExpressionBeforeManipulatorOperator() { } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/TraceCalculator.cs
r12283 r12287 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. … … 118 118 119 119 #region trace crossover 120 121 120 if (inArcs.Count == 2) { 122 121 var parent0 = (IGenealogyGraphNode<ISymbolicExpressionTree>)inArcs[0].Source; … … 148 147 traceCache.Add(t0); 149 148 } 150 if (UpdateVertexWeights)151 n.Weight++;152 149 var t1 = new Tuple<IGenealogyGraphNode<ISymbolicExpressionTree>, IGenealogyGraphNode<ISymbolicExpressionTree>, int>(parent1, n, fragment.Index2); 153 150 if (!(CacheTraceNodes && traceCache.Contains(t1))) { -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs
r12155 r12287 39 39 public SymbolicExpressionTreeBottomUpSimilarityCalculator() { } 40 40 protected override bool IsCommutative { get { return true; } } 41 42 public bool MatchVariableWeights { get; set; } 43 public bool MatchConstantValues { get; set; } 41 44 42 45 [StorableConstructor] … … 216 219 } 217 220 218 private st atic string GetLabel(ISymbolicExpressionTreeNode node) {221 private string GetLabel(ISymbolicExpressionTreeNode node) { 219 222 if (node.SubtreeCount > 0) 220 223 return node.Symbol.Name; … … 222 225 var constant = node as ConstantTreeNode; 223 226 if (constant != null) 224 return constant.Value.ToString(CultureInfo.InvariantCulture);227 return MatchConstantValues ? constant.Value.ToString(CultureInfo.InvariantCulture) : node.Symbol.Name; 225 228 226 229 var variable = node as VariableTreeNode; 227 230 if (variable != null) 228 return variable.Weight +variable.VariableName;231 return MatchVariableWeights ? variable.Weight + variable.VariableName : variable.VariableName; 229 232 230 233 return node.ToString();
Note: See TracChangeset
for help on using the changeset viewer.