Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisBottomUpDiversityAnalyzer.cs @ 14821

Last change on this file since 14821 was 14312, checked in by bburlacu, 8 years ago

#1772: Merge trunk changes. Delete unnecessary files (sliding window).

File size: 3.5 KB
RevLine 
[11291]1#region License Information
2/* HeuristicLab
[14312]3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[11291]4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using HeuristicLab.Analysis;
[12017]23using HeuristicLab.Common;
[11271]24using HeuristicLab.Core;
[12287]25using HeuristicLab.Data;
26using HeuristicLab.Parameters;
[11271]27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
28
[12155]29namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
[12017]30  [Item("SymbolicDataAnalysisBottomUpDiversityAnalyzer", "A diversity analyzer based on the bottom-up distance between trees.")]
[11271]31  [StorableClass]
[12155]32  public class SymbolicDataAnalysisBottomUpDiversityAnalyzer : PopulationSimilarityAnalyzer {
[12287]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
[11271]59    [StorableConstructor]
60    protected SymbolicDataAnalysisBottomUpDiversityAnalyzer(bool deserializing) : base(deserializing) { }
61
[12155]62    protected SymbolicDataAnalysisBottomUpDiversityAnalyzer(SymbolicDataAnalysisBottomUpDiversityAnalyzer original, Cloner cloner)
[12017]63      : base(original, cloner) {
[11482]64    }
65
[12017]66    public override IDeepCloneable Clone(Cloner cloner) {
67      return new SymbolicDataAnalysisBottomUpDiversityAnalyzer(this, cloner);
68    }
69
[12155]70    public SymbolicDataAnalysisBottomUpDiversityAnalyzer(SymbolicExpressionTreeBottomUpSimilarityCalculator similarityCalculator)
71      : base(new[] { similarityCalculator }) {
72      DiversityResultName = "Genotypic Diversity";
73      UpdateCounterParameter.ActualName = "GenotypicDiversityAnalyzerUpdateCounter";
[12287]74
75      Parameters.Add(new FixedValueParameter<BoolValue>(MatchConstantValuesParameterName, new BoolValue(true)));
76      Parameters.Add(new FixedValueParameter<BoolValue>(MatchVariableWeightsParameterName, new BoolValue(true)));
[11271]77    }
[12287]78
79    public override IOperation Apply() {
80      var bus = (SymbolicExpressionTreeBottomUpSimilarityCalculator)SimilarityCalculatorParameter.Value;
81      bus.MatchConstantValues = MatchConstantValues;
82      bus.MatchVariableWeights = MatchVariableWeights;
83      return base.Apply();
84    }
[11271]85  }
86}
Note: See TracBrowser for help on using the repository browser.