Changeset 10198
- Timestamp:
- 12/05/13 15:23:48 (11 years ago)
- Location:
- branches/HeuristicLab.Analysis.AlgorithmBehavior
- Files:
-
- 22 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/AlgorithmBehaviorUnitTests.csproj
r10109 r10198 104 104 <Compile Include="ConvexHullTest.cs" /> 105 105 <Compile Include="RealVectorSolutionCacheTest.cs" /> 106 <Compile Include="TestVolumeCalculation.cs" /> 106 107 </ItemGroup> 107 108 <ItemGroup> -
branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/ConvexHullTest.cs
r10081 r10198 74 74 for (int i = 0; i < data.Count(); i++) { 75 75 double[] d = data[i]; 76 for (int j = 0; j < d.Length; j++) { 77 78 vertex.Position = d.Select(x => x).ToArray();79 80 } 76 77 DefaultVertex vertex = new DefaultVertex(); 78 vertex.Position = d; 79 result.Add(vertex); 80 81 81 } 82 82 return result; -
branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/LPConvexHullTest.cs
r10081 r10198 145 145 for (int i = 0; i < data.Count(); i++) { 146 146 double[] d = data[i]; 147 for (int j = 0; j < d.Length; j++) { 148 DefaultVertex vertex = new DefaultVertex(); 149 vertex.Position = d.Select(x => x).ToArray(); 150 result.Add(vertex); 151 } 147 DefaultVertex vertex = new DefaultVertex(); 148 vertex.Position = d; 149 result.Add(vertex); 152 150 } 153 151 return result; -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/ConvexHullMeasures.cs
r10097 r10198 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; 25 using MIConvexHull; 24 26 25 27 namespace HeuristicLab.Analysis.AlgorithmBehavior.Analyzers { … … 67 69 return volume; 68 70 } 71 72 public static double CalculateVolumeNew(List<double[]> convexHull) { 73 double volume = 0.0; 74 75 int dim = convexHull.First().Length; 76 if (dim > convexHull.Count) 77 throw new ArgumentException("Nr. of points for volume calculation must be greater than dimension", "convexHull"); 78 79 var triangulation = Triangulation.CreateDelaunay(ConvertToVertex(convexHull)); 80 var simplices = ConvertFromTriangulation(triangulation); 81 foreach (var simplex in simplices) { 82 volume += CalculateSimplexVolume(simplex.ToList()); 83 } 84 85 return volume; 86 } 87 88 private static List<double[][]> ConvertFromTriangulation(ITriangulation<DefaultVertex, DefaultTriangulationCell<DefaultVertex>> triangulation) { 89 List<double[][]> results = new List<double[][]>(); 90 91 foreach (var cell in triangulation.Cells) { 92 results.Add(cell.Vertices.Select(x => x.Position).ToArray()); 93 } 94 95 return results; 96 } 97 98 private static List<DefaultVertex> ConvertToVertex(List<double[]> data) { 99 List<DefaultVertex> result = new List<DefaultVertex>(); 100 for (int i = 0; i < data.Count(); i++) { 101 double[] d = data[i]; 102 DefaultVertex vertex = new DefaultVertex(); 103 vertex.Position = d; 104 result.Add(vertex); 105 } 106 return result; 107 } 69 108 } 70 109 } -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3.csproj
r10116 r10198 159 159 <Private>False</Private> 160 160 </ProjectReference> 161 <ProjectReference Include="..\..\MIConvexHull\MIConvexHull.csproj"> 162 <Project>{2337776d-7d0c-40aa-a439-c26c3ce24fab}</Project> 163 <Name>MIConvexHull</Name> 164 </ProjectReference> 161 165 </ItemGroup> 162 166 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/HeuristicLab.Analysis.AlgorithmBehavior/Visualization/Program.cs
r9945 r10198 85 85 for (int i = 0; i < data.Count(); i++) { 86 86 double[] d = data[i]; 87 for (int j = 0; j < d.Length; j++) { 88 DefaultVertex vertex = new DefaultVertex(); 89 vertex.Position = d.Select(x => x).ToArray(); 90 result.Add(vertex); 91 } 87 DefaultVertex vertex = new DefaultVertex(); 88 vertex.Position = d; 89 result.Add(vertex); 90 92 91 } 93 92 return result;
Note: See TracChangeset
for help on using the changeset viewer.