using System; using System.Diagnostics; using System.Linq; using HeuristicLab.Analysis.AlgorithmBehavior.Analyzers; namespace PerformanceTests { class Program { static void Main(string[] args) { TestVolCalc(); } public static void TestVolCalc() { int dim = 4; int size = 20; var data = CreateRandomData(size, dim); var dataList = data.ToList(); Stopwatch watch = new Stopwatch(); //calculate convex hull watch.Start(); var convexHull = LPHull.Calculate(data); watch.Stop(); Console.WriteLine("Convex hull calculation took : " + watch.Elapsed.TotalSeconds + " seconds."); //calculate volume of convex hull watch.Start(); double volume = ConvexHullMeasures.CalculateVolumeNew(convexHull); watch.Stop(); Console.WriteLine("Volume calculation of convex hull took : " + watch.Elapsed.TotalSeconds + " seconds."); Console.WriteLine("Volume of convex hull is: " + volume); //do volume calculation from the whole data set watch.Start(); volume = ConvexHullMeasures.CalculateVolumeNew(dataList); watch.Stop(); Console.WriteLine("Volume calculation of whole data set took : " + watch.Elapsed.TotalSeconds + " seconds."); Console.WriteLine("Volume of whole data is: " + volume); //do volume calculation with lrs watch.Start(); volume = LiblrsWrapper.CalculateVolume(dataList); watch.Stop(); Console.WriteLine("Volume calculation of whole data set with lrs took : " + watch.Elapsed.TotalSeconds + " seconds."); Console.WriteLine("Volume of whole data with lrs is: " + volume); } private static double[][] CreateRandomData(int n, int m) { double[][] result = new double[n][]; Random rand = new Random(); for (int i = 0; i < n; i++) { result[i] = new double[m]; for (int j = 0; j < m; j++) { result[i][j] = (double)rand.Next(1, 60); } } return result; } } }