Online Firefighting on Grids
aa r X i v : . [ c s . D M ] J u l Online Firefighting on Grids ⋆ Marc Demange , David Ellison , and Raffaella Gentilini ⋆⋆ RMIT University, School of Science, Melbourne, Australia Dip. di Matematica e Informatica, Universit`a di Perugia, Via Vanvitelli 1, Perugia (IT) . { marc.demange | david.ellison } @rmit.edu.au, { raffaella.gentilini } @dmi.unipg.it Abstract.
The Firefighter Problem (FP) is a graph problem originally in-troduced in 1995 to model the spread of a fire in a graph, which has at-tracted considerable attention in the literature. The goal is to devise astrategy to employ a given sequence of firefighters on strategic points inthe graph in order to contain efficiently the fire (which spreads from eachunprotected vertex to all of it neighbours on successive time steps).Recently, an online version of FP— where the number of firefighters avail-able at each turn are revealed in real-time — has been introduced in [3,4]and studied on trees. In this paper, we extend the work in [3,4] by con-sidering the online containment of fire on square grids. In particular, weprovide a set of sufficient conditions that allow to solve the online versionof the firefighting problem on infinite square grids, illustrating the corre-sponding fire containment strategies.
The Firefighter Problem (FP, from now on) is a combinatorial problem intro-duced by Bert Hartnell in 1995 [9], providing a deterministic, discrete-timemodel of the spread of a fire on the vertices of a graph. Suppose that a firebreaks out at time at a vertex v of a graph G . At each subsequent time t , f t firefighters protect a corresponding number of f t vertices in G , and then the firespreads from each burning vertex to all of its undefended neighbours. Once avertex is burning or defended, it remains so from then onwards. The processterminates when the fire can no longer spread. In the case of finite graphs, theaim is to save as many vertices as possible, while in the infinite case, the aim isthat of simply containing the fire.Since its introduction in [9], FP has been studied intensively in the liter-ature [1,2,6,7,8]. In particular FP has been shown NP-complete for bipartitegraphs [9]. Finbow et al. have strengthened this result [6], proving that FP isNP-complete even if restricted to trees with maximum degree three. In contrast,it is solvable in polynomial time for graphs of maximum degree three, if the firestarts at a vertex of degree two. A polynomial time approximation scheme for FPon trees has been recently provided in [1]. Beside trees, FP has been extensively ⋆ The support of GEO-SAFE, H2020-MSCA-RISE-2015 project ⋆⋆ Corresponding author tudied on the families of graphs of grids [5,11,10,12,13]. Wang and Moeller[13] proved that one firefighter per turn cannot control a fire sourcing from avertex v ∈ L = Z × Z , while two firefighters per turn are sufficient to solveFP on L within 8 turns and 18 burnt vertices. Ng and Raff [12] proved thatany periodic function ( f t ) t ≥ whose average exceeds allows the firefighters tocontrol any finite-source fire in L . The interested reader can refer to [7,5,8] fora survey of recent results on the complexity analysis of FP and its variants.Recently, Coupechoux et al. [3,4] have considered an online version of FP,where the number of firefighters available at each turn are revealed in real-time .In [3,4], the structure of the underlying graph in the online FP is a tree, andsuitable competitivity results are provided. In this work, we consider the onlineversion of FP on the infinite Cartesian grid L = Z × Z . The classic offline version of the firefighter problem can be understood as adeterministic one-player game, where Player knows in advance the sequence ( f i ) i ≥ of firefighters available overall the game. In contrast, within the onlineversion of the firefighter problem, an adversary called Player reveals to Player —turn by turn—how many firefighters are ready to be used in the current turnof the game. Therefore, the online firefighter problem can be understood as atwo player game. More precisely, an instance of the online firefighter problemis given by the tuple ( A , ( f i ) i ≥ ) , where both players are aware of the arena ofthe game, A = h G, v i , which is composed by the graph G - the Cartesian grid L = Z × Z in this paper- and the ignition vertex v ∈ L . Instead, only Player knows the firefighters sequence ( f i ) i ≥ . At each turn i of the game, Player reveals f i to Player . Then, Player chooses m ≤ f i vertices (neither protectednor burned), where to place a new firefighter. Finally, the fire spreads on eachunprotected neighbour of a vertex on fire, leading to the next turn of the game.Player wins if at each turn a new vertex is burning, otherwise Player wins.We provide a constraint applying to the sequence of firefighters ( f i ) i ≥ (cf.Condition (1)) that can be shown to be a sufficient condition for Player to winthe offline version of the firefighter problem, while there is an instance of theonline firefighter problem that fulfills Condition (1) where Player looses. ∃ N ≥ N X i =1 f i ≥ N (1)Intuitively, Condition (1) guarantees the existence of a turn of the game forwhich the global number of firefighters deployed (from the beginning of thegame up to the current turn) have been times the number of turns played sofar. Hence, an offline strategy for Player can rely on the knowledge of ( f i ) i ≥ to surround the fire at the right distance. However, in the online version of thegame, Player does not have any information about the turn of the game fulfill-ing Condition (1). This is formalized by Theorem 1, below.2 heorem 1. Condition (1) is sufficient (resp. not sufficient) for Player to winthe offline (resp. online) version of the firefighter problem. Moreover, turns areenough to make any online strategy for Player to fail.Proof. Wlog, suppose that the ignition vertex is (0 , and let N be the smallestindex such that P Ni =1 f i ≥ N . An offline winning strategy for Player is thefollowing: build a diamond-shape encirclement at distance N from the ignitionvertex, by placing each firefighter eventually available on a grid point ( x, y ) satisfying | x | + | y | = N . There are exactly N grid vertices ( x, y ) such that | x | + | y | = N . Hence, Condition (1) guarantees that at turn N the fire getscompletely encircled.Being unaware of N , Player cannot apply the above strategy in an onlineset-up. We show that the adversary has a winning strategy ( f i ) i ≥ , where ( f i ) i ≥ satisfies Condition (1). Given j > , denote by ( f ji ) i ≥ the firefighter sequencewhere f = 1 , f j = 4 j − and f p = 0 for p / ∈ { , j } . Let v ∈ D ℓ , for some positiveinteger ℓ , be the first node protected by Player , where D ℓ is the set of verticesin the grid Z × Z at distance ℓ from the ignition vertex. A winning strategy for theadversary is the following. If ℓ ≤ (i.e. v is at distance or from the ignitionvertex), then the adversary provides the firefighter sequence ( f i ) i ≥ . Hence, atthe end of turn , firefighters are needed to surround the fire, while f = 19 .Otherwise, if ℓ > (i.e. v is at distance greater than from the ignition vertex),the adversary provides the sequence of firefighters ( f i ) i ≥ . Hence, at the end ofturn , there will be an unprotected node u ∈ D next to the fire at distance from the ignition vertex. So, in both cases, the firefighter sequence is of the form ( f ji ) i ≥ for some j and the fire is not encircled after turn j . Since no firefighterwill be available for the rest of the game, the fire will escape. In the previous section, we have considered sequences of firefighters ( f i ) i ≥ sat-isfying Condition (1), showing that such a condition is sufficient for Player towin offline, while there are instances of the online firefighter problem fulfillingCondition(1) where Player loses. The purpose of this section is that of pro-viding sufficient conditions toward the online containment of fires on grids. Ourfirst result (cf. Subsection 3.1 below) shows that if ( f i ) i ≥ fulfils Condition (1)and at least one firefighter is eventually always available, then Player has astrategy to win online. The following Subsection 3.2 considers the problem ofweakening Condition (1) in order to define further sufficient conditions for theonline containment of fires on grids. Suppose that the sequence of firefighters revealed by Player is such that even-tually at least one firefighter will be available on each turn of the game. Then,we show that Condition (1) becomes sufficient for Player to win online. Intu-itively, this is because the firefighter(s) available at each turn can be employed3 ext to the fire to build incrementally a tight encirclement of it, waiting for laterreinforcement. This way, no firefighter is wasted during subsequent turns of thegame, while Condition (1) guarantees that eventually, there will be enough fire-fighters to close the encirclement surrounding the fire.More precisely, consider the simpler scenario where Player receives exactly one firefighter at each turn , , . . . , µ − and m firefighters at turn µ , where m ≥ µ − ( µ − . For instance, Figure 1 considers the case where µ = 4 , f = f = f = 1 and f = 13 and illustrates an online winning strategy forPlayer . Such a strategy works as follows: Player uses the available firefighterat each turn to build two diagonal walls (cf. the positioning of the only firefighterreceived for the first three turns). This way, at the beginning of each turn ≤ i ≤ µ , the fire is always contained within a perimeter of size i , and each firefighterpreviously employed at some turn j < i has been placed on such a perimeter.Therefore, the encirclement of the fire can be completed as soon as Condition(1) is fulfilled (at turn , for the instance illustrated in Figure 1).
11 11 22222 2 2 2 333333 3 3 3 3 4444444 4 4 4 4 4 4
Ignition pointi Node burned at time i i Node protected at time i Fig. 1.
Online strategy to encircle the fire with (exactly) one firefighter available at eachturn of the game , . . . , N − , until Condition (1) gets fulfilled at turn N . The general case, where Player eventually receives at least one firefighteron each turn until Condition (1) is accomplished, is slightly more in involved.Roughly, it is solved as follows. As far as Player receives f j > firefighters ateach turn j (while Condition (1) still needs to be accomplished) he will placethe guaranteed available firefighter on a diagonal wall in front of the advance ofthe fire, while the extra firefighters (out from the guaranteed one) will be em-ployed to encircle the fire, waiting for later reinforcement. As soon as Condition(1) is satisfied, the encirclement will be completed. Example 1 below gives moredetails on the above sketched winning online strategy for Player . This leads tothe results in Theorem 2, below. 4 heorem 2. Let the sequence of firefighters ( f i ) i ≥ revealed by Player be consis-tent with Condition (1) and suppose that there exists an index M such that f i ≥ if i ≥ M , and f i = 0 otherwise. Then, Player has an online strategy to win thefirefighter problem on grids.Proof. Let N be the smallest index such that P Ni =1 f i ≥ N and assume wlogthat the ignition vertex is v = (0 , .By hypothesis, the fire spreads uncontrolled for M − turns. Hence, when thefirst firefighter(s) appear at turn M the fire has a diamond shape, burning eachgrid vertex ( x, y ) within the polygon enclosed by the lines y = mx + k, | m | =1 , | k | = M , i.e. each grid vertex satisfying | x | + | y | < M . Therefore, if M = N ,then Player can tightly encircle the fire by assigning a firefighter to each grid-vertex ( x, y ) such that | x | + | y | = N (there are N such vertices).Otherwise ( M < N ) , we first consider a simpler scenario where Player receives exactly one firefighter from turn M till turn N − , providing an onlinestrategy to contain the fire. We will then generalize such a winning strategy forPlayer to deal with the general case where f i ≥ for M ≤ i ≤ N − . Havingone firefighter available at each turn M ≤ i ≤ N − , Player can progressivelybuild two diagonal walls next to the fire: the first (resp. second) wall from ( M, along the semi-line y = x − M, x ≥ M (resp. y = − x + M, x ≥ M ). Precisely,at each turn i = M + j , for ≤ j < N − M , Player protects the vertex ( M + ⌈ j ⌉ , ( − j ⌊ j ⌋ ) , alternating the building of such walls (cf. Figure 1).Therefore, at the end of each turn M ≤ i < N the fire burns each grid vertexinternal to the the polygon defined by the following inequalities (cf. Figure 1): y ≤ x + iy ≥ − x − iy ≥ x − iy ≤ − x + iy ≥ x − My ≤ − x + M (2)The number of grid vertices on the perimeter of such a polygon is exactly i .Moreover, we have placed all the firefighters globally received (from turn M tillturn i ) on such a perimeter, along the diagonal walls defined by y = x − M, y = − x + M . Hence, at turn N we can completely surround the fire (cf. Figure 1).We now turn on considering the general case where we receives at leastone firefighter from turn M to turn N > M (rather than having f i = 1 for M ≤ i < N ). Note that, having f i = 1 for M ≤ i < N allowed us to placeeach new arriving firefighter on the perimeter of the polygon induced by the setof inequalities in 2 along the facets y = x − M, y = − x + M . Moreover, suchfacets are built incrementally so that at the end of each turn i the firefighterson the field are next to the fire. This ensures that such firefighters will be usefulto contain the fire for the rest of the game. To maintain such a property inthe general case (namely, f i ≥ for M ≤ i < N ) we proceed as follows. As5 Ignition pointi Node burned at time i i Node protected at time i Fig. 2.
Winning the fire online with at least one firefighter eventually always availableuntil Condition (1) is satisfied. far as we get firefighter we keep on building the two diagonal walls along y = x − M, y = − x + M . As soon as we receive strictly more than one firefighter,say at turn P ≥ M , we use the extra f P − firefighters to surround the fire. Moreprecisely, we stop building one of the two walls, say the one along y = y − M , andstart enqueuing the f P − extra firefighters along the perimeter of the burningpolygon (starting e.g. from the facet defined by y = − x + P ). At turn P +1 we willstart building a new diagonal wall from the last enqueued firefighter, so that wealways have two diagonal walls on construction (orthogonal to two advancingfronts of fire). We keep proceeding as above, i.e. building two diagonal wallsblocking the fire as far as we get one firefighter, and using the extra firefightersto surround the fire as soon as we get strictly more than one firefighter (cf. Figure2). This way, at each turn i = M . . . N − , the fire is contained within a polygonwhose perimeter has at most i grid vertices, and each firefighter used so far inthe game is protecting such a perimeter. Therefore, by hypothesis the firefightersavailable at turn N will be enough to close the tight partial encirclement of thefire built at previous turns. Example 1.
Let the sequence of firefighters ( f i ) i ≥ received by Player be suchthat f = f = 1 , f = 4 , f = f = f = 1 , and f = 15 . Therefore, Player receives one or more firefighters for the first six turns and a number of firefightersleading to the fulfillment of Condition (1) on the seventh turn, i.e. P i =1 f i ≥ .As illustrated in Figure 2, to win online, Player proceeds as follows. As faras he receives exactly one firefighter per turn, he employs them to build twodiagonal walls (cf. the positioning of the first two firefighters) against the frontof the fire. In our example, this happens for the first two turns. At the third turn6layer receives firefighters, i.e. a number of firefighter that is strictly greaterthan one but not enough to let Condition (1) being satisfied. Then, Player 1uses one firefighter on the diagonal walls and the extra three firefighters to startsurrounding the fire (cfr the positioning of the firefighters received at turn inFigure 2). At the next turn-i.e. at turn in our - Player will start building anew diagonal wall from the last enqueued firefighter, so that he always havetwo diagonal walls under construction, orthogonal to two advancing fronts offire. Such diagonal walls will be alternatively enlarged (at turn and in ourexample), until Player will be able to completely surround the fire (at turn in our example), when the available firefighters will allow to have Condition (1)satisfied. Consider the following natural generalisation of Condition (1): ∃ N ≥ N X i =1 f i ≥ ℓ · N (3)We study for which ℓ ∈ N Condition (3) guarantees to extinguish the fire online.In the offline case, ℓ = 4 is sufficient to contain the fire as stated in Theo-rem 1. As already noted, such a strategy does not work online, since Player isnot aware of how many firefighters will be available at each turn of the game.Therefore, the attempt of building a diamond-shaped encirclement at distance N could result into a waste of all the firefighters placed on such an encirclement,as soon as the latter gets broken by the spreading fire.However, one can notice that in this case a maximum number of N fire-fighters are lost. Based on this observation, it is possible to come up with anonline strategy for Player that allows him to contain the fire under Condition(3) for ℓ = 16 . Such a strategy proceeds as follows: as soon as the encirclementunder construction gets broken at turn t of the game, Player starts to build anew diamond-shaped encirclement at distance t from the ignition point. Let M be the turn of the game at which Condition (3) is satisfied for ℓ = 16 , i.e. as-sume that a global number of M firefighters gets available overall the first M turns. We show that at turn M , we are guaranteed to have enough firefightersto complete an encirclement at distance M . In fact, ∗ M = 8 M firefightersare needed for such an encirclement, while the number of firefighters lost inprevious turns is bounded by M ∗ P ∞ i =1 12 i = 8 M .Therefore, we obtain: Theorem 3.
Let the sequence of firefighters ( f i ) i ≥ revealed by Player to Player be such that: ∃ N ≥ N X i =1 f i ≥ · N Then, Player has an online strategy to win the firefighter problem on grids. eferences
1. David Adjiashvili, Andrea Baggio and Rico Zenklusen.
Firefighting on Trees BeyondIntegrality Gaps . Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium onDiscrete Algorithms (SODA2017), pp. 2364-2383, 2017.2. Elliot Anshelevich, Deeparnab Chakrabarty, Ameya Hate and Chaitanya Swamy.
Ap-proximability of the Firefighter Problem . Algorithmica 62 (1): 520-536, 2012.3. Pierre Coupechoux, Marc Demange, David Ellison, and Bertrand Jouve.
On-line firefighting on trees . International Symposium on Combinatorial Optimization(ISCO2018), 2018.4. Pierre Coupechoux, Marc Demange, David Ellison, Bertrand Jouve.
Firefighting ontrees . Theoretical Computer Science. In press - available online, 2019.5. Fedor V. Fomin, Pinar Heggernes, and Erik Jan van Leeuwen.
The Firefighter Problemon Graph Classes . Theoretical Computer Science, 613: 38-50, 2016.6. Stephen Finbow, Andrew King, Gary Macgillivray, and Romeo Rizzi.
The FirefighterProblem for Graphs of Maximum Degree Three . Discrete Mathematics, 307: 2094-2105,2007.7. Stephen Finbow and Gary MacGillivray.
The Firefighter Problem: a survey of results,directions and questions . Australasian Journal of Combinatorics, 43: 57-78, 2009.8. Carlos Garcia-Martinez, Christian Blum, Francisco J. Rodriguez, and Manuel Lozano.
The Firefighter Problem . Computers & Operations Research 20: 55-66, 2015.9. Bert L. Hartnell.
Firefighter! An application of domination. . Proc. of 25th ManitobaConference on Combinatorial Mathematics and Computing, 1995.10. Margaret-Ellen Messinger.
Average firefighting on infinite grids . Australasian Journalof Combinatorics, 41: 15-28, 2008.11. Margaret-Ellen Messinger.
Firefighting on the triangular grid . Journal of Combinato-rial Mathematics and Combinatorial Computing, 63: 37-45,2007.12. K.L. Ng and Paul Raff.
A generalization of the firefighter problem on Z × Z . DiscreteApplied Mathematics, 156 (5): 730-745,2008.13. Ping Wang and Stephanie A. Moeller. Fire Control on Graphs . Journal of Combinato-rial Mathematics and Combinatorial Computing, 41: 19-34, 2002.. Journal of Combinato-rial Mathematics and Combinatorial Computing, 41: 19-34, 2002.