예제 #1
0
        static void Main(string[] args)
        {
            //RTreeQueryEvaluator qe = new RTreeQueryEvaluator("CA.txt", 100);
            //int result = qe.KnnQuery(new Point(35f, -118f, 0f), 4);
            //------------

            RTreeQueryEvaluator qe = new RTreeQueryEvaluator("CA.txt", 300);
            //int count = qe.RangeQuery(new Point(35f, -118f, 0f), 1f);

            //From 1 to 5 percent
            for (int k = 1; k <= 10; k++)
            {
                //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(k + " Nearest Neighbor");

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

            }

            //for (int i = 0; i < 30; i++)
            //    Console.WriteLine(RandX());
        }
예제 #2
0
        public ExperimentResults<int> RTreeKnnQuery(
            string dataFile, int fanout, int min, int max,
            int inc, int trials)
        {
            RTreeQueryEvaluator qe = new RTreeQueryEvaluator(dataFile, fanout);
            ExperimentResults<int> result = new ExperimentResults<int>(
                "knn_rtree_" + fanout + '_' + min + '_' + max);

            for (int k = 1; k <= 10; k+=inc)
            {
                result.AddCategory(k + " NN");

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

            return result;
        }