private static int GetNumDiskAccess(int rtreeSize, int strategy, int minEntry, int maxEntry) { var featurePath = StrategyMap[strategy].Item1; var featureDim = StrategyMap[strategy].Item2; var nums = Enumerable.Range(0, NumImages).ToList(); nums.Shuffle(); var tree = new RTree <string>(maxEntry, minEntry); var featureLines = File.ReadAllLines(featurePath); var points = featureLines.Select(s => { var slices = s.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); return(new Point(featureDim, slices.Select(double.Parse).ToList())); }).ToList(); var imageNames = File.ReadAllLines(ImageFilePath); for (var i = 0; i < rtreeSize; i++) { tree.AddRecord(new Rectangle(featureDim, points[nums[i]], points[nums[i]]), imageNames[nums[i]]); } var mbr = tree.GetRootMbr(); var ratio = Math.Pow(1d / 2, 1d / featureDim); const int queryTimes = 1024; var countSum = 0; for (var i = 0; i < queryTimes; i++) { var queryMinBound = Enumerable.Repeat(0d, featureDim).ToList(); var queryMaxBound = Enumerable.Repeat(0d, featureDim).ToList(); for (var dim = 0; dim < featureDim; dim++) { var length = mbr.MaxBoundries[dim] - mbr.MinBoundries[dim]; var sideLength = length * ratio; var start = mbr.MinBoundries[dim] + new Random(DateTime.Now.Millisecond).NextDouble() * (mbr.MaxBoundries[dim] - sideLength - mbr.MinBoundries[dim]); var end = start + sideLength; queryMinBound[dim] = start; queryMaxBound[dim] = end; } var queryRect = new Rectangle(featureDim, queryMinBound, queryMaxBound); tree.GetContainedItems(queryRect, out var count); countSum += count; } return(countSum / queryTimes); }