Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/31/13 01:24:27 (11 years ago)
Author:
ascheibe
Message:

#1886 improved convex hull modifier for test functions

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  
    5353        throw new ArgumentException("Nr. of points for volume calculation must be greater than dimension", "convexHull");
    5454
    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      }
    5663      var simplices = ConvertFromTriangulation(triangulation);
    5764      foreach (var simplex in simplices) {
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/RunCollectionModifiers/RealVectorConvexHullModifier.cs

    r10133 r10272  
    5353        DataTable volDataTable = new DataTable("Convex hull volume over generations");
    5454        DataTable nrOfPointsTable = new DataTable("Nr. of points of convex hull");
    55         DoubleValue overallVolumn = new DoubleValue();
     55        DoubleValue overallVolume = new DoubleValue();
    5656
    5757        DataRow dtVolumeRow = new DataRow("Volume");
     
    6565          var input = sols.Select(x => ConvertRealVectorToVertexArray(x)).ToArray();
    6666          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          }
    6973          dtNrPointsRow.Values.Add(convexHull.Count);
    7074
     
    7882          sols = solutionCache.GetSolutionsFromGeneration(++i);
    7983        }
    80         overallVolumn.Value = ConvexHullMeasures.CalculateVolume(curHull);
    8184
    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;
    8594      }
    8695    }
Note: See TracChangeset for help on using the changeset viewer.