Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/06/14 14:40:45 (11 years ago)
Author:
ascheibe
Message:

#1886 adapted convex hull modifier to use fractions for big volumes

File:
1 edited

Legend:

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

    r10283 r10287  
    3232using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3333using HeuristicLab.Problems.TestFunctions;
     34using Mehroz;
    3435
    3536namespace HeuristicLab.Analysis.AlgorithmBehavior.Analyzers {
     
    9394        var boundsMatrix = run.Parameters["Bounds"] as DoubleMatrix;
    9495        var bounds = new double[] { boundsMatrix[0, 0], boundsMatrix[0, 1] };
    95         double hyperCubeVolume = ConvexHullMeasures.CalculateHypercubeVolume(bounds, BestSolutionParameter.Value.Length);
     96        Fraction hyperCubeVolumeBig = ConvexHullMeasures.CalculateHypercubeVolumeBig(bounds, BestSolutionParameter.Value.Length);
     97        double hyperCubeVolume = double.NaN;
     98
     99        if (hyperCubeVolumeBig < 10000000) {
     100          hyperCubeVolume = ConvexHullMeasures.CalculateHypercubeVolume(bounds, BestSolutionParameter.Value.Length);
     101        }
    96102
    97103        List<double[]> completeHull = null;
     
    118124
    119125          if (completeHull != null && completeHull.Any() && completeHull.First().Length < completeHull.Count) {
    120             double completeHullVolume = ConvexHullMeasures.CalculateVolume(completeHull);
    121             double ratio = completeHullVolume / hyperCubeVolume;
    122             dtIncrementalHullVolume.Values.Add(completeHullVolume);
    123             dtIncrementalHullVolumeRatio.Values.Add(ratio);
     126            if (double.IsNaN(hyperCubeVolume)) {
     127              Fraction completeHullVolume = ConvexHullMeasures.CalculateVolumeBig(completeHull);
     128              Fraction ratio = completeHullVolume / hyperCubeVolumeBig;
     129              dtIncrementalHullVolume.Values.Add(completeHullVolume.ToDouble());
     130              dtIncrementalHullVolumeRatio.Values.Add(ratio.ToDouble());
     131            } else {
     132              double completeHullVolume = ConvexHullMeasures.CalculateVolume(completeHull);
     133              double ratio = completeHullVolume / hyperCubeVolume;
     134              dtIncrementalHullVolume.Values.Add(completeHullVolume);
     135              dtIncrementalHullVolumeRatio.Values.Add(ratio);
     136            }
    124137          }
    125138
     
    128141
    129142        if (completeHull != null && completeHull.Any() && completeHull.First().Length < completeHull.Count) {
    130           overallVolume.Value = ConvexHullMeasures.CalculateVolume(completeHull);
    131           overallVolumeRatio.Value = overallVolume.Value / hyperCubeVolume;
     143          if (!double.IsNaN(hyperCubeVolume)) {
     144            overallVolume.Value = ConvexHullMeasures.CalculateVolume(completeHull);
     145            overallVolumeRatio.Value = overallVolume.Value / hyperCubeVolume;
     146          } else {
     147            Fraction v = ConvexHullMeasures.CalculateVolumeBig(completeHull);
     148            overallVolume.Value = v.ToDouble();
     149            overallVolumeRatio.Value = (double)(v / hyperCubeVolumeBig);
     150          }
    132151        } else {
    133152          overallVolume.Value = double.NaN;
Note: See TracChangeset for help on using the changeset viewer.