#region License Information
/* HeuristicLab
* Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using HeuristicLab.Analysis.AlgorithmBehavior.Analyzers;
using Mehroz;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace AlgorithmBehaviorUnitTests {
[TestClass]
public class BigVolumeTest {
[TestMethod]
public void TestSimplexVolumeCalculation() {
List simplex = new List();
simplex.Add(new[] { 12.0, 4.5, 5.6 });
simplex.Add(new[] { 1.0, 10.5, 5.6 });
simplex.Add(new[] { 3.0, 1.5, 7.7 });
simplex.Add(new[] { 1.5, 6.5, 3.9 });
double volume = ConvexHullMeasures.CalculateSimplexVolume(simplex);
double volumeBig = ConvexHullMeasures.CalculateSimplexVolumeBig(simplex).ToDouble();
Assert.AreEqual(Math.Round(volume, 0), Math.Round(volumeBig, 0));
}
[TestMethod]
public void TestVolumeCalculation() {
int nrOfSamples = 51;
int dimension = 4;
var inputs = ConvexHullTest.CreateRandomData(nrOfSamples, dimension).ToList();
double volume = ConvexHullMeasures.CalculateVolume(inputs);
Fraction volumeBig = ConvexHullMeasures.CalculateVolumeBig(inputs);
double vb = volumeBig.ToDouble();
Assert.AreEqual(Math.Round(volume), Math.Round(vb, 0));
}
}
}