Exemplo n.º 1
0
        /// <summary>
        /// Determines if p1 is better than p2.
        /// </summary>
        /// <param name="p1">Point 1</param>
        /// <param name="p2">Point 2</param>
        /// <param name="pref">Preference specifiers</param>
        /// <returns></returns>
        public static bool Dominates(Point p1, Point p2, PrefSpec[] pref)
        {
            //At least one attribute is better
            bool better = false;

            for (int i = 0; i < p1.Dimensions; i++)
            {
                if (pref[i] == PrefSpec.Min)
                {
                    if (p1[i] < p2[i])
                        better = true;
                    else if (p2[i] < p1[i])
                        return false;
                }
                else
                {
                    if (p1[i] > p2[i])
                        better = true;
                    else if (p2[i] > p1[i])
                        return false;
                }
            }

            return better;
        }
Exemplo n.º 2
0
 public PruningRegion(Orthotope o, PrefSpec[] prefs)
 {
     if (o == null || prefs == null)
         throw new ArgumentNullException();
     pivot = MakePivot(o, prefs);
     pref = new PrefSpec[pivot.Dimensions];
     Array.Copy(prefs, pref, prefs.Length);
 }
Exemplo n.º 3
0
        public PruningRegion(Point pivot, PrefSpec[] prefs)
        {
            if (pivot == null || prefs == null)
                throw new ArgumentNullException();

            this.pivot = pivot.Copy();
            pref = new PrefSpec[pivot.Dimensions];
            Array.Copy(prefs, pref, prefs.Length);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Find the dominant corner (pivot) of the orthotope and make a
 /// new instance of Point.
 /// </summary>
 /// <param name="o"></param>
 /// <param name="pref"></param>
 /// <returns></returns>
 public static Point MakePivot(Orthotope o, PrefSpec[] pref)
 {
     Point p = new Point(o.Dimensions);
     for (int i = 0; i < o.Dimensions; i++)
     {
         if (pref[i] == PrefSpec.Min)
             p[i] = o.Min[i];
         else
             p[i] = o.Max[i];
     }
     return p;
 }
Exemplo n.º 5
0
        public PointBasedPruning(GridRTree rtree, PrefSpec[] pref)
        {
            if (rtree == null || pref == null)
                throw new ArgumentNullException();

            pruneRegs = new List<PruningRegion>();
            skyline = new List<Point>();
            this.rtree = rtree;
            this.pref = pref;

            domTestCount = 0;
            ran = false;
        }
Exemplo n.º 6
0
        public PointBasedTuneTime(GridRTree rtree, int repLevel,
            PrefSpec[] prefs)
        {
            if (rtree == null)
                throw new ArgumentNullException();
            if (repLevel < 0)
                throw new ArgumentException();

            this.pruneRegs = new List<PruningRegion>();
            this.wakeList = new List<IndexEntry>();
            this.rtree = rtree;
            this.repLevel = repLevel;

            pref = new PrefSpec[rtree.Root.Bounds.Dimensions];
            Array.Copy(prefs, pref, pref.Length);
        }
Exemplo n.º 7
0
        public static void TuningSimSuite(int d, int b, PrefSpec[] prefs)
        {
            Console.WriteLine("Begine TuningSimSuite()");

            string outPath = "TuningSim_d" + d + ".txt";

            using (StreamWriter streamWriter = new StreamWriter(outPath))
            {

                for (int dsSize = 10000; dsSize <= 100000; dsSize += 10000)
                {
                    Console.WriteLine("Size: " + dsSize);

                    streamWriter.Write(dsSize.ToString() + '\t');

                    //Uniformed
                    GridRTree rtree = new GridRTree(
                        GetDataPath(DataType.Uniform, d, dsSize),
                        b   //branching factor
                    );

                    streamWriter.Write(new PointBasedTuneTime(rtree,
                        1, prefs).GetTuningTime().ToString() + '\t');
                    streamWriter.Write(new IndexBasedTuneTime(rtree,
                        1, prefs).GetTuningTime().ToString() + '\t');

                    //Rising
                    rtree = new GridRTree(
                        GetDataPath(DataType.Rising, d, dsSize),
                        b   //branching factor
                    );

                    streamWriter.Write(new PointBasedTuneTime(rtree,
                        1, prefs).GetTuningTime().ToString() + '\t');
                    streamWriter.Write(new IndexBasedTuneTime(rtree,
                        1, prefs).GetTuningTime().ToString() + '\t');

                    //Falling
                    rtree = new GridRTree(
                        GetDataPath(DataType.Falling, d, dsSize),
                        b   //branching factor
                    );

                    streamWriter.Write(new PointBasedTuneTime(rtree,
                        1, prefs).GetTuningTime().ToString() + '\t');
                    streamWriter.WriteLine(new IndexBasedTuneTime(rtree,
                       1, prefs).GetTuningTime().ToString());
                }
            }

            Console.WriteLine("End TuningSimSuite()");
        }