Changeset 10272 for branches/HeuristicLab.Analysis.AlgorithmBehavior
- Timestamp:
- 12/31/13 01:24:27 (11 years ago)
- Location:
- branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/ConvexHullMeasures.cs
r10209 r10272 53 53 throw new ArgumentException("Nr. of points for volume calculation must be greater than dimension", "convexHull"); 54 54 55 var triangulation = Triangulation.CreateDelaunay(ConvertToVertex(convexHull)); 55 ITriangulation<DefaultVertex, DefaultTriangulationCell<DefaultVertex>> triangulation = null; 56 try { 57 //Under certain circumstances MIConvexHull is not able to calculate the triangulation 58 triangulation = Triangulation.CreateDelaunay(ConvertToVertex(convexHull)); 59 } 60 catch { 61 return double.NaN; 62 } 56 63 var simplices = ConvertFromTriangulation(triangulation); 57 64 foreach (var simplex in simplices) { -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/RunCollectionModifiers/RealVectorConvexHullModifier.cs
r10133 r10272 53 53 DataTable volDataTable = new DataTable("Convex hull volume over generations"); 54 54 DataTable nrOfPointsTable = new DataTable("Nr. of points of convex hull"); 55 DoubleValue overallVolum n= new DoubleValue();55 DoubleValue overallVolume = new DoubleValue(); 56 56 57 57 DataRow dtVolumeRow = new DataRow("Volume"); … … 65 65 var input = sols.Select(x => ConvertRealVectorToVertexArray(x)).ToArray(); 66 66 var convexHull = LPHull.Calculate(input); 67 var volume = ConvexHullMeasures.CalculateVolume(convexHull); 68 dtVolumeRow.Values.Add(volume); 67 if (convexHull.First().Length < convexHull.Count) { 68 var volume = ConvexHullMeasures.CalculateVolume(convexHull); 69 dtVolumeRow.Values.Add(volume); 70 } else { 71 dtVolumeRow.Values.Add(double.NaN); 72 } 69 73 dtNrPointsRow.Values.Add(convexHull.Count); 70 74 … … 78 82 sols = solutionCache.GetSolutionsFromGeneration(++i); 79 83 } 80 overallVolumn.Value = ConvexHullMeasures.CalculateVolume(curHull);81 84 82 run.Results.Add("Overall volumn: ", overallVolumn); 83 run.Results.Add("Convex hull volumn", volDataTable); 84 run.Results.Add("Convex nr. of points", nrOfPointsTable); 85 if (curHull != null && curHull.Any() && curHull.First().Length < curHull.Count) { 86 overallVolume.Value = ConvexHullMeasures.CalculateVolume(curHull); 87 } else { 88 overallVolume.Value = double.NaN; 89 } 90 91 run.Results["Overall volume"] = overallVolume; 92 run.Results["Convex hull volume"] = volDataTable; 93 run.Results["Nr. of points on convex hull"] = nrOfPointsTable; 85 94 } 86 95 }
Note: See TracChangeset
for help on using the changeset viewer.