10
The Tourist in the Shopping Arcade 1 Rudolf Fleischer (Fudan University, Shanghai, China [email protected]) Tom Kamphans (Braunschweig University of Technology, Germany [email protected]) Rolf Klein (University of Bonn, Germany [email protected]) Elmar Langetepe (University of Bonn, Germany [email protected]) Gerhard Trippen (University of British Columbia, Vancouver, Canada [email protected]) Abstract: A tourist is searching for a gift and moves along a shopping arcade until the desired object gets into sight. The location of the corresponding shop is not known in advance. Therefore in this on-line setting the tourist has to make a detour in comparison to an optimal off-line straight line path to the desired object. We can show that there is a strategy for the tourist, so that the path length is never greater than C times the optimal off-line path length, where C =1.059401 ... holds. Furthermore, there is no strategy that attains a competitive factor smaller than C . Key Words: Computational geometry, on-line algorithms, on-line navigation. Category: F.2, G.2 1 Introduction He, who travels, often feels the need to buy some souvenirs, to prove the greatness of the sites he saw to those who could not join him on his trip. While, generally, 1 This work was begun while the third author was visiting HKUST in March 2002. The work described in this paper was partially supported by the National Natural Science Fund China (grant no. 60573025), by a grant from the Research Grants Council of the Hong Kong Special Administrative Region, China (Project No. HKUST6010/01E) and by a grant from the Germany/Hong Kong Joint Research Scheme sponsored by the Research Grants Council of Hong Kong and the German Academic Exchange Service (Project No. G-HK024/02). Journal of Universal Computer Science, vol. 16, no. 5 (2010), 676-685 submitted: 30/7/09, accepted: 12/2/10, appeared: 1/3/10 © J.UCS

The Tourist in the Shopping Arcade

Embed Size (px)

Citation preview

The Tourist in the Shopping Arcade1

Rudolf Fleischer(Fudan University, Shanghai, China

[email protected])

Tom Kamphans(Braunschweig University of Technology, Germany

[email protected])

Rolf Klein(University of Bonn, Germany

[email protected])

Elmar Langetepe(University of Bonn, Germany

[email protected])

Gerhard Trippen(University of British Columbia, Vancouver, Canada

[email protected])

Abstract: A tourist is searching for a gift and moves along a shopping arcade until thedesired object gets into sight. The location of the corresponding shop is not known inadvance. Therefore in this on-line setting the tourist has to make a detour in comparisonto an optimal off-line straight line path to the desired object. We can show that thereis a strategy for the tourist, so that the path length is never greater than C∗ times theoptimal off-line path length, where C∗ = 1.059401 . . . holds. Furthermore, there is nostrategy that attains a competitive factor smaller than C∗.Key Words: Computational geometry, on-line algorithms, on-line navigation.

Category: F.2, G.2

1 Introduction

He, who travels, often feels the need to buy some souvenirs, to prove the greatnessof the sites he saw to those who could not join him on his trip. While, generally,1 This work was begun while the third author was visiting HKUST in March 2002. The

work described in this paper was partially supported by the National Natural ScienceFund China (grant no. 60573025), by a grant from the Research Grants Council of theHong Kong Special Administrative Region, China (Project No. HKUST6010/01E)and by a grant from the Germany/Hong Kong Joint Research Scheme sponsored bythe Research Grants Council of Hong Kong and the German Academic ExchangeService (Project No. G-HK024/02).

Journal of Universal Computer Science, vol. 16, no. 5 (2010), 676-685submitted: 30/7/09, accepted: 12/2/10, appeared: 1/3/10 © J.UCS

shopping is a complicated task that calls for optimizing quite conflicting goals,the average tourist wants to minimize the time it takes to find a reasonable gift.

In this paper we provide an optimal solution for the following situation. Atourist finds himself near a shopping arcade where shops are lined up in a singlecolumn; see Figure 1.

Due to reflective window panes, the tourist can see the goods on displayin a shop only when he looks into its window perpendicularly. However, hiseyesight is good enough to do so from the initial distance given. The touristis prepared to scan the arcade, shop by shop, until he sees the first item thatmatches his criteria (highlights the site, fits into suitcase, doesn’t cost too much,might please the receiver, etc.). As soon as such an item becomes visible, thetourist hurries straight into the shop to buy it. We assume that the variety ofgoods on offer in this arcade is such that at least one shop carries a qualifyingitem, so that the tourist’s quest will be successful. But how should he proceedto be as quick as possible? This problem belongs to the class of on-line navi-

up

Figure 1: The tourist in the shopping arcade.

gation tasks, which have attracted a lot of attention during the last 30 years;see [Borodin and El-Yaniv 1998] or [Fiat and Woeginger 1998] for surveys. Typ-ically, one wants to accomplish a certain mission in a geometric environmentthat is initially not completely known. The mission may be to fully explore theenvironment and return to the start, or to search the environment for a goal

677Fleischer R., Kamphans T., Klein R., Langetepe E., Trippen G.: The Tourist ...

and stay there; the latter problem is interesting even when the environment isknown but the position of the goal is unknown, see [Fleischer et al. 2008].

Equipped with complete information, one could compute an optimal solution,like the shortest round trip from which each point of the environment is visible atleast once, or the shortest path from start to goal. Without complete knowledge,such an optimal solution is in general not available. But one can strive for near-optimal results.

A strategy S for solving an on-line problem P is called C-competitive if, foreach instance I of P , the cost of solving I by means of strategy S is at mostC times the cost of an optimal solution of I, plus an additive constant. Sucha number C is called competitive ratio of strategy S for problem P . Given aproblem P , the challenge is in designing a C-competitive strategy for solvingit, where C is as small as possible (clearly, C cannot be smaller than 1, and itmay be infinite if problem P does not admit a competitive solution at all). Theconcept of competitive analysis goes back to [Sleator and Tarjan 1985].

Not always are the smallest possible competitive ratios precisely known. Forexample, [Hagius et al. 2004] proved that no strategy can explore a simple poly-gon with a competitive ratio less than 1.2825; but the best exploration strategyknown [Hoffmann et al. 2001] has a competitive ratio of 26.5, leaving open quitesome gap. [Icking et al. 1993] considered a subproblem of polygon exploration,namely looking around a single protruding corner, and presented an optimal1.21218-competitive strategy.

More tight results are known for the search problem. Some authors [Gal 1980,Baeza-Yates et al. 1993, Kao et al. 1996] studied the problem of finding a pointon a line. Exploring both sides in turn, each time doubling the depth from thestart, results in a competitive ratio of 9, and no smaller ratio can be achievedby any deterministic strategy. This result can be generalized to m ≥ 2 halflinesthat meet at the start; see the work in [Lopez-Ortiz and Schuierer 2001] and[Lopez-Ortiz and Schuierer 2004]. An optimal strategy for searching a point in a“street” polygon was given in [Icking et al. 2004]. The old problem of searchingfor a point in the plane was recently settled by [Langetepe 2010].

In our tourist’s case, a problem instance is given by the start point s = (0, 0),by the vertical half-line H running from (1, 0) upwards, and by some pointu = (1, h) on H representing the bottommost shop that carries a suitable item;see Figure 2.2

If the location of u were known to the tourist, he would walk straight from s tou, at an optimum cost of |su| =

√1 + h2. Since u is not known, the tourist needs

to follow a path S—representing the strategy—that leads him upwards, so thathe eventually reaches the horizontal line {Y = h} at some point p = (w(h), h)

2 We may assume that the distance from startpoint s to halfline H equals 1 since ourproblem is invariant under scaling.

678 Fleischer R., Kamphans T., Klein R., Langetepe E., Trippen G.: The Tourist ...

to the left of, or on, half-line H . From here he is able to see u and can walkhorizontally from p to u. Let L(h) denote the length of S between s and p. Thenthe total length of the tourist’s path is given by L(h) + 1 − w(h); see Figure 2.Hence, the competitive ratio of strategy S equals

C(S) = maxh≥0

L(h) + 1 − w(h)√1 + h2

. (1)

The path leading vertically upwards would have a competitive ratio of√

2 ≈

S H

s = (0, 0) (1, 0)

u = (1, h)p = (w(h), h)

L(h)

Figure 2: Notations used.

1.4142; it is attained by u = (1, 1). The same holds for the path that first runshorizontally to (1, 0), and then upwards along H . In order to improve on this ra-tio, the tourist should move upwards and to the right simultaneously. A suitablepath S∗ will be presented in Section 2. We shall derive some structural prop-erties of S∗, and the fact that C(S∗) = 1.059401 . . . holds. Then, in Section 3,we show that no path can attain a competitive ratio smaller than C(S∗), thusproving S∗ to be an optimum solution to the tourist’s problem.

2 Constructing a Strategy

Apparently any reasonable strategy should move simultaneously along and to-wards the arcade; that is, in positive X- and Y -direction. Note that the compet-itive factor for any reasonable strategy converges to 1 for goals with very smallY -coordinate and also for goals with a large Y -coordinate.

Therefore, for the first part of our strategy will make use of a line segmentand the competitive ratio will increase for a while. The second part will be a

679Fleischer R., Kamphans T., Klein R., Langetepe E., Trippen G.: The Tourist ...

curve that converges toward the arcade. As in many similar application the ratiofor this part of the strategy will be the same for all corresponding goals on H .After hitting the arcade, the third part of the strategy just moves along thearcade and the competitive ratio will therefore decrease.

Altogether, we are presenting a path S∗ that consists of three parts, a linesegment connecting startpoint s = (0, 0) to some point (a, b), followed by a curvethat hits halfline H in some point (1, d). From there on, S∗ runs along H ; seeFigure 3. The points on path S∗ will be parametrized by their X-coordinatesw(h) as a function of their Y -coordinates, h. The parameters a, b, d and the

S∗ H

s = (0, 0) (1, 0)

(w(h), h)

(a, b)

(1, d)

(1, h)

Figure 3: Defining strategy S∗.

function w(h) are specified as follows. Using the standard abbreviation

arctanh(x) =12

ln1 + x

1 − x, where x ∈ (−1, 1),

we can define a function

f(y, h) :=arctanh

(1√

1+y2

)+√

1 + y2 − arctanh(

1√1+h2

)− y2

√1 + h2

2√

1 + y2

(2)for all non-zero values of y and h. Let

g(y) := f

(y,

1y

).

Since g(0.1) = 1.892 . . . and g(1) = 0, there must be a number b ∈ (0.1, 1)such that g(b) = 1 holds, by continuity. Moreover, b is uniquely determined,

680 Fleischer R., Kamphans T., Klein R., Langetepe E., Trippen G.: The Tourist ...

because function g has a negative derivative in this interval. Numerical compu-tation shows that b = 0.349748 . . . holds. We fix this number b and let

a := f(b, b) =1 − b2

2= 0.438835 . . . and d :=

1b

= 2.85912 . . .

Now we are ready to define the function w(h) as follows.

w(h) :=

⎧⎨⎩

ab h, 0 ≤ h ≤ b

f(b, h), b ≤ h ≤ d

1, b ≥ d

(3)

By definition, w(h) is continuous and fulfills w(0) = 0, w(b) = a, and w(h) = 1for h ≥ d. The resulting path S∗(h) = (w(h), h) has some extremal propertiesthat are stated in the following Lemma 1. Let

C(h) :=L(h) + 1 − w(h)√

1 + h2(4)

denote the ratio in path length that results if the target u is located at height h;see Formula (1).

Lemma1. Function C(h) is

1. monotonically increasing from 1 for h ∈ [0, b], attaining a maximum ofC(b) =

√1 + b2 =: C∗ = 1.059401. . . ;

2. constantly equal to C∗ for h ∈ [b, d];

3. monotonically decreasing towards 1 for h ≥ d.

Proof. For h between 0 and b we have w(h) = ha/b, so that L(h) =√

(hab )2 + h2

holds for the length of the line segment from (0, 0) to (w(h), h). This yields forthe derivative of C(h)

C′(h) =(L′(h) − w′(h))

√1 + h2 − (L(h) + 1 − w(h)) 1

21√

1+h2 2h

1 + h2

=(L′(h) − w′(h)) (1 + h2) − (L(h) + 1 − w(h)) h

(1 + h2)3/2.

Numerator N of this expression equals

N =

(√a2

b2+ 1 − a

b

)(1 + h2) −

(h

√a2

b2+ 1 + 1 − ha

b

)h

=

√a2

b2+ 1 −

(a

b+ h)

≥√

a2

b2+ 1 −

(a

b+ b)

= 0

681Fleischer R., Kamphans T., Klein R., Langetepe E., Trippen G.: The Tourist ...

since a = (1 − b2)/2 implies a2

b2 + 1 = (ab + b)2. This shows that C(h) is mono-

tonically increasing. Clearly, C(0) = 1 holds, and

C(b) =L(b) + 1 − w(b)√

1 + b2

=√

a2 + b2 + 1 − a√1 + b2

=√

1 + b2 = C∗ = 1.059401 . . .

follows from√

a2 + b2 = b2 + a. This proves the first claim of our lemma.Now let us assume that h ∈ [b, d]. Using arctanh′(x) = 1/(1 − x2) we obtain

from Formulae (3) and (2), by straightforward calculation of the derivative,

w′(h) =1

2C∗1 − b2h2

h√

1 + h2, (5)

which implies

2C∗w′(h)h√

1 + h2= 1 − C∗2h2

1 + h2,

hence

1 + w′(h)2 = w′(h)2 + 2w′(h)C∗ h√1 + h2

+C∗2h2

1 + h2.

Since w′(h) ≥ 0, thanks to h ≤ d = 1/b, we can conclude that

√1 + w′(h)2 = w′(h) + C∗ h√

1 + h2

or−w′(h) +

√1 + w′(h)2 = C∗ h√

1 + h2

holds. By integration, we obtain

A − w(h) +∫ h

b

√1 + w′(t)2 dt = C∗√1 + h2

for some constant A. For h = b, w(b) = a holds, and therefore A = 1 + a + b2 =1 +

√a2 + b2 results. But

√a2 + b2 +

∫ h

b

√1 + w′(t)2 dt + 1 − w(h) = C∗√1 + h2

means C(h) = C∗, thus proving the second claim of the lemma; compare For-mula (4).

682 Fleischer R., Kamphans T., Klein R., Langetepe E., Trippen G.: The Tourist ...

Finally, let us consider the behavior of the function C(h) for h = d+y, wherey ≥ 0. Let L denote the length of S∗ between (0, 0) and (1, d). Then,

C(d + y) =L + y√

1 + (d + y)2.

The derivative with respect to y equals

d

dyC(d + y) =

1 + (d + y)2 − (L + y)(d + y)(1 + (d + y)2)3/2

.

For the numerator M we find

M ≤ 0 ⇔ 1 + d2 − Ld ≤ y(L − d).

The latter assertion is true since L > d holds, and because

C(d) =L√

1 + d2= C∗ =

√1 + b2

and b = 1/d imply Ld = d2 + 1. This completes the proof of Lemma 1.

We note that the definition of the function w(h) can be found by workingthrough the proof of Lemma 1 backwards.

3 Proof of Optimality

In this section we show that S∗ is an optimum solution for the tourist’s problem.The following fact will be helpful.

Lemma2. Path S∗ is convex.

Proof. From Formula (5) we obtain

w′′(h) = − b2h2 + 2h2 + 1

2(1 + h2)3/2√1 + b2h2≤ 0

for all arguments h ∈ [b, d]. Moreover, the line segment from (0, 0) to (a, b)— theinitial part of S∗—has the same orientation as the tangent to S∗ at (a, b); thisfollows from

w′(b) =1

2C∗1 − b4

b√

1 + b2=

1 − b4

2b(1 + b2)=

1 − b2

2b=

a

b.

Now we can prove our main result.

Theorem 3. Strategy S∗ constructed in Section 2 has a competitive ration of1.059401 . . .. No other strategy attains a ratio smaller than this.

683Fleischer R., Kamphans T., Klein R., Langetepe E., Trippen G.: The Tourist ...

S∗

H

s = (0, 0)(1, 0)

(1, d)

(1, b)

T

p

(a, b)

S∗

H

s = (0, 0)(1, 0)

(1, d)

(1, b)

T

p=(w,h)

(a, b)

(i)(ii)

Figure 4: Proving optimality of strategy S∗.

Proof. Lemma 1 immediately implies

C(S∗) = C∗ = 1.059401 . . .

Let T denote an arbitrary strategy, represented by a path that starts from s =(0, 0) and runs upwards, to the left of, or on, halfline H . First, let us assumethat T passes through a point of height b to the left of (a, b), and let p be thefirst point on T of this type; see Figure 4(i). Then the length of T between s andp, plus the distance |p(1, b)|, exceeds L(b) + 1− a. Thus, C(T ) > C(b) = C∗, byLemma 1.

If this case does not apply, T runs between S∗ and H . Suppose that T meetsS∗ at some point p, that might be equal to (1, d); see Figure 4(ii). If the partof T from s to p is not the same as the corresponding part of S∗, it must bestrictly longer, by the convexity property established in Lemma 2. Then, if p isat height h, we have C(T ) > C(h) = C∗, by Lemma 1.

This shows that C(T ) > C∗ holds, unless T coincides with S∗ between s and(1, d), in which case C(T ) = C∗ trivially follows.

4 Conclusion

In this paper we have shown how to optimally move to a point on a half-line,starting from a point that is a certain distance away. An obvious question is, ifthis result can be combined with classical 2-way search on two halflines. Anothernatural generalization would be the following. Here we have shown how to reachthe origin of a ray that emanates at a right angle from a given half-line (the

684 Fleischer R., Kamphans T., Klein R., Langetepe E., Trippen G.: The Tourist ...

arcade), given that the ray can only be detected by stepping on it, just as forthe beam of a tightly focussed flashlight. How about detecting general rays in theplane? Perhaps some variation of spiral search will solve this problem optimally;compare [Eubeler et al. 2006].

Acknowledgement

The authors would like to thank the anonymous referees for their valuable com-ments. They helped to simplify the proof.

References

[Baeza-Yates et al. 1993] R. Baeza-Yates, J. Culberson, and G. Rawlins. Searching inthe plane. Inform. Comput., 106:234–252, 1993.

[Borodin and El-Yaniv 1998] A. Borodin and R. El-Yaniv. Online Computation andCompetitive Analysis. Cambridge University Press, 1998.

[Eubeler et al. 2006] A. Eubeler, R. Fleischer, T. Kamphans, R. Klein, E. Langetepe,and G. Trippen. Competitive online searching for a ray in the plane. In S. Fekete,R. Fleischer, R. Klein, and A. Lopez-Ortiz, editors, Robot Navigation, number 06421in Dagstuhl Seminar Proceedings. Internationales Begegnungs- und Forschungszen-trum fur Informatik (IBFI), Schloss Dagstuhl, Germany, 2006.

[Fiat and Woeginger 1998] A. Fiat and G. Woeginger, editors. On-line Algorithms:The State of the Art, volume 1442 of Lecture Notes Comput. Sci. Springer-Verlag,1998.

[Fleischer et al. 2008] R. Fleischer, T. Kamphans, R. Klein, E. Langetepe, andG. Trippen. Competitive online approximation of the optimal search ratio. SiamJ. Comput., pages 881–898, 2008.

[Gal 1980] S. Gal. Search Games, volume 149 of Mathematics in Science and Engi-neering. Academic Press, New York, 1980.

[Hagius et al. 2004] R. Hagius, C. Icking, and E. Langetepe. Lower bounds for thepolygon exploration problem. In Abstracts 20th European Workshop Comput.Geom., pages 135–138. Universidad de Sevilla, 2004.

[Hoffmann et al. 2001] F. Hoffmann, C. Icking, R. Klein, and K. Kriegel. The polygonexploration problem. SIAM J. Comput., 31:577–600, 2001.

[Icking et al. 2004] C. Icking, R. Klein, E. Langetepe, S. Schuierer, and I. Semrau. Anoptimal competitive strategy for walking in streets. SIAM J. Comput., 33:462–486,2004.

[Icking et al. 1993] C. Icking, R. Klein, and L. Ma. The optimal way for lookingaround a corner. In Proc. 4th IEEE–IEE Vehicle Navigation and InformationsSystems Conference, 1993.

[Kao et al. 1996] M.-Y. Kao, J. H. Reif, and S. R. Tate. Searching in an unknownenvironment: An optimal randomized algorithm for the cow-path problem. Inform.Comput., 133(1):63–79, 1996.

[Langetepe 2010] E. Langetepe. On the optimality of spiral search. In SODA 2010:Proc. 21st Annu. ACM-SIAM Symp. Disc. Algor., pages 1–12, 2010.

[Lopez-Ortiz and Schuierer 2001] A. Lopez-Ortiz and S. Schuierer. The ultimatestrategy to search on m rays? Theor. Comput. Sci., 261(2):267–295, 2001.

[Lopez-Ortiz and Schuierer 2004] A. Lopez-Ortiz and S. Schuierer. Online parallelheuristics, processor scheduling, and robot searching under the competitive frame-work. Theoret. Comput. Sci., 310:527–537, 2004.

[Sleator and Tarjan 1985] D. D. Sleator and R. E. Tarjan. Amortized efficiency of listupdate and paging rules. Commun. ACM, 28:202–208, 1985.

685Fleischer R., Kamphans T., Klein R., Langetepe E., Trippen G.: The Tourist ...