HEINZ NIXDORF INSTITUTE University of Paderborn Algorithms and Complexity Christian Schindelhauer Search Algorithms Winter Semester 2004/2005 31 Jan 2005 13th Lecture Christian Schindelhauer schindel@upb.de 1 HEINZ NIXDORF INSTITUTE Spatial Searching University of Paderborn Algorithms and Complexity Christian Schindelhauer Prolog: Searching with some help Searching with total Uncertainty Nearsighted Search – The Cow Path Problem – The Concept of Competitive Analysis – Deterministic Solution – Finding a Shoreline – Probabilistic Solution – The Wall Problem Farsighted Search – The Watchman Problem – How to Learn your Environment Search Algorithms, WS 2004/05 2 HEINZ NIXDORF INSTITUTE The Art Gallery Problem University of Paderborn Algorithms and Complexity Christian Schindelhauer Given: – a simple polygon with n corners Question: – How many watchmen must be placed such that they can survey the complete polygon Observations – In a convex polygon one watchman suffices – It suffices to watch only all edges • Then all other points are covered, too Trival: – In all polygons n watchmen suffice Also trivial: – In all polygons n/2 watchmen suffice Search Algorithms, WS 2004/05 3 HEINZ NIXDORF INSTITUTE The Ears of a Simple Polygon A polygon P is said to be simple if the only points of the plane belonging to two polygon edges of P are the polygon vertices of P. – Such a polygon has a well defined interior and exterior. A diagonal is a line segment lying entirely inside polygon P and joining two nonconsecutive vertices A vertex is called a principal vertex – if the diagonal between the neighbored vertices intersects the boundary of simple polygon P only at the neighbors A principal vertex of a simple polygon P is called an ear – if the diagonal between the neighbors lies entirely in P. University of Paderborn Algorithms and Complexity Christian Schindelhauer not a simple polygon simple polygon principal vertices non principal vertices All ears Search Algorithms, WS 2004/05 4 HEINZ NIXDORF INSTITUTE Two-Ear-Theorem University of Paderborn Algorithms and Complexity Christian Schindelhauer Theorem Except for triangles every simple polygon has at least two ears. Dual-tree: Given a triangulated simple polygon, the dual-tree is the graph generated by plotting a vertex at each triangle and edges joining vertices in adjacent triangles, i.e.triangles which share a diagonal Proof: By Joseph O'Rourke – It is known that a simple polygon can always be triangulated. – Leaves in the dual-tree of the triangulated polygon correspond to ears and every tree of two or more nodes must have at least two leaves. Search Algorithms, WS 2004/05 5 HEINZ NIXDORF INSTITUTE The Art Galllery Theorem University of Paderborn Algorithms and Complexity Christian Schindelhauer Theorem Any simple polygon can be guarded by n/3 cameras. Build up a triangulization by sequentially removing an ears – Note that the dual graph is a tree Color all nodes – such that two neighbored nodes of the triangulation have different colors Choose the color with the smallest number of occurrences n/3 Place watchman at theses nodes Now every triangle is observed – therefore n/3 watchmen suffice Search Algorithms, WS 2004/05 6 HEINZ NIXDORF INSTITUTE n/3 cameras are necessary University of Paderborn Algorithms and Complexity Christian Schindelhauer Theorem There is a simple polygon such that at least n/3 cameras are necessary Theorem The decision problem whether k cameras are sufficient for controlling an art gallery is NP-complete Search Algorithms, WS 2004/05 7 The Complexity of the Art Gallery-Problem Figures of the proof (from Chris Wu) HEINZ NIXDORF INSTITUTE http://cgm.cs.mcgill.ca/~athens/cs507/Projects/2001/CW/noholeproof.html Zur Anzeige wird der QuickTime™ Dekompressor „TIFF (Unkomprimiert)“ benötigt. University of Paderborn Algorithms and Complexity Christian Schindelhauer Zur Anzeige wird der QuickTime™ Dekompressor „TIFF (Unkomprimiert)“ benötigt. Reduction from 3-Sat Zur Anzeige wird der QuickTime™ Dekompressor „TIFF (Unkomprimiert)“ benötigt. Zur Anzeige wird der QuickTime™ Dekompressor „TIFF (Unkomprimiert)“ benötigt. Search Algorithms, WS 2004/05 8 HEINZ NIXDORF INSTITUTE Streets are special Polygons University of Paderborn Algorithms and Complexity Christian Schindelhauer Definition A street is a • simple polygon P in the plane • with two distinguished vertices s and t • the two boundary chains from s to t are weakly mutually visible From every side at least one point of the other side of the street is visible Zur Anzeige wird der QuickTime™ Dekompressor „TIFF (LZW)“ benötigt. Problem: – Given an unknown street – Find the shortest path from s to t A strategy is c-competitive for searching a goal in a street if its path never is longer than c times the length of the shortest path from s to t. Search Algorithms, WS 2004/05 9 HEINZ NIXDORF INSTITUTE Algorithms for Exploration of a Street University of Paderborn Algorithms and Complexity Christian Schindelhauer Proposed by –R. Klein. Walking an unknown street with bounded detour. Comput. Geom. Theory Appl., 1:325–351, 1992. 1992: Klein: 5.72 Lower Bound: 1.41.. = 21/2 1992: Icking, Klein: 4.44 ... Kleinberg, 1996: Lopez-Ortiz, Schuierer: 1.73 1997: Christian Icking, Alejandro Lopez-Ortiz, Sven Schuierer, Ines Semrau: 1.54 1999: Icking, Klein, Langetepe and independently Schuierer and Semrau: Optimal = 1.41.. Zur Anzeige wird der QuickTime™ Dekompressor „TIFF (LZW)“ benötigt. Search Algorithms, WS 2004/05 10 The Idea for Optimal Street Walking [Icking, Klein, Langetepe] HEINZ NIXDORF INSTITUTE University of Paderborn Algorithms and Complexity Christian Schindelhauer Collect the left and right vertices of the street Careful analysis reduces the problem to the problem of walking a funnel Zur Anzeige wird der QuickTime™ Dekompressor „TIFF (LZW)“ benötigt. Consider one (visibility) triangle (s,vl,vr) – For all possible combinations optimize the path – yielding a curve obeying trigonometric properties Related to the problem of looking around a corner Zur Anzeige wird der QuickTime™ Dekompressor „TIFF (LZW)“ benötigt. Search Algorithms, WS 2004/05 11 HEINZ NIXDORF INSTITUTE Search Pattern for known Rectilinear Polygons University of Paderborn Algorithms and Complexity Christian Schindelhauer “On-Line Search in a Simple Polygon” [Kleinberg] Given: –a rectilinguar simple polygon –a robot has a map of this polygon –unknown position of the target Find: –a search pattern that minimizes the path until the target can be seen Definition: –Extended edge is a prolongation of an edge into the interior of the polygon to another point of the polygon –Essential cut is an extended edge such that no other extended edge (of same orientation) can be reached through this cut Zur Anzeige wird der QuickTime™ Dekompressor „TIFF (LZW)“ benötigt. Search Algorithms, WS 2004/05 12 The Lower Bound for Searching in a Rectilinear Polygon HEINZ NIXDORF INSTITUTE University of Paderborn Algorithms and Complexity Christian Schindelhauer Theorem [Kleinberg] A polygon cannot be searched better than O(m) competitive, where m is the number of essential cuts Algorithm: Build a tree from s to all essential cuts Use a spiral search strategy to find the target on all the paths from s to the essential cuts Zur Anzeige wird der QuickTime™ Dekompressor „TIFF (LZW)“ benötigt. Theorem [Kleinberg] This construction is optimal up to a constant factor. Search Algorithms, WS 2004/05 13 Looking around a Corner An Optimal Competitive Strategy for Looking Around a Corner Christian Icking, Rolf Klein, Lihong Ma, 1994 Two halflines meet at the origin O The shaded wedge formed by the halflines is opaque and has an angle less than 180◦ Assume that on one of the halflines a mobile robot is located at point W, outside the wedge – equipped with an on-board vision system facing O. Its task is to “look around the corner”, – i. e. to inspect the other halfline which is invisible from W (but for its endpoint, O). A strategy for this class of problems should produce a path from W to any point on the prolongation, M(φ), of the invisible halfline. – φ denotes the angle between the invisible halfline and the prolongation of the visible one. HEINZ NIXDORF INSTITUTE University of Paderborn Algorithms and Complexity Christian Schindelhauer Zur Anzeige wird der QuickTime™ Dekompressor „TIFF (LZW)“ benötigt. Search Algorithms, WS 2004/05 14 HEINZ NIXDORF INSTITUTE Looking around a Corner Competitive Ratio: –Path of algorithm versus –Shortest path to look around corner University of Paderborn Algorithms and Complexity Christian Schindelhauer Zur Anzeige wird der QuickTime™ Dekompressor „TIFF (LZW)“ benötigt. Theorem[Icking, Klein Ma, 1994] There is an optimal strategy solving the “Looking around a Corner problem” with competive ratio c = 1.21218... See also Zur Anzeige wird der QuickTime™ Dekompressor „TIFF (LZW)“ benötigt. http://videos.compgeom.org/socg04video/ 5. Searching with an Autonomous Robot Search Algorithms, WS 2004/05 15 HEINZ NIXDORF INSTITUTE Summary of the Lecture University of Paderborn Algorithms and Complexity Christian Schindelhauer PART I (1st-6th lecture) PART II (7th-13th lecture) Pattern Search –Rabin-Karp –KMP –Boyer-Moore Pattern Search in Compressed Text –Huffman Code –Shannon Bound –Kolmogorov-Complexity –LZW-Compression –Searching in LZW-Compressed Text Searching the Web –PageRank –Kleinberg’s HITS-Algorithm –Structure of the Web –Searching in Power Law Networks Spatial Search –Searching with some Uncertainty –Competitive Algorithms –The Cow Problem –Probabilistic Cows: Smart Cows –The Wall Problem –Watchman Problem –Exploring a Street –Exploriing a Polygon Search Algorithms, WS 2004/05 16 HEINZ NIXDORF INSTITUTE The Exam is at 17/18 Feb 2005 or 16 Mar 2005 Register for the oral exam (now) 1 hour prior to the oral exam: Solve an exercise University of Paderborn Algorithms and Complexity Christian Schindelhauer Learn!! no Have you presented an exercise during the second part? yes Do you accept your grade from your midterm exam? yes Answer question of the second half no Answer question of the complete lecture Goto party on Feb 18th, 7pm Kachelöfchen Search Algorithms, WS 2004/05 17 HEINZ NIXDORF INSTITUTE University of Paderborn Algorithms and Complexity Christian Schindelhauer Thanks for your attention End of 13th lecture Final exam: Next exercise class: Mo 17/18 Feb 2005 or We 16 Mar 2005 Mo 17 Jan 2005, 1.15 pm, F0.530 or We 19 Jan 2005, 1.00 pm, E2.316 18