Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computational Geometry, WS 2007/08 Lecture 17 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für Angewandte Wissenschaften.

Similar presentations


Presentation on theme: "Computational Geometry, WS 2007/08 Lecture 17 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für Angewandte Wissenschaften."— Presentation transcript:

1 Computational Geometry, WS 2007/08 Lecture 17 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für Angewandte Wissenschaften Albert-Ludwigs-Universität Freiburg Competitive Algorithms

2 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann2 Motion planning How to escape from a maze Finding a target in an unknown environment Competitive strategies –Example: Online-Bin-Packing –Example: Searching a hole in a wall

3 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann3 Searching an unknown polygonal maze Given: A point-shaped robot with touch sensor and angle counter which is able to move straight forward and follow a wall. A maze (set of polygons). Task: Leave the maze (Find a way out of the maze, if there is one!)

4 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann4 First approach: Always along the wall Choose an arbitrary direction ω; repeat move in direction ω until robot hits a wall; repeat follow the wall until robot is outside the maze Assumption (w.l.o.g.): Whenever the robot hits a wall it turns right and follows along the wall in such a way that the wall is always to its left.

5 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann5 A positive example

6 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann6 A negative example

7 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann7 Second approach Choose an arbitrary direction ω; set angle-counter = 0; repeat move in direction ω until robot hits a wall; repeat follow the wall and adapt angel-counter until angel-counter == 0 (mod 2π) until robot is outside the maze Changing angel-counter values: left-turn: positiv right-turn: negativ

8 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann8 Example 1

9 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann9 Example 2

10 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann10 Third approach: The Pledge Algorithm set angle-counter ω = 0; repeat move in direction ω in the free space until robot hits a wall; repeat follow the wall in counter-clockwise direction; count the overall turning angle in ω until angel-counter ω == 0; until robot is outside the maze Angel-counter values: left-turn: positiv right-turn: negativ

11 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann11 Correctness of the Pledge Algorithmus Theorem: The Pledge algorithmus finds a way out of in any maze from an arbitrary start position inside the maze, if there is a path out of the maze. Lemma 1: The angel-counter ω never becomes positive Proof 1: Initially, ω = 0; if the robot hits a wall, ω becomes (more) negativ; whenever ω = 0, the robot leaves the wall and moves straight to the next wall.

12 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann12 Correctness proof Claim: If the robot does not find a way out of the maze, there is no such path! Lemma 2: Assume that the robot does not find a way out of the maze. Then the pursued path consists of a finite initial part and a closed, infinitely often cyclically pursued tail. Let P be the infinitely often pursued path of the robot during its (unsuccessful) attempt to escape from the maze. Lemma 3: P cannot cross itself.

13 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann13 Correctness proof

14 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann14 Proof of the Theorem: Case 1: Robot walks along P in counter-clockwise direction. (Impossible, since angel never becomes positive.) Case 2: Robot walks along P in clockwise direction. Correctness proof

15 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann15 Task: Find a target in an unknown environment! Enhance the abilities of the robot: The robot always knows the global coordinates of its position The robot knows the global coordinates of the target point. Strategy Bug: The robot walks into the direction of the target untol he hits an obstacle. The he surrounds the obstaxcle once and percives the point on the boundary of the obstacle which is closest to the target. He returns to this point after completion of the surrounding and continues his way following the same strategy. Finding a target in an unknown environment

16 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann16 repeat walk into the direction of the target until obstacle-hit; A = currentPosition; (*on obstacle*) D = currentPosition; (*closest point in target direction on the boundary of the obstacle found so far*) repeat advance currentPosition along the obstacle; if currentPosition is closer to the target than D then D = currentPosition until currentPosition = A; Follow the shortest path along the obstacle to D until target-reached Strategy Bug

17 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann17 Example

18 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann18 Animations See the of Rolf Klein and his group, University of Bonn: http://www.geometrylab.de/ http://www.geometrylab.de/Pledge

19 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann19 Properties of the strategie Bug The strategy always finds a path from a starting point s to a target point t if there is such a path. (See the proof in R. Klein´s book) The path obtained by the strategy bug can be árbitrarily longer than the shortest path from s to t.

20 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann20 Competitive strategies: Bin-Packing example Task: Given a sequence o 1, o 2, … of objects, all of size ≤ 1. Put all objects into bins of size 1 in such a way that the number of used bins is minimized. Next-fit-Strategy: Put the next object into the same bin as the previous one, if there is room enough; otherwise open a new bin. Next-fit-Strategie utilizes at most twice as many bins as would be necessary for´an optimal packing.

21 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann21 Definition of competitiveness Let  be a problem and S a strategy solving correctly any problem P in  with an amount  K S (P) of costs. Strategy S is called competitive with factor C, if there is a constant A such that for any sample P   the following holds: K S (P) ≤ C K opt (P) + A, where K opt (P) = costs of an optimal solution Next-fit is competitive with factor 2.

22 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann22 Given a robot with a contact sensor s.t. it can walk along a wall. Task: Find a hole in the wall that exists in an unknown direction and distance from a given start point of the robot. 1. Approach: Iteratively change the walking direction and increase the length of the covered distance incrementally by 1. Searching a hole in a wall

23 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann23 Doubling strategy 2. approach: Double the covered distance after each change of directions.

24 Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann24 Theorem 1: The doubling strategy is competitive with a factor 9. Theorem 2: Every competitive strategy for finding a point on a line must have a competitive factor of at least ≥ 9. The principle of exponentially increasing the search depth can be extendet to other and more than two search spaces. Theorem 3: This searching strategy for m halfsrays is competitive with factor (2  m m / (m -1) m-1 ) + 1 ≤ 2em +1 Here e = 2.718… is the Eulersche number. Properties of the doubling strategy


Download ppt "Computational Geometry, WS 2007/08 Lecture 17 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für Angewandte Wissenschaften."

Similar presentations


Ads by Google