Changeset 10283


Ignore:
Timestamp:
01/05/14 14:23:45 (6 years ago)
Author:
ascheibe
Message:

#1886 added volume ratios for incremental convex hull building over generations

File:
1 edited

Legend:

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

    r10279 r10283  
    4141    private const string CentroidMotionName = "Centroid Motion";
    4242    private const string BestSolutionName = "Best Solution";
     43    private const string IncrementalHullVolumeRatioName = "Incremental Hull Volume Ratio";
    4344
    4445    public IValueParameter<DoubleArray> BestSolutionParameter {
     
    6566        List<double[]> centroidList = new List<double[]>();
    6667        var bestSolution = run.Results["Best Solution"] as SingleObjectiveTestFunctionSolution;
    67         //var bestKnownSolution = ConvertRealVectorToVertexArray(bestSolution.BestKnownRealVector);
    6868        var bestKnownSolution = BestSolutionParameter.Value;
    6969
     
    7272        DataTable centroidDistancesTable = new DataTable(CentroidMovementDistancesName);
    7373        DataTable centroidMotionTable = new DataTable(CentroidMotionName);
     74        DataTable incrementalHullVolumeRatioTable = new DataTable(IncrementalHullVolumeRatioName);
    7475        DoubleValue overallVolume = new DoubleValue();
    7576        DoubleValue overallVolumeRatio = new DoubleValue();
     
    8081        DataRow dtCentroidMotion = new DataRow("Motion");
    8182        DataRow dtCentroidDistanceFromOptimum = new DataRow("Distance from optimum");
     83        DataRow dtIncrementalHullVolume = new DataRow("Incremental Hull Volume");
     84        DataRow dtIncrementalHullVolumeRatio = new DataRow("Incremental Hull Volume Ratio");
    8285        centroidMotionTable.Rows.Add(dtCentroidMotion);
    8386        centroidDistancesTable.Rows.Add(dtCentroidDistances);
    8487        centroidDistancesTable.Rows.Add(dtCentroidDistanceFromOptimum);
    8588        volDataTable.Rows.Add(dtVolumeRow);
     89        volDataTable.Rows.Add(dtIncrementalHullVolume);
    8690        nrOfPointsTable.Rows.Add(dtNrPointsRow);
     91        incrementalHullVolumeRatioTable.Rows.Add(dtIncrementalHullVolumeRatio);
     92
     93        var boundsMatrix = run.Parameters["Bounds"] as DoubleMatrix;
     94        var bounds = new double[] { boundsMatrix[0, 0], boundsMatrix[0, 1] };
     95        double hyperCubeVolume = ConvexHullMeasures.CalculateHypercubeVolume(bounds, BestSolutionParameter.Value.Length);
    8796
    8897        List<double[]> completeHull = null;
     
    108117          }
    109118
     119          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);
     124          }
     125
    110126          sols = solutionCache.GetSolutionsFromGeneration(++i);
    111127        }
     
    113129        if (completeHull != null && completeHull.Any() && completeHull.First().Length < completeHull.Count) {
    114130          overallVolume.Value = ConvexHullMeasures.CalculateVolume(completeHull);
    115           var boundsMatrix = run.Parameters["Bounds"] as DoubleMatrix;
    116           var bounds = new double[] { boundsMatrix[0, 0], boundsMatrix[0, 1] };
    117           double hyperHullVolume = ConvexHullMeasures.CalculateHypercubeVolume(bounds, BestSolutionParameter.Value.Length);
    118           overallVolumeRatio.Value = overallVolume.Value / hyperHullVolume;
     131          overallVolumeRatio.Value = overallVolume.Value / hyperCubeVolume;
    119132        } else {
    120133          overallVolume.Value = double.NaN;
     
    133146        run.Results[CentroidMovementDistancesName] = centroidDistancesTable;
    134147        run.Results[CentroidMotionName] = centroidMotionTable;
     148        run.Results[IncrementalHullVolumeRatioName] = incrementalHullVolumeRatioTable;
    135149      }
    136150    }
Note: See TracChangeset for help on using the changeset viewer.