Changeset 10092


Ignore:
Timestamp:
10/28/13 18:27:17 (6 years ago)
Author:
ascheibe
Message:

#1886 fixed volume calculation of polytopes

Location:
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/ConvexHullMeasures.cs

    r10060 r10092  
    2626  public static class ConvexHullMeasures {
    2727    //Calculates the volumne of a d-simplex
    28     private static double CalculateSimplexVolume(List<double[]> hyperHull) {
    29       double[,] diffs = new double[hyperHull.Count, hyperHull.Count];
     28    private static double CalculateSimplexVolume(List<double[]> simplex) {
     29      double[,] diffs = new double[simplex.Count, simplex.Count];
    3030
    31       for (int i = 0; i < hyperHull.Count; i++) {
    32         for (int j = 0; j < hyperHull.Count; j++) {
    33           diffs[i, j] = CalculateVectorDiff(hyperHull[i], hyperHull[j]);
     31      for (int i = 0; i < simplex.Count; i++) {
     32        for (int j = 0; j < simplex.Count; j++) {
     33          diffs[i, j] = simplex[i].EuclideanDistance(simplex[j]);
    3434        }
    3535      }
    3636
    3737      double det = alglib.rmatrixdet(diffs);
    38       double result = det / hyperHull[0].Count().Fact();
    39 
    40       return result;
    41     }
    42 
    43     private static double CalculateVectorDiff(double[] vector1, double[] vector2) {
    44       double result = 0.0;
    45 
    46       for (int i = 0; i < vector1.Length; i++) {
    47         result += vector1[i] - vector2[i];
    48       }
     38      double result = det / simplex[0].Count().Fact();
    4939
    5040      return result;
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3.csproj

    r10090 r10092  
    123123  </ItemGroup>
    124124  <ItemGroup>
     125    <Compile Include="DoubleArrayExtensions.cs" />
    125126    <Compile Include="RealVectorConvexHullSolutionCacheAnalyzer.cs" />
    126127    <Compile Include="DistanceMatrixToPoints.cs" />
Note: See TracChangeset for help on using the changeset viewer.