1 / 58

THE TWO GUARDS PROBLEM

THE TWO GUARDS PROBLEM. Christian Icking Rolf Klein International Journal of Computational Geometry & Applications (1991). Outline. Introduction Notation Straight Walk Counter Walk General Walk Conclusions. Problem.

sherry
Télécharger la présentation

THE TWO GUARDS PROBLEM

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. THE TWO GUARDS PROBLEM Christian Icking Rolf Klein International Journal of Computational Geometry & Applications (1991)

  2. Outline • Introduction • Notation • Straight Walk • Counter Walk • General Walk • Conclusions

  3. Problem • Given a simple polygon in the plane with two distinguished vertices, s and g, is it possible for two guards to simultaneously walk along the two boundary chains from s to g in such a way that they are always mutually visible? • A polygon that admits a walk is walkable.

  4. Case1: Straight walk • Straight: There is no backtracking in order to get the points from s to g. • Problem: If such a straight walk exists? • Solution: Employ the method of Chazelle and Guibas, and show an O(nlogn) algorithm that computes a straight walk

  5. Case2: Counter walk • Counter: During a walk it may be necessary for one of the guards to move backwards(toward s) while the other one still advances towards g. • Problem: If such a counter walk exists? • Solution:

  6. Case3: General walk • Problem: to move the guards from s to g with backtracking. • Solution: we compute in time O(nlogn+k) a minimun length walk, where k is the size of the output, i. e. the number of walk instructions for the two guards.

  7. Outline • Introduction • Notation • Straight Walk • Counter Walk • General Walk • Conclusions

  8. g Succ(p) p Pred(p) R L s Notations • s, g: two distinguished vertices • L, R: two polygonal chains with common endpoints s and g. • Succ(p): the vertex next to p in a chain • Pred(p): the vertex previous to p in a chain

  9. vis(x)={yP| y is visible from x} Definition2.1 • We call a point xP visible from a point yP iff the connecting line segment xy is entirely contained in P.

  10. Two visibility segments p1q1 and p2q2cross iff the order of p1, p2 on L is opposite to the order of q1, q2 on R. • pg = pair(p,q)

  11. Definition2.2 • A walk on P is a pair(l, r) of continuous functions such that: l: [0, 1]  L, r: [0, 1]  R, l(0) = r(0) = s, l(1) = r(1) = g, l(t) is visible from r(t) for all t  [0, 1] • A walk on P is called straight if both l and r are non-decreasing with respect to the orientation of L and R.

  12. A straight walk on P from line segment p0q0 to line segment p1q1, where p0<p1, q0<q1 are contained in P has to fulfill the conditions l(0)=p0, r(0)=q0, l(1)=p1, r(1)=q1; l and r are non-decreasing.

  13. Not walkable Straight walkable Walkable (backtracking)

  14. Lemma2.3: • A walk is straight iff no two walk line segments cross. • Any straight walk (if one exists) is of minimum length.

  15. Definition 2.4 • A walk instruction is one of the following elementary motions: • Both guards move forward along segments of single edges • One of the guards moves forward, the other one moves backward along segments of single edges. • Special case: one of the guards may stand still while the other moves • k: the number of walk instructions in a walk of minimal length

  16. Outline • Introduction • Notation • Straight Walk • Counter Walk • General Walk • Conclusions

  17. pj+1 Pj Pj-1 Reflex vertex • reflex vertex: one vertex with interior angle larger than 1800 • Forw(pj): the first point of P on the ray r(pj, pj-1pj) that is visible from pj • Backw(pj): the first point of r(pj, pj+1pj)∩P that is visible from pj • We build up a balanced search tree for all vertices and hit points on L

  18. Walk interval of v • For each vertex v, a connected subset of the polygonal chain, L or R, opposite to v that will be called the walk interval of v.

  19. Chazelle and Guibas have presented an algorithm that: • For any v in P and for any direction u the first intersection of r(v, u) with P in time O(logn) • This result can be used to determine the points Forw(v), Backw(v) for all vertex v L∪R in time O(nlogn), since O(n) shooting queries have to be answer in time O(logn) each.

  20. (i)Succ(p) is invisible from R Succ(p) Lemma 3.2 • The chain L is weakly visible from R iff there is no reflex vertex p  L such that: p<Backw(p)  L or p>Forw(p) L

  21. Lemma 3.3 • There is no straight walk for P if one of the following condition is true • pL, qR: (q<Backw(p)R and p<Backw(q)L) or (q>Forw(p)R and p>Forw(q)L) ---------Deadlock • p, p’L: p<p’ and Forw(p’)(R) <Backw(p) L-----Left wedge • q, q’R: q<q’ and Forw(q’)(L) <Backw(q) L-----Right wedge • In case(1) not even a walk for P exists.

  22. Backw(q) Backw(p) Pred(p’) q Backw(p) Forw(p’) Succ(p) q’ (q<Backw(p)R and p<Backw(q)L) Or (q>Forw(p)R and p>Forw(q)L) Forw(p’)(R) <Backw(p) L Forw(q’)(L) <Backw(q) L Lemma 3.3

  23. Definition 3.4 • For a vertex pL we define: hiP(p) = min{q| q vertex in R and Backw(q)>p} hiS(p) = min{Forw(p’)R| p’ vertex in L>p } hi(p) = min{hiP(p), hiS(p), g} loP(p) = max{q| q vertex in R and Forw(q)>p} loS(p) = max{Backw(p’)R| p’ vertex in L<p } lo(p) = max{loP(p), loS(p), g} letter P: partner, letter S: self

  24. Lemma 3.6 & 3.7 • Lemma 3.6 Each possible straight walk partner for a vertex v is contained in the interval [lo(v), hi(v)] • Lemma 3.7 Let pL, qR be two vertices of P. • If q<lo(p) then hi(p)<p; if q>hi(p) then lo(q)>p • p[lo(q), hi(q)]  q[lo(p), hi(p)]

  25. Lemma 3.8 • Let the chains L and R be mutually weakly visible and let pL be a vertex satisfying lo(p)≦hi(p). Then the interval [lo(p), hi(p)] is visible from p.

  26. lo(p) = Backw(p’), the other p’=Forw(lo(p)) • Any intersection of plo(p) from below p’lo(p) must intersect p’lo(p) first, which is impossible • Since lo(p)≦hi(p), we conclude that L<p’∪L>p’’∪R<lo(p)∪R>hi(p) intersects neither plo(p) nor phi(p).

  27. Cases leading to a contradiction in the proof of lemma 3.8

  28. Lemma 3.9 & 3.10 • Lemma 3.9 Let the chains L and R be mutually weakly visible. There is a straight walk for P iff lo(p)≦hi(v) for all vertices vL∪R • Lemma 3.10 If P is straight walkable then for every vertex v each point of the internal [lo(v), hi(v)] is a suitable walk partner for v.

  29. Theorem 3.11 • Let the chains L and R be mutually weakly visible. Then there is a straight walk for P iff none of the condition of Lemma 3.3 is true. And to construct a straight walk, O(nlogn) time and linear space are sufficient.

  30. Outline • Introduction • Notation • Straight Walk • Counter Walk • General Walk • Conclusions

  31. (Straight) counter-walk • Given a polygon P with two marked vertices, s and g, and two guards have to walk along two chains, L and R, of the polygon such that they are always mutually visible. • One starts at s and goes to g while the other one starts at g and walks to s, still without backtracking. • L and R are weakly visible and that s and g are mutually visible(necessary condition in this case)

  32. Definition 4.1 • The boundary conditions l(0)=s, l(1)=g, r(0)=g, r(1)=s • A straight counter walk has a non-decreasing function l and a non-increasing function r with respect to the orientation of L and R. • A straight counter walk on P from line segment p0q0 to p1q1 in P, where p0<p1, and q1<q0, is required to fulfill the conditions l(0)=p0, r(0)=q0, l(1)=p1, r(1)=q1, and l is non-decreasing and r is non-increasing.

  33. Lemma 4.2 • There is no straight counter walk for L, R, if one of the following applies • pL, qR: (q>Forw(p) R and p<Backw(q)L) or (q<Backw(p)R and p>Forw(q) L) • p, p’L: p<p’ and Forw(p)(R) <Backw(p’) R • q, q’R: q<q’ and Forw(q)(L) <Backw(q’) L

  34. p’ q’ Backw(p’) Backw(q) Succ(q) Pred(p) Forw(p) Forw(p) q q’ Pred(p)<Backw(q)≦p’ Succ(q)>Forw(p)≧q’ q’ ≧ Backw(p’)>Forw(p)≧q

  35. Definition 4.3 • For a vertex pL we define: C-hiP(p) = min{Pred(q)| q vertex in R and Forw(q)<p} C-hiS(p) = min{Forw(p’)R| p’ vertex in L≦p } C-hi(p) = min{C-hiP(p), C-hiS(p), g} C-loP(p) = max{Succ(q)| q vertex in R and Backw(q)>p} C-loS(p) = max{Backw(p’)R| p’ vertex in L≧p } C-lo(p) = max{C-loP(p), C-loS(p), g} letter P: partner, letter S: self, letter C: counter

  36. Lemma 4.4 & 4.5 • Lemma 4.4 • Each possible walk partner for a vertex v in a straight counter-walk is contained in the interval [C-lo(v), C-hi(v)] • Lemma 4.5 Let pL, qR be two vertices of P • If q<C-lo(p) then p<C-lo(q), if q>C-hi(p) then p>C-hi(q) • p [C-lo(q), C-hi(q)]  q [C-lo(p), C-hi(p)]

  37. Lemma 4.6 & 4.7 & 4.8 • Lemma 4.6 For all vertices v of P we have [C-lo(v), C-hi(v)] ≠ψ • Lemma 4.7 For all vertices v of P we have [C-lo(v), C-hi(v)]∩vis(v) ≠ψ • Lemma 4.8 The set [C-lo(v), C-hi(v)]∩vis(v) is connected for all vertices v of P

  38. Definition 4.9 • For a vertex v of P • VC-lo(p) = min{[C-lo(v), C-hi(v)]∩vis(v)} • VC-hi(p) = max{[C-lo(v), C-hi(v)]∩vis(v)}

  39. Lemma 4.10 & 4.11 • Lemma 4.10 Considered as functions {vertices of L}R or {vertices of R} L, C-hi and C-lo are monotonically decreasing. The same property holds for VC-hi and VC-lo. • Lemma 4.11 Let pL, qR be two vertices of P • If q<VC-lo(p) then p<VC-lo(q), if q>VC-hi(p) then p>VC-hi(q) • p [VC-lo(q), VC-hi(q)]  q [VC-lo(p), VC-hi(p)]

  40. Lemma 4.12 • All intervals [VC-lo(v), VC-hi(v)] can be computed in time O(nlogn) Pf: • Use the optimal shortest path queries provided by Guibas and Hershberger. • Given a triangulated polygon, after a linear time preprocessing step this algorithm determines in time O(logn) the length of the shortest path inside a polygon P between two arbitrary points.

  41. Consider for a vertex pL the shortest paths from p to C-lo(p) and C-hi(p). Let vl and vh denote the first vertices after p on the two shortest paths. Then VC-lo(p) and VC-hi(p) are the hit points of the shots from p through vl and vh • We can compute each point VC-lo(v) VC-hi(v) from the points C-lo(v), C-hi(v) by one shortest path query and one shooting query each, in an overall running time of O(nlogn)

  42. Theorem 4.13 • There is a straight counter-walk iff the chains L and R are mutually weakly visible and none of the conditions of Lemma 4.2 applies. Such a straight counter-walk can be computed in O(nlogn) time.

  43. Outline • Introduction • Notation • Straight Walk • Counter Walk • General Walk • Conclusions

  44. General Walk • A polygon admits a general walk if and only if it is weakly visible and contains no deadlock, where wedges are permitted, in contrast to straight walkable polygons.

  45. Algorithm for general walk • Step1 • Build search structures for all vertices & hit points • Check for weakly visibility of L and R(lemma 3.2) • Check for deadlock(lemma 3.3) • Step2 • Using algorithm turnpoint to compute the necessary and sufficient turning points for a walk(With this information we can partition P into straight walkable and straight counter-walkable pieces and apply the results for each piece. • Step3 • Show that the concatenation of these walks is of minimal length and that the whole algorithm runs in time O(nlogn + k), where n is the number of vertices in P and k is the number of walk instructions the minimal walk consists of.

  46. utp First wedge was detected, and the utp was determined Algorithm turnpoint

  47. A walk with backtracking

  48. Definition 5.1 • Let utp=Backw(up), ltp=Forw(lp) be a pair of points that has been reported by algorithm turnpoint • If up, lpL (and utp, ltpR) we call (up, lp, utp, ltp) a left maximum wedge. Otherwise, we call (utp, ltp, up, lp) a right maximum wedge.

  49. Lemma 5.2 • For two maximum wedges W1=(utp1, ltp1, up1, lp1) and W2= (utp2, ltp2, up2, lp2) on L and R, resp., the following holds Either (utp1<up2 and lp1 < ltp2)  W1<W2 or ( lp2 < ltp1 and utp2<up1) W2<W1

More Related