Chapter The Jurek Aquarium 51 Keeper’s Czyzowiczt Peter Egyed$ Hazel EvereW David RappaportS Thomas SherrnerT Diane Souvainell Godfried Toussaint$ Abstract Heron We solve the problem work inside a given (Aquarium of computing polygon which Z{eeper’s a linear-time and shortest-path by using Tour). algorithm hulls closed path edge at least polygons, uses the We then convex which every For convex maps. relative for polygons the shortest visits which Problem* we present reflection generalize to provide a linear method 1985, Klotzler infinite algorithm given variously Steiner one hundred years with one he also vertex case, there principle an on to show acute perimeter inscribed with earliest was even two i.e. the on one side points via vertex of it, the with find line. the This any reelection altitudes minimum the minimum by twice realized with of the two input the reflection the triangle: but In of the triangles, is the triangle of the vertices and over triangle used the points it is degenerate solved than solved [4] ,[8] ,[12] ,[13]. obtuse obtuse problem simpler the only of a given foot triangle altitude, coinciding points For that, perimeter Schwarz the are polygon. shortest that that triangle edge problem [11] insist not minimum each the Fagnano sources Schwarz the is consensus inscribed the ago, posed to many of computing that The attributed [5] ,[9] ,[15] ,[14], problem of ple given the [13] rithm, triangle. principle a line and two shortest path between problem was solved by *Pm-t of the work was carried out when the authom were participants of the Workshop on Illuminating Sets at the Bellairs Research Institute of McGill University. tDepartment d’Inforrnzkique, Universit6 du Quebech Hull, Quebec, CANADA H3S 2A7. $D~pw@ent of computing University, and Information Montreal, Science, Queen’s path University, Kingston, Ontario, CANADA K7L 3N6. 11S&X-J of Computing Science, Simon Fraser University, V5A 1 S6. Col-bi., CANADA IIDepartment of Computer Science, Rutgers Burn- University, New Brunswick, New Jersey, USA 08903. Supported in part by NSF Grant CCR-8S-03549. **Department of Computer Science, University of Ottawa, Ottawa, Ontario, CANADA KIN 6N5. of correct it is unclear the workshop, every then polygon which optimum uses We using convex hulls relative polygons which used a somewhat principle Problem. In and Zoo edges of P, in P and not ending contains log~ n) algorithm cages for time of P glass plates n cages, then the re- a related Keeper’s Keeper’s given polygons point a sim(cages) x on the perime- of any cage, starting cage. algorithm (i. e., the to an- Zoo the minimum every of a series zoo Ntafos of the is related the an entry the problem as edges the front 459 and is to find visits and solve Problem, k convex in the interior at z, that an O(n [2], Keeper’s of P, the goal by algorithm [3]. Problem Ntafos P of n vertices, to boundary the Chin to and method a linear shortest-paths the a linear- principle combination Keeper’s Chin in fact, our convex. polygons Aquarium is, reflection to provide not If the poly- we present generalize similm on rectilinear ple polygon the are and problem the Keeper’s once. path and also for the shortest (Aquarium at least inpolygon, maps. algorithm [161 Posed the he asked edge the perimeter his Toussaint a simple visits algorithm and four algo- solution. differently: inside solutions whether correct shortest-path O(nz) aby, British and detect is convex, ter tour He presents In attached Science, McGill descent. de- princi- one somewhat other a finite reflection omits a recent problem using Schwarz’ analysis. type flection for complexity which have in- an algorithm no formal Tour) for of a provides closed time edge perimeter of the minimum the each performance in fact At gon vertices coordinate-wise a semiminimum efficient realizable problem on minumum inpolygon, from his classification would used the [5] presented optimum Euclid’s to illustrate but addition, [9] vertex the Focke extending determine one or resulting and The Hull, Quebec, CANADA. of Computer $s&ool 1986, method examples with while Rudolph to polygon, In computing Introduction Although polygon convex scent 1 and simplex-method polygon. are not convex. in 100 AD [8]. perimeter principle that of Alexandria on optics In once Jorge Urrutia** The and paper refers [2] to a as well. If we consider edges of P represent of aquariums) problem and have reduces tO a CZYZOWICZ 460 simplified version fixed starting this restriction, either O(n 2 of the Aquarium point is given. our complexity logn Problem Note that in which even a without is appreciably less than ,q3( v,) n) or 0(n2). Optimum ET AL. Keeper’s Tour in a Convex Aquarium Given a convex polygon given in ented in clockwise is to determine such that the ei clockwise let order least such which of the with a vertex vj tinct edges, there can be no advantage once, ori- The goal wo, W1, . . . . wk. lies on of the closed length that edge Wi Since of P and it is possible the at vi. points, the . . . ~wk - 1, w(I is a minimum. coincide VO, VI, . . . . v~-1 originates of one that vertices ei represent a sequence at and W(), wl, P with order, a point thus in visiting of path w~ may lie on two k < n. Since -l each dis- P is convex, an edge more Figure than 1: then the polygon tour 2.1. If the optimum aquarium keeper’s in order. is exactly In the polygon tour other visits words, optimum is the the Proof. Assume edges in Wj Wj+l order, a convex every triangle the optimum of the tour as follows, keeper’s in and the of that the sum of the lengths the of Wlj ..., WiJWj, of the its then be optimal, does visit a side LEMMA the interior angle Vj+l Proof. line P original and its triangulated points not lie on ej, of the to in equal on ei+l points are . ..>wk. wl then v2i_l and rotate the of the then lies are disjoint. wi+l. vzi Q2i_l. until vertices and v2i+1 in vzi appropriate it Qn-l of V. so. If the tour fOllOwS: qi = i = edge tour lies must wi–lwit.j [n/2j ellipse q which wi_ 1 and coincide then Wi of tangency = with foci to and If q does with the endpoint of q. But the radii of the tangent intersect V1 as Vz~+l of tour in the triangle identically Thus, triangle for equal it a point on ei and Avivi+l to is possible vi+z, vi+l or a whether the for the first but it on the polygon does not starts to unwrap Proof. the image Vn+l. Thus, be ion = Thus, the in a chain we have The optimum and ends at a point Every qLn/2J it qLr@J qn+l q. L? if n is of Q, except R +1 which which 2), We focus given. on Vovl from The (see fig. keeper’s the corresponding path directed of triangles: is or not. been 2.3. on qLn/ZJ 9Ln/ZJ+l of Q. on as vz(~-i+l) of edges be non-simple whether path from the identified qi pair and second have two such sides each. Q may matter triangular to its ima9e ey triangle its these 1). are perform Avn _ 1Vovl 9Lfl/2j91n/2j+l) which and Vzi+l of can of and with Label O... [n/2]; composed reflect translate and Finally, and to the (resP. and last LE~NIA two i = position aligned has one side on the boundary the shortest between Vn order + 1 (see fig. and qLn/2J+l~Ln/2J even(resp. odd). which [8]. Q. VI until translate Vzi Q2i. at Q2i, Qzi+l, of form clockwise + l...n triangulated minimizes Wi+l. build VOW in P corresponds every L represent To transformation to current build Vzi are Vzi+z instances for v2i_ 1 and reflect Q1 AvzvavA vzi - 1V2i and in Q in the the to Avz; vz;+l with to rotate general, edge vertices of Let a unique from w~ will a point until vertices then In around this optimum angle it Qz. inst antes, interior, Wi of the rotate attach consists with 1vzivzi+l aligned of reflection. to L at a point distances segment both in its angle Then ej. angles point Thus Av2i_ V3 are aligned Q2, it Q AVOV1V2 build attach and V3 in structure triangle To P. V1V2 and Q3, translate Q is a polygon to q. If q ~ ej, an ellipse The polygon the sides. wj+2, necessarily the it follows a contradiction. wi– 1 and wi _ 1 and Wi is tangent ej closer wj+l, the exceeds of opposite tour edge ej, containing sum sides, than in polygonal represent in edge V2 and V2 and Q1 position around vertices of a new Let V2. To build W~W~+l. Fix the two m’any not and that less diagonals Wi+l, a point of is In but If side VI. equals 2.2. the fact one candidate of the of incidence one providing vI, v3, v5, . . .. Vn_I. will from the ..., Wi+2, Wi Wi+l and Wi wj Wi+I wj+l and pairs tour, does not visit edges Then other of of both Wj-~, If n is even, tour that of lengths a shorter vertices points thus tour for i < j. length lengths sum describes equal the optimum producing of n + 2 vertices. inpo!ygon. quadrilateral sum angle that cross each other, define line polygon convex, sides AV1V2V3 the convex Q. so k ~ n. LEMMA in A unfolding tour point passes a point passes in corresponds on P to on qn+lqo through ev- qn+l q. through to every THE AQUARIUM KEEPER’S 461 PROBLEM ~3 ‘ .< q~ q~ % Figure ---------- 3: from In q. and unfolded q~+l and the induced P’ and Figure 2: A obtained vertices can polygon P’ will non-simple from the triangulated triangle be placed whose P. in the polygon Any odd marked associated Q polygon qn+l S( Q(q~+l, ward Q’ to be non-simple. of P. Divide R crosses. Reflect portion of the to Av2i_ path 1v2iv2i+1 the (corresponding tour the a path tour R in + the some Q of exactly to of these – t)9in/2J+l) tour t, the and the in P. right- finishing same + length between correspond (resp. tours and to the polygon 2.1. The optimum P of n vertices keeper’s point compute cici+l Vn Vn+l, the anchors of the a in O(n) the in first minimizes to tdi Q, Proof. scribed the Create above shortest in the linear path triangulated time. inside polygon In linear Q from Q time qo to as de[7], qln/zJ if C’i and Di and from qn+l) or let the first (see fig. on the by cor- 9Ln/zj +1, 3). left- and Melissaratos minimum and length perimeter segments. entirely the Di areatriangle Ci to Di or find distance square time, orientation, joins value each of In t that tci+(1 –t)c~+l from distance can be t which can to note then two we can visible. It is interesting either right- from partially of on and visible the segment didi+l left- of this function time. have opposite the = In constant is to The each Di are entirely invisible, goal from image examining in constant segment (resp. z on the equal path its as a quadratic cre- On !lLn/zj used shortest by + (1 – i!)di+l. minimized Di area the straight-line represented a point the VOV1 to Ci and case, to polygon. the two path left-anchor(C’~) analysis to that begin whether z on a single shortest for S(Q(z, of case minimum of we decide time. ate To Given path the = C’i (resp. in a simple in- the exception of the straight point to the first vertex on in computing or inscribed qo) similar [10] points same right-anchor(.lli) a type as the so as to subdivide All segment (resp. as well chains the and [7], it is also possible chains Similarly, oriented right-anchors in time is denoted )). on S(Q(Z, (resp. tour can be computed are in- In linear vertex we use other THEOREM That Below R. convex )) of qoqn+ 1 share vertex separator paths, qi~lzj paths of the lie to shortest versa qo qn+l These tangents The at a point odd). segments S(Q(qo, of these /eft-am%or(Di) Souvaine from paths vice denoted edges anchor(Ci every (1 – ‘)qLn/2J shortest respectively. and qin/zJ qinlzj+l. Ci responding has exactly process, chains. qoqn+l the path. the t < 1 corresponds O s if n is even T must at its endpoints ezi+l pieces reversing tqLn/2J+l 1 – 1 correspondence optimum until T in P starting for lie of the line 9in/ZJ (resP. qi@~ +1) with segment from the particular the e2~ in P. Translate . . wlthm Aq~-i+l q~qn-i on e2i and By rotate (corresponding endpoints R union as R. it +1)), the segment and of points (1 – t)qO tqLm/zJ +(1 its tour triangles and Aqiqn-iqi+l on e2i-1 by the all translate that portion length two + (1 – t)vl tqn+l so keeper’s of to Av2ivz~+lv2i+z) T formed candidate then within ) corresponding same boundaries and points rotate at the the first, corresponding and at to a candidate 9Ln/2J+l, common edges of Q corresponds to qi@j convex extend ner triangle subdivisions the qin/2J +1 and qLrz/2J qLra/2J+l. from of to createa triangulated Q, and is number region polygon to qin/z] be that the shortest endpoints or is CZYZOWICZ 462 perpendicular lines to the bisector cent aining Ci In the second c E G’i to least one of starting points, rotate aligned C;. with at an endpoint constant adopted in this thus and D~ is sides new of figure of segments easily shorter and (wj, Z). the sum of the obtaining in in case, first the second left- constraint chosen on the other by either case, andjor use the same of the perform same possibly that both and Keep left-anchors that the using for as in the first segment procedure twice, right-anchors procedure side. the C csse with lie on one side both right-anchors optimum path lies determined technique. There are at most a linear Di), an optimum (Ci, constant corresponds number path time, and the to the optimum can of be found shortest of all for these Proof. each Let Optimum Keeper’s Tour in a tains Non-Convex Given a simple, Vo, vi,... but , Vn-l given the edge oriented vi. non-convex, Certainly, in clockwise in clockwise all reflex identified in linear time. rj among the all O ~ j original < h -1. of points, wo, closed point Wi may on two P The of the more the polygon. cross Proof. there that such a vertex is an optimum the that reflex to order two edges length of the edges Since thus all a lie Since may be edges of path at a single subset points in its keeper’s tour than We thus follows from a to b keeps demonstrated tour Let wj of v, and immediately orientation. 3.1 that the Q. wj of Q to P that the path Since It part a, . . .. b in any tour that leaves of Thus Wi, . . . . Wj the path rz) that to denote passes from reflex intermediary denoted right of Q to its right. in we radial between to the the rz, two adj scent the then line seg- Q, we have a reflex vertex be suboptimal. We use Q(rl, keeper’s case, than that must 1, the in P, con- a and by replacing wi, . . ..a. b, . . . . wj path ab is shorter unvisited before interior tour Assume, a suitable of contact of lemma the the lying Q in a clockwise the corollary we can shorten the points traversing v. segment the and once. optimum of intersection immediately b when line P by left visits v unvisited. through is not the an v and points tour vertex b, respectively. the be di- P at least exists the If this a and can and the interior keeper’s passing to of a equiva- and an open tour aquarium that exist tour two traversal. it so by rotating there into interior a reflex line denote the part rl of the optimum to (the vertices edges as l(P(rl, LEMMA first occurrence of a simple aquarium. of P between rl and r2 be r2)). keeper’s contradiction constrained Q of a simple Proof that aquar- I(P(rl, 3.3. Q(rl, every and S(P(rl, of z) z). keeper’s there leaves interior. are encountered touches of an optimum sake is (wi, the shortest P. cross. the (wj+l, of the of L containing make respectively Let is shorter and Wi+l wj)) edges x) optimum of generality, we label ment within from Wj+l)) lies to the lefi that Q that 1 immediately of) edges Suppose Thus, by bounded of a simple Q and after of the plane and Every angle. Q from one of the interiors b)) to denote for a sequence vertex two of rj, k < n. touch P and lies inside for = of a polygonal in their polygon two can be Vj of P and in aquarium Assume that at lies to be optimum, The of a clockwise v in its which index wo is a minimum. a single No Vij at least once a to b that originates the i.e. then a simple of a simple represent is possible intersect 3.1. which of P, a and b, we use S(P(a, from LEMMA tour than it vertices let ei represents is to determine ei and with P with ?’0, rq, . . . . ?%- 1 ij such _ 1 edges, edges Given interior path Let We say that if the point. vertices goal coincide distinct is non-convex, visited order Wo, WI, . . . . wn_~, path order, vertices . . . . wn WI, Wi lies on each polygon and S(P(Wi, optimal the vertex loss can easily Aquarium Every L be a horizontal connected 3 Q’ is a keeper’s Therefore, partitions the exterior tour without tour. that edges tour and w3+l)) Wi is visible we assumed 3.1. 3.2. reflex keeper’s paths that of (wi+l, a closed LEMMA segment Observe S(P(Wi+I, exterior, so that every keeper’s of the lengths lengths to the right lie wj+l) crossing wj )) is convex wj+l. a tour classes, rected the z), because Similarly unbounded the from Q’. sum aquarium lence D. (wj, the a contradiction. simple the and wj+l) from shortened and S(P(toi, Wj)) and S’(P(Wi+l, wj, the Wi+l) Eliminate S(P(zo~, A(wi, than (wi, ~. tour path Wj is visible have joined can be computed edges point a new The the triangle translate are on opposite or a pair tour. To determine and then C to D to obtain to is independent d). the the (wi, wi+l) and (wj, replace them with at closest with at COROLLARY added in D a point through Di and D until by D from segment third appropriate pairs C and from vertex to on c (resp. of c, and P time. In the Then C if necessary, path a straight path Q passes be the defined and shortest is either (D) point triangle Ci shortest from reflect, the The C path (ending) two and Let The ium by the Di. d G D~ inside vertex. d). formed cross case, every a point c (resp. these and of the angle ET AL. r2) to edge lie r2) of in of I(P(rl, a region a simple r2)) in bounded aquarium order, P, and by I(P(rl, is r2)) rz)). Assume are not that visited one by or Q(rl, more r2). edges Let of e denote THE AQUARIUM KEEPER’S 463 PROBLEM a) Figure 4: a) A simple structure Ql one such of Q(rl, edge. rz) Let and succeeding traversed there is at edge rl then Thus rl sees rz, that Q(rl, every rz) other hand rl path Q(rl, P, must lie the intermediary the path even between replaced path may The we can compute Q the assume rz)) visit of times. even in order step, then, the shortest of the by must r2)) rz) reflex vertices rl and rz. b) The thus ackle path tree and the from be in Tz)). naively reflex The of the reflex joining and can be non-simple to the polygon geodesic of P but right adjacent be computed as each vertices region of the time the algorithm follows if the is dominated be triangulated The global Aquarium tour the shortest rj+l that of of finite oriented edges path joining because S consists in rj of [17] by problem of reduces and [17]. In of The can one a set S of y of anywhere in vertices of of simplifies considerably P. fixed the vertex of the rj+ 1 without rj new optimum of finding to boundary crossing P Since Chazelle’s computing an opt imalit lie with reflex [17], to h subproblems edge convezof is presented hull a set time follows. every set triangulating result from relative- the algorithm convex in O(n) now touches space P. only [1], the P polygon algorithm and algorithm S the of to relative s simple can chain O(n) in then huil) respect and However, R is in fact convex with computing points mUSt boundaries every paths be repeated, by R lies case. R consisting shortest may worst it. log n) the rz) edge the problem n P, the entire and R may (also O(n rz)) can S(P(TI, time. vertices P. Q(rl, -v of l’, is to compute Tot of the in the in P has size U(n) defined hull for and S(P(rl, making ~2) that Q(rl, m) crosses visit boundary by Q(r,, the rz)) crossings The polygon boundary Proof. to lie within parts 3.4. and O (n2) rz), On We claim time vertices O(n) the take of P bounding As shown cross must in to rz visiting S(P(rl, If The (rl, reflex area rz)). in order. see r2. e Q, shortest edge polygon. rz)). on the bounded visit rl could LEMMA T’2) must is the from numbered of S(P(rl, Q(rl, by consecutive vertices of Q(rl, that edges it and interior it is constrained and Thus defined vertex of contact edge of I(P(rl, path then for all of the subproblems. and Since e in I(P(rl, r2)) P1 preceding part bounded edges odd points of the necessarily since region traversal. every S(P(rl, a region by parts first of not number rz)) b. must r2), in lie in the region the edge in a convex path shorter. I(p(rl, a to point rz visits is, S(P(rl, the left is the shortest 2, this the an and intermediary in sect. b denote e in a clockwise one between shaded T2) immediately from least a contradiction. If a and with P1. all of e lies to the when path from l(P(T1, the Thus aquarium obtained another convex a second 464 CZYZOWICZ convex chain us say that (where Pj we P~ described only Av/vi+l may rri+z, but need a greater on the chain. As all polygon Pj polygonal linear For composed structure THEOREM simple of two Q? can in the size Vi+l [10] to ~ )) visible Qj (see fig. can 4). h subproblerns convex be formed on chains, in time The optimum keeper’s in a a in O(n) time. of sect. vertex If P should 2 apply. which problem image of lie reflex vertex can be done sum of the be computed rj linear of all to in d(n) Qj one tour. path the equal Q~. in the the procedures at least shortest structure in time sizes the (possibly polygonal the shortest vertex ~j+l then P has on the to finding each triangulated can Otherwise, must reduces succeeding be convex, size reflex Thus the from the image of to ~j !) in For each j, of Q~. is O(n). Thus, a Simple Polygon the the this But the the tour time. References [1] B. Chazelle, Time.” May [2] W. “Triangulating Tech. Report CS-TR-264-90, in Linear Princeton Univ., 1990. Chin, S. Ntafos, “Optimum Zoo-Keeper Routes.” Congresses Numerantium, 1989. S. Ntafos, “Optimum Watchman Routes.” [3] W. Chin, Prac. of the ACM Syrnp. on Comput. Geometry, Yorktown [4] ford [5] Heights, R. Courant, Univ. J. Focke, Problem 1986, 24-33. H. Robbins, Press, “A Finite of In polygons Optimization, [6] A. Fournier, What is Mathematics?, Ox- 1941, 346-352. Descent with Method Minimal for STEINER’s Circumference.” 17 (1986), pp. 355-366. D. Y. Montuno, “Triangulating Polygons and Equivalent Problems,” tions on Gravhics 3 (1984). 153-74. ACM Simple Z’ransac- J. Steiner.” Optimization, 16 Problems of the A CM Symp. “On Using Solving Shortest on Comput. Geo- Paths.” Geometry, Berke- H. Rademacher [13] Schwarz, lungen. 2.Bd., [14] J. Steiner, [15] R. and Gesammelte Berlin Maxima und angewande Inst. ‘An Optimal [17] —, Relative Werke. Convex Processing of EURASIP-86, Abhand- 2. Bd. Berlin und Univ., III: Thwries 2, The for Sets, Bel- Computing the in a Polygon.” and Applications, Hague, reine Feb. 1990. of a Set of Points Part Steiners fir 36-77. on Illumh.sting Algorithm 1882, 45. zu Journal 96 (1884), of McGill Hull Zusi.tze und Minima.” Workshop Research of 1957. Mathematische Mathematik, G. T. Toussaint, Enjoyment Press, 1890, 344-345. “Bemerkungen Au fsiizen iiber The University Gesammelte Sturm, lairs O. Toeplitz, Princeton H. A. Signal Proofi “Zur analytischen und aleines geometrischen Opti- [12] space tour can be computed and Optimal 1985, p. 60. I. Niven, Maxima and Minima Without Calculus, The Mathematical Association of America, 1981, p. 163. [16] P of n vertices Inc., [11] the and Mathematics D. L. Souvaine, Optimization Mathematics, from and Simple 209-233. ley, 1990, 350-359. convex polygon E. A. Melissaratos, Prac. focus Triangulated Books, H. Rudolph, Behandlung von M. Sharir, R. Visibility and pp. 833-848. metric ~f~- 1)~~~ n to are the nested (1985), of Pj. 3.1. polygon polygons of the need individual of creating each to American mierungsproblems we may ~, v(i+I)~Od from each in this process a point Inside 2 (1987), A. Tromba, Scientific [9] R. Klotzler, gorithmischen by ei_ 1, ei and lj~~d path along triangulate 3.5. we Form, triangle vi-1 Problems Algorithmic, [8] S. Hildebrandt, polygonal the from fact, S(P(v(i_ vertices vi in Path Polygons.” of and translate between determined from in the LEMMA In i each of the polygon, shortest every P~ procedure the lies diagonal interior chain the for Wi, diagonals be added of tour the same reflect still ei+l solve create segment polygons represents V(i+ ~)mOd ~ To restriction. convex the on since starshaped inward which 2. lie in the a polygon can we no longer The [7] L. Guibas, J. Hershberger, D. Leven, Tarjan, “Linear Time Algorithms for Let vertices. Shortest we essentially section a point no longer two define polygon). convex, using triangles. same chains a spiml nearly in and the convex Q1, however, ei the is subproblems structure on joins two is in fact Since these which these ET AL. September Proc. 1986.