/// <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; }
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); }
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); }
/// <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; }
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; }
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); }
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()"); }