Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11965


Ignore:
Timestamp:
02/06/15 19:01:26 (10 years ago)
Author:
bburlacu
Message:

#1772: Merged trunk changes and updated the SymbolicDataAnalysisBottomUpDiversityAnalyzer.

Location:
branches/HeuristicLab.EvolutionTracking
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding

  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/SubtreeCrossover.cs

    r11208 r11965  
    109109        return parent0;
    110110      } else {
    111         var selectedBranch = SelectRandomBranch(random, allowedBranches, internalCrossoverPointProbability);
     111        var selectedBranch = (ISymbolicExpressionTreeNode)SelectRandomBranch(random, allowedBranches, internalCrossoverPointProbability).Clone();
    112112
    113113        if (crossoverPoint0.Child != null) {
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Grammars/EmptySymbolicExpressionTreeGrammar.cs

    r11638 r11965  
    136136    }
    137137   
    138     #pragma warning disable 0169 //disable usage warning
     138    #pragma warning disable 0067 //disable usage warning
    139139    public event EventHandler Changed;
    140     #pragma warning restore 0169
     140    #pragma warning restore 0067
    141141    #endregion
    142142  }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic

  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisBottomUpDiversityAnalyzer.cs

    r11927 r11965  
    2222using HeuristicLab.Analysis;
    2323using HeuristicLab.Core;
    24 using HeuristicLab.Data;
    25 using HeuristicLab.Parameters;
    2624using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2725
     
    3028  [StorableClass]
    3129  public class SymbolicDataAnalysisBottomUpDiversityAnalyzer : SingleObjectivePopulationDiversityAnalyzer {
    32     private const string MatchConstantValuesParameterName = "MatchConstantValues";
    33     private const string MatchVariableWeightsParameterName = "MatchVariableWeights";
    34 
    35     public IValueParameter<BoolValue> MatchVariableWeightsParameter {
    36       get { return (IValueParameter<BoolValue>)Parameters[MatchVariableWeightsParameterName]; }
    37     }
    38 
    39     public IValueParameter<BoolValue> MatchConstantValuesParameter {
    40       get { return (IValueParameter<BoolValue>)Parameters[MatchConstantValuesParameterName]; }
    41     }
    42 
    43     public bool MatchConstantValues {
    44       get { return MatchConstantValuesParameter.Value.Value; }
    45       set {
    46         MatchConstantValuesParameter.Value.Value = value;
    47         ((SymbolicExpressionTreeBottomUpSimilarityCalculator)SimilarityCalculator).MatchConstantValues = value;
    48       }
    49     }
    50 
    51     public bool MatchVariableWeights {
    52       get { return MatchVariableWeightsParameter.Value.Value; }
    53       set {
    54         MatchVariableWeightsParameter.Value.Value = value;
    55         ((SymbolicExpressionTreeBottomUpSimilarityCalculator)SimilarityCalculator).MatchVariableWeights = value;
    56       }
    57     }
    58 
    5930    [StorableConstructor]
    6031    protected SymbolicDataAnalysisBottomUpDiversityAnalyzer(bool deserializing) : base(deserializing) { }
     
    6233    [StorableHook(HookType.AfterDeserialization)]
    6334    private void AfterDeserialization() {
    64       if (!Parameters.ContainsKey(MatchConstantValuesParameterName))
    65         Parameters.Add(new ValueParameter<BoolValue>(MatchConstantValuesParameterName, "Specifies if the similarity calculator should match constant values.", new BoolValue(true)));
    66       if (!Parameters.ContainsKey(MatchVariableWeightsParameterName))
    67         Parameters.Add(new ValueParameter<BoolValue>(MatchVariableWeightsParameterName, "Specifies if the similarity calculator should match variable weights", new BoolValue(true)));
    6835    }
    6936
    7037    public SymbolicDataAnalysisBottomUpDiversityAnalyzer() {
    7138      SimilarityCalculator = new SymbolicExpressionTreeBottomUpSimilarityCalculator { SolutionVariableName = "SymbolicExpressionTree" };
    72       Parameters.Add(new ValueParameter<BoolValue>(MatchConstantValuesParameterName, "Specifies if the similarity calculator should match constant values.", new BoolValue(true)));
    73       Parameters.Add(new ValueParameter<BoolValue>(MatchVariableWeightsParameterName, "Specifies if the similarity calculator should match variable weights", new BoolValue(true)));
    7439    }
    7540  }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeBottomUpSimilarityCalculator.cs

    r11927 r11965  
    3636  public class SymbolicExpressionTreeBottomUpSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator, ISymbolicDataAnalysisExpressionSimilarityCalculator {
    3737    private readonly HashSet<string> commutativeSymbols = new HashSet<string> { "Addition", "Multiplication", "Average", "And", "Or", "Xor" };
    38     public bool MatchVariableWeights { get; set; }
    39     public bool MatchConstantValues { get; set; }
    40 
    4138    public SymbolicExpressionTreeBottomUpSimilarityCalculator() { }
    4239
     
    4845    protected SymbolicExpressionTreeBottomUpSimilarityCalculator(SymbolicExpressionTreeBottomUpSimilarityCalculator original, Cloner cloner)
    4946      : base(original, cloner) {
    50       MatchVariableWeights = original.MatchVariableWeights;
    51       MatchConstantValues = original.MatchConstantValues;
    5247    }
    5348
     
    214209    }
    215210
    216     private string Label(ISymbolicExpressionTreeNode node) {
     211    private static string Label(ISymbolicExpressionTreeNode node) {
    217212      if (node.SubtreeCount > 0)
    218213        return node.Symbol.Name;
     
    220215      var constant = node as ConstantTreeNode;
    221216      if (constant != null)
    222         return MatchConstantValues ? constant.Value.ToString(CultureInfo.InvariantCulture) : constant.Symbol.Name;
     217        return constant.Value.ToString(CultureInfo.InvariantCulture);
     218
    223219      var variable = node as VariableTreeNode;
    224       if (variable != null) {
    225         return MatchVariableWeights ? variable.Weight + variable.VariableName : variable.VariableName;
    226       }
     220      if (variable != null)
     221        return variable.Weight + variable.VariableName;
    227222
    228223      return node.ToString();
Note: See TracChangeset for help on using the changeset viewer.