Exemple #1
0
        static void Main(string[] args)
        {
            RTreeQueryEvaluator qe = new RTreeQueryEvaluator("CA.txt", 200);
            //int count = qe.RangeQuery(new Point(35f, -118f, 0f), 1f);

            //From 1 to 5 percent
            for (int p = 1; p <= 5; p++)
            {
                //Calculate the range for this percenage.
                double area = TotalArea * 0.1 * p;
                double kmRange = Math.Sqrt(area / Math.PI);
                double degRange = kmRange / kmPerDeg;

                Console.WriteLine(p + " percent");

                //For each experiment, run 100 times
                for (int i = 0; i < 100; i++)
                {
                    double x = RandX();
                    Console.WriteLine(qe.RangeQuery(
                        new Point((float)x, (float)y(x)),
                        (float)degRange));
                }

            }

            //for (int i = 0; i < 30; i++)
            //    Console.WriteLine(RandX());
        }
        public ExperimentResults<int> AreaPercentage_RTree_RangeQuery(
            string dataFile, int fanout, double pcMin, double pcMax,
            double inc, int trials)
        {
            RTreeQueryEvaluator qe = new RTreeQueryEvaluator(dataFile, fanout);
            ExperimentResults<int> result = new ExperimentResults<int>(
                "range_rtree_ap_" + fanout + '_' + pcMin + '_' + pcMax);

            //Percentage
            for (double p = pcMin; p <= pcMax; p += inc)
            {
                //Calculate the range for this percenage.
                double area = TotalArea * 0.01 * p;
                double kmRange = Math.Sqrt(area / Math.PI);
                double degRange = kmRange / kmPerDeg;

                result.AddCategory(p + " percent");

                //For each experiment, run trial number of times
                for (int i = 0; i < trials; i++)
                {
                    result.AddResult(qe.RangeQuery(
                        qp.GetRandomQueryPoint(),
                        (float)degRange));
                }
            }

            return result;
        }
        public ExperimentResults<int> AreaSqMile_RTree_RangeQuery(
            string dataFile, int fanout, double min, double max,
            double inc, int trials)
        {
            RTreeQueryEvaluator qe = new RTreeQueryEvaluator(dataFile, fanout);
            ExperimentResults<int> result = new ExperimentResults<int>(
                "range_rtree_sqmi_" + fanout + '_' + min + '_' + max);

            //Percentage
            for (double a = min; a <= max; a += inc)
            {
                //Calculate the range for this percenage.
                double miRange = Math.Sqrt(a / Math.PI);
                double degRange = miRange / 69;

                result.AddCategory(a + " Sq Mi");

                //For each experiment, run trial number of times
                for (int i = 0; i < trials; i++)
                {
                    result.AddResult(qe.RangeQuery(
                        qp.GetRandomQueryPoint(),
                        (float)degRange));
                }
            }

            return result;
        }