Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2457_ExpertSystem/UnitTests/InformationAnalysisTest.cs @ 17510

Last change on this file since 17510 was 16955, checked in by abeham, 6 years ago

#2457: worked on thesis

File size: 1.3 KB
Line 
1using HeuristicLab.Analysis.FitnessLandscape;
2using Microsoft.VisualStudio.TestTools.UnitTesting;
3
4namespace UnitTests {
5  [TestClass]
6  public class InformationAnalysisTest {
7    [TestMethod]
8    public void TestFeatures() {
9      var qualities = new double[] { 1, 2, 1, 3, 2, 4, 2, 1, 1, 2, 4, 4, 3, 1 };
10      var ia = new InformationAnalysis(qualities);
11
12      Assert.AreEqual(0.8224, ia.InformationContent[0], 1e-04);
13      Assert.AreEqual(0.4603, ia.DensityBasinInformation[0], 1e-04);
14      Assert.AreEqual(0.6154, ia.PartialInformationContent[0], 1e-04);
15      Assert.AreEqual(0.9008, ia.TotalEntropy[0], 1e-04);
16      Assert.AreEqual(2, ia.InformationStability);
17      Assert.AreEqual(4.0 / qualities.Length, ia.Diversity, 1e-07);
18      Assert.AreEqual(5.0 / (qualities.Length - 1), ia.Regularity, 1e-07);
19      Assert.AreEqual(0.4603, ia.PeakDensityBasinInformation.Value, 1e-04);
20      Assert.AreEqual(0.8224, ia.PeakInformationContent.Value, 1e-04);
21      Assert.AreEqual(0.9008, ia.PeakTotalEntropy.Value, 1e-04);
22      Assert.AreEqual(0.7642, ia.SymmetricInformationContent[0], 1e-04);
23      Assert.AreEqual(0.2987, ia.SymmetricDensityBasinInformation[0], 1e-04);
24      Assert.AreEqual(0.7068, ia.SymmetricTotalEntropy[0], 1e-04);
25    }
26  }
27}
Note: See TracBrowser for help on using the repository browser.