Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 16559 was 16137, checked in by abeham, 6 years ago

#2457:

  • Restructured FLA plugin (moved files between folders, added common base classes)
  • Fixed AC1 in QAPDirectedWalk (ouch!)
  • Changed PartialInformationContent to be in range [0;1]
  • Added unit test for information analysis
  • Refactored information analysis and discard ability to use more symbols than 2 as shapes
File size: 1.2 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, ia.Diversity);
18      Assert.AreEqual(5, ia.Regularity);
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.