270 likes | 331 Views
Searching a room by two guards. Sang-Min Park Jae-Ha Lee Kyung-Yong Chwa International Journal of Computational Geometry & Applications Vol.12 No.4 (2002)339-352. Outline . Introduction Preliminaries Necessary Conditions Searchability Conclusion. The polygon search problem.
E N D
Searching a room by two guards Sang-Min Park Jae-Ha Lee Kyung-Yong Chwa International Journal of Computational Geometry & Applications Vol.12 No.4 (2002)339-352
Outline • Introduction • Preliminaries • Necessary Conditions • Searchability • Conclusion
The polygon search problem • Problem: searching for mobile intruders in a polygon region by one or more mobile searchers. • Object: computing a schedule for the searchers so that all intruders will eventually be detected by one of the searchers • we say that a polygon is searchable by given searchers if there exists such a schedule
d Ⅰ. A room • A room(P,d) is an n-sided polygon P with a designated point d on the boundary. • An O(n2)-time algorithm is needed to construct a search schedule. • [ref] J.-H. Lee, S.-M. Park and K.-Y. Chwa, International Journal of Computational Geometry & Applications 10(2) 2000
g L R d Ⅱ. A corridor • A corridor(P,d,g) is an n-sided polygon P with two designated points d and g on the boundary. • Two guards simultaneously walk long L and R respectively, from d to g, in such a way that they are always mutually visible. • An O(nlogn+m)-time algorithm is needed • m: the size of output(i.e the number of walk instructions) [ref] Icking & Klein
In this paper, we will give an O(nlogn)-time algorithm to test the walkability of a room in the following sense: • suppose a room(P,d) is searchable by two guards and has a search schedule ending at a point g’.
r l d Notations • room(P,d):a simple polygon P with a point d • P :the boundary of P • point order: for p, q P,p<q if p is encountered before q when we traverse Pfrom d clockwise • two points is visible from each other: the line segment is at each time fully contained in the polygon (l,r: two points)
Definition1: A search schedule on (P,d) is a pair (l,r) of continues functions such that: • l:[0,1]→ Pr:[0,1] → P • l(0)=dl , r(0)=dr • l(1) and r(1) are on the same edge of P • for every t (0,1), l(t)<r(t), and l(t) and r(t) are mutually visible
D(vi)=C[Vi’,Vi+1] r(t) vi contaminated vj l(t) g’ clear Vi’ d Vj’ d D(vj)=C[Vj-1,Vj’]
reflex vertex • reflex vertex • r-neighbor • S: the set consisting of all the reflex vertices and all the r-neighbor vertices of P including duplicated ones • we label the vertices in S as (dl≦)v0, v1, v2, …, vn’(≦dr) in clockwise order from dl • C[p,q]:chain traversed from p to q in clockwise • D(vi): dominated chain
N: the set of r-neighbor vertices of P • N attic = {x|xN such that dD(x)}, x:attic • N cellar = {y|yN such that dD(y)}, y:cellar • l-attic: an attic precedes its reflex vertex • r-attic: an attic succeeds its reflex vertex • ND(x,y) if and only if xD(y) and yD(x) • aa-pair, ac-pair, cc-pair
Two guards in Corridors • Theorem1:A corridor(P,d,g) is walkable if and only if: • (1)there is no attic x such that D(x)C(d,g) or D(x)C(g,d) • means:the weak visibility of C(d,g) and C(g,d) • (2)there is no aa-pair(x,y) such that x is an r-attic in C(d,g) and y is an l-attic in C(g,d) • means:the absence of backward deadlocks • (3)there is no cc-pair(x,y) such that x is an l-cellar in C(d,g) and y is an r-cellar in C(g,d) • means:the absence of forward deadlocks
g g d d d Not weakly visible Backward deadlocks Forward deadlocks g
searchable unsearchable searchable g g g g d d d d unsearchable
Necessary Conditions • Lemma1:If a room(P,d) has an aa-pair, (P,d) is unsearchable • Proof: • There is an aa-pair(Vi,Vj), Vi<Vj • Consider:(1) l visit Vi first: ∵Vj is an attic, if visible→r lie on line ViVi+1 ∴r pass through Vj (→←) (2) r visit y first: ∵Vi is an attic, if visible→l lie on line Vj-1Vj ∴r pass through Vi (→←) Vi Vj
The range of g’ • Lemma2: For each l-attic Vp, g’ is in C[dl,Vp+1). Symmetrically for each r-attic Vq, g’ is in C(Vq-1,dr] • Lemma3: If a room(P,d) is searchable, g’ lies in C[dl,Vi+1) or C(Vj-1,dr] for each cc-pair(Vi,Vj) • Lemma4: If an l-attic Vp and an l-cellar Vq form an ND-pair, then g’ is in C(Vq+1,Vp+1). Symmetrically, if an r-attic Vp and an r-cellar Vq form an ND-pair, then g’ is in C(Vp-1,Vq-1)
Vp Vj Vj Vi Vi Vj Vi Vp Vp d d The range of g’ constrained by attics, cc-pairs and ac-pairs
G: the feasible range of g’ • If there exist at least one attic or at least one cc-pair then G≠ P • Lemma5: If G is an empty set, then (P,d) is unsearchable
Theorem2: If a room is searchable then • (C1) there is no aa-pair(Vi,Vj) and • (C2) G is nonempty • we have this theorem Lemma1 and Lemma2 • Corollary1: If there are cc-pair (Vi,Vj) and attic Vp such that ND (Vi,Vp) and ND (Vj,Vj), then G is empty
d d d cc-pair(Vi,Vj) Attic Vp aa-pair Examples violating C1 and C2 in Theorem2
Time complexity to test C1 and C2 for given room • Scanning the boundary of P: • We can indetify attics, cellars and dominated chains • O(logn) • Testing if a room has empty G • A linear number of cc-pairs and ac-pairs • Only check the attics whose dominated chains are minimal • After the preprocessing of O(n) number of ray-shooting queries, C1 and C2 can be tested during a scan of sorted lists of the attics and the cellars in O(nlogn) time
Counter_Walk • Definition2:We are given a polygon P and four points ls, lt, rs, rt on P such that ls<lt<rs<rt. A counter_walk is a pair(l,r) of continuous functions such that: • l:[0,1]→ C[ls,lt],r:[0,1] → C[rs,rt] • l(0)=ls , r(0)=rs, l(1)=lt ,r(1)=rt , • for every t (0,1), l(t) and r(t) are mutually visible
Theorem3: we are given a polygon. Let L=C[ls,lt] be a chain on which l moves from ls to lt, and R=C[rs,rt] be a chain on which r moves from rs to rt such that l and r are mutually visible all the time and dl<ls<lt<rs<rt<dr. Then L and R have a counter_walk if and only if: • (a) L and R are weakly visible from each other, and • (b) L has no l-cellar non-dominating with an l-attic in R, and • (c) L has no r-attic non-dominating with an r-cellar in R • Ref.[Icking & Klein]
An algorithm for two guards to search a room • Step0: If (P,d) has no attic, then two guards can search the room in such a way that one guard stands at d while the other guard traverses P; exit. • Step1: We assume that (P,d) has at least one attic. Pick an arbitrary point gG. • Step2: If C[d,g] and C[g,d] are weakly visible from each other, Corridor_Walk(d,g,d,g); exit. • Step3: If C[d,g] and C[g,d] are not weakly visible from each other, w.l.o.g., we assume that C[d,g] has an r-attic invisible from C[g,d]. Let Vp be the r-attic in C[d,g] whose shot is the most counterclockwise. Let Vg be the most counterclockwise vertex in the closure of G/
Step4: If Vg<Vp’ then if C[Vg,d] has an l-attic invisible from C[d. Vg] then let Vs be the one with the most clockwise shot and assign Vg to Vg’ and Vs’ to Vg; Corridor_Walk(d,Vg,d,Vg); exit. • Step5: Corridor_Walk(d,Vp,d,Vp’) • Step6:Let Vq be the l-cellar in C(Vg’,Vg) whose shot is the most clockwise.
Step7: Repeat If C[Vp,Vp’] is entirely visible from Vp’, then move l from Vp to Vp’; exit. else find the r-attic or l-cellar from which Vp’ is not visible and that is first met when we traverse from Vp clockwise. Let Vr’ denote it. If Vr’ is an r-attic, let Vr be the r-attic whose shot is the most counterclockwise and such that all l-cellars in C[Vp,Vr] are visible from Vp’. If Vr’ is an l-cellar, let Vr be the l-cellar whose shot is the most clockwise and such that all r-attics in C[Vp,Vr] are visible from Vp’. CASE1: If Vr is an l-cellar. Counter_Walk(Vp,Vr,Vp’,Vr’); VpVr; CASE2: else Corridor_Walk(Vp,Vr,Vp’,Vr’); VpVr; until l arrives at Vq (that is Vp=Vq) • Step8: Corridor_Walk(Vq,Vg,Vq’,Vg)
Conclusion • A room is unsearchable by two guards if and only if it violates any of C1 and C2. Given a room, we can test these conditions in O(nlogn)