Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12287


Ignore:
Timestamp:
04/06/15 16:39:55 (9 years ago)
Author:
bburlacu
Message:

#1772: Added storable attributes to the before/after evolution tracking operators in HeuristicLab.Problems.DataAnalysis.Symbolic. Very small changes to the trace calculator (updated license header, removed old sample count code).

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  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
     25using HeuristicLab.Data;
     26using HeuristicLab.Parameters;
    2527using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2628
     
    2931  [StorableClass]
    3032  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
    3159    [StorableConstructor]
    3260    protected SymbolicDataAnalysisBottomUpDiversityAnalyzer(bool deserializing) : base(deserializing) { }
     
    4472      DiversityResultName = "Genotypic Diversity";
    4573      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();
    4684    }
    4785  }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterCrossoverOperator.cs

    r11694 r12287  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    3030
    3131namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     32  [StorableClass]
     33  [Item("SymbolicDataAnalysisExpressionAfterCrossoverOperator", "An operator that compares the crossover child with the parent and saves the swapped fragment.")]
    3234  public class SymbolicDataAnalysisExpressionAfterCrossoverOperator : AfterCrossoverOperator<ISymbolicExpressionTree> {
    3335    public SymbolicDataAnalysisExpressionAfterCrossoverOperator() { }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterManipulatorOperator.cs

    r11726 r12287  
    2828
    2929namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     30  [StorableClass]
     31  [Item("SymbolicDataAnalysisExpressionAfterManipulatorOperator", "An operator that compares the mutation child with the parent and saves the modified fragment.")]
    3032  public class SymbolicDataAnalysisExpressionAfterManipulatorOperator : AfterManipulatorOperator<ISymbolicExpressionTree> {
    3133    public SymbolicDataAnalysisExpressionAfterManipulatorOperator() { }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionBeforeCrossoverOperator.cs

    r11925 r12287  
    2828
    2929namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     30  [StorableClass]
     31  [Item("SymbolicDataAnalysisExpressionBeforeCrossoverOperator", "An operator which runs before crossover and enables the tracking of genetic fragments.")]
    3032  public class SymbolicDataAnalysisExpressionBeforeCrossoverOperator : BeforeCrossoverOperator<ISymbolicExpressionTree> {
    3133    public SymbolicDataAnalysisExpressionBeforeCrossoverOperator() { }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionBeforeManipulatorOperator.cs

    r11855 r12287  
    2828
    2929namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     30  [StorableClass]
     31  [Item("SymbolicDataAnalysisExpressionBeforeManipulatorOperator", "An operator which sets up tracking for mutation fragments.")]
    3032  public class SymbolicDataAnalysisExpressionBeforeManipulatorOperator : BeforeManipulatorOperator<ISymbolicExpressionTree> {
    3133    public SymbolicDataAnalysisExpressionBeforeManipulatorOperator() { }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/TraceCalculator.cs

    r12283 r12287  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    118118
    119119        #region trace crossover
    120 
    121120        if (inArcs.Count == 2) {
    122121          var parent0 = (IGenealogyGraphNode<ISymbolicExpressionTree>)inArcs[0].Source;
     
    148147                traceCache.Add(t0);
    149148              }
    150               if (UpdateVertexWeights)
    151                 n.Weight++;
    152149              var t1 = new Tuple<IGenealogyGraphNode<ISymbolicExpressionTree>, IGenealogyGraphNode<ISymbolicExpressionTree>, int>(parent1, n, fragment.Index2);
    153150              if (!(CacheTraceNodes && traceCache.Contains(t1))) {
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs

    r12155 r12287  
    3939    public SymbolicExpressionTreeBottomUpSimilarityCalculator() { }
    4040    protected override bool IsCommutative { get { return true; } }
     41
     42    public bool MatchVariableWeights { get; set; }
     43    public bool MatchConstantValues { get; set; }
    4144
    4245    [StorableConstructor]
     
    216219    }
    217220
    218     private static string GetLabel(ISymbolicExpressionTreeNode node) {
     221    private string GetLabel(ISymbolicExpressionTreeNode node) {
    219222      if (node.SubtreeCount > 0)
    220223        return node.Symbol.Name;
     
    222225      var constant = node as ConstantTreeNode;
    223226      if (constant != null)
    224         return constant.Value.ToString(CultureInfo.InvariantCulture);
     227        return MatchConstantValues ? constant.Value.ToString(CultureInfo.InvariantCulture) : node.Symbol.Name;
    225228
    226229      var variable = node as VariableTreeNode;
    227230      if (variable != null)
    228         return variable.Weight + variable.VariableName;
     231        return MatchVariableWeights ? variable.Weight + variable.VariableName : variable.VariableName;
    229232
    230233      return node.ToString();
Note: See TracChangeset for help on using the changeset viewer.