+ All Categories
Home > Documents > Computational Geometry, WS 2007/08 Lecture 17 Prof. Dr. Thomas Ottmann Algorithmen &...

Computational Geometry, WS 2007/08 Lecture 17 Prof. Dr. Thomas Ottmann Algorithmen &...

Date post: 16-Dec-2015
Category:
Upload: milton-haynes
View: 213 times
Download: 0 times
Share this document with a friend
24
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
Transcript
Page 1: Computational Geometry, WS 2007/08 Lecture 17 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für Angewandte Wissenschaften.

Computational Geometry, WS 2007/08

Lecture 17

Prof. Dr. Thomas Ottmann

Algorithmen & Datenstrukturen, Institut für InformatikFakultät für Angewandte WissenschaftenAlbert-Ludwigs-Universität Freiburg

Competitive Algorithms

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 2

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

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 3

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!)

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 4

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.

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 5

A positive example

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 6

A negative example

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 7

Second approach

Choose an arbitrary direction ω;

set angle-counter = 0;

repeatrepeat

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

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 8

Example 1

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 9

Example 2

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 10

Third approach: The Pledge Algorithm

set angle-counter ω = 0;

repeatrepeat

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

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 11

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.

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 12

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.

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 13

Correctness proof

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 14

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

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 15

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

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 16

repeat

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

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

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

Example

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 18

Animations

See the

of Rolf Klein and his group, University of Bonn:

http://www.geometrylab.de/

http://www.geometrylab.de/Pledge

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 19

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.

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 20

Competitive strategies: Bin-Packing example

• Task: Given a sequence o1, o2, … 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.

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 21

Definition of competitiveness

Let be a problem and S a strategy solving correctly any problem P in with an amountKS(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:

KS(P) ≤ C Kopt(P) + A, where

Kopt(P) = costs of an optimal solution

Next-fit is competitive with factor 2.

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 22

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

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 23

Doubling strategy

• 2. approach: Double the covered distance after each change of directions.

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

Computational Geometry, WS 2007/08Prof. Dr. Thomas Ottmann 24

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

(2mm / (m -1)m-1) + 1 ≤ 2em +1

Here e = 2.718… is the Eulersche number.

Properties of the doubling strategy


Recommended