Free cookie consent management tool by TermsFeed Policy Generator

source: branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape/Analysis/InformationAnalysisCalculator.cs @ 7729

Last change on this file since 7729 was 7128, checked in by epitzer, 13 years ago

#1696 Integrate fitness landscape analysis plugins from Heureka! repository.

File size: 4.0 KB
Line 
1using System.Linq;
2using HeuristicLab.Common;
3using HeuristicLab.Core;
4using HeuristicLab.Data;
5using HeuristicLab.Operators;
6using HeuristicLab.Parameters;
7using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
8
9namespace HeuristicLab.Analysis.FitnessLandscape.Analysis {
10  [Item("InformationAnalysisCalculator", "Performs an information analysis on a quality trail as described in Vassilev et al. (2000) Evol Comput 8:31–60")]
11  [StorableClass]
12  public class InformationAnalysisCalculator : SingleSuccessorOperator {
13
14    #region Parameter Properties
15    public LookupParameter<DataTable> QualityTrailParameter {
16      get { return (LookupParameter<DataTable>)Parameters["QualityTrail"]; }
17    }
18    public ValueLookupParameter<IntValue> NQuantilesParameter {
19      get { return (ValueLookupParameter<IntValue>)Parameters["NQuantiles"]; }
20    }
21    public LookupParameter<DoubleValue> InformationStabilityParameter {
22      get { return (LookupParameter<DoubleValue>)Parameters["InformationStability"]; }
23    }
24    public LookupParameter<IntValue> RegularityParameter {
25      get { return (LookupParameter<IntValue>)Parameters["Regularity"]; }
26    }
27    public LookupParameter<DoubleArray> InformationContentParameter {
28      get { return (LookupParameter<DoubleArray>)Parameters["InformationContent"]; }
29    }
30    public LookupParameter<DoubleArray> PartialInformationContentParameter {
31      get { return (LookupParameter<DoubleArray>)Parameters["PartialInformationContent"]; }
32    }
33    public LookupParameter<DoubleArray> DensityBasinInformationParameter {
34      get { return (LookupParameter<DoubleArray>)Parameters["DensityBasinInformation"]; }
35    }
36    public LookupParameter<DoubleArray> EpsilonQuantilesParameter {
37      get { return (LookupParameter<DoubleArray>)Parameters["EpsilonQuantiles"]; }
38    }
39    #endregion
40
41    #region Constructors & Cloning
42    [StorableConstructor]
43    protected InformationAnalysisCalculator(bool deserializing) : base(deserializing) { }
44    public InformationAnalysisCalculator()
45      : base() {
46      Parameters.Add(new LookupParameter<DataTable>("QualityTrail", "Historical quality trail of a walk over a fitness landscape."));
47      Parameters.Add(new ValueLookupParameter<IntValue>("NQuantiles", "Number of epsilon quantiles to calculate information analysis."));
48      Parameters.Add(new LookupParameter<DoubleValue>("InformationStability"));
49      Parameters.Add(new LookupParameter<IntValue>("Regularity"));
50      Parameters.Add(new LookupParameter<DoubleArray>("InformationContent"));
51      Parameters.Add(new LookupParameter<DoubleArray>("PartialInformationContent"));
52      Parameters.Add(new LookupParameter<DoubleArray>("DensityBasinInformation"));
53      Parameters.Add(new LookupParameter<DoubleArray>("EpsilonQuantiles", "Considered values of epsilon, selected as quantiles of actual quality differences"));
54    }
55    protected InformationAnalysisCalculator(InformationAnalysisCalculator original, Cloner cloner)
56      : base(original, cloner) {
57    }
58    public override IDeepCloneable Clone(Cloner cloner) {
59      return new InformationAnalysisCalculator(this, cloner);
60    }
61    #endregion
62
63    public override IOperation Apply() {
64      var analysis = new InformationAnalysis(
65        QualityTrailParameter.ActualValue.Rows.First().Values,
66        NQuantilesParameter.ActualValue.Value);
67      RegularityParameter.ActualValue = new IntValue(analysis.Regularity);
68      InformationStabilityParameter.ActualValue = new DoubleValue(analysis.InformationStability);
69      InformationContentParameter.ActualValue = new DoubleArray(analysis.InformationContent.ToArray());
70      PartialInformationContentParameter.ActualValue = new DoubleArray(analysis.PartialInformationContent.ToArray());
71      DensityBasinInformationParameter.ActualValue = new DoubleArray(analysis.DensityBasinInformation.ToArray());
72      EpsilonQuantilesParameter.ActualValue = new DoubleArray(analysis.QualityDelta.ToArray());
73      return base.Apply();
74    }
75  }
76}
Note: See TracBrowser for help on using the repository browser.