Elsevier

Theoretical Computer Science

Volume 909, 28 March 2022, Pages 54-67
Theoretical Computer Science

Cutting bamboo down to size

https://doi.org/10.1016/j.tcs.2022.01.027Get rights and content

Highlights

  • We prove the first constant upper bound on the makespan attained by Reduce-Max by showing that it is at most 9.

  • We improve the best known upper bound on the makespan of Reduce-Fastest(x) to 3+52<2.62 (for x=1+15).

  • We show that Reduce-Fastest(2) (the former best choice for x), achieves a makespan of 196 (improved from 4).

  • We design compact data structures (Trimming Oracles) that are able to quickly report the next bamboo to cut.

  • Our Trimming Oracles implement Reduce-Max, Reduce-Fastest(x), and a novel trimming strategy achieving a makespan of 2.

Abstract

This paper studies the problem of programming a robotic panda gardener to keep a bamboo garden from obstructing the view of the lake by your house.

The garden consists of n bamboo stalks with known daily growth rates and the gardener can cut at most one bamboo per day. As a computer scientist, you found out that this problem has already been formalized in [Gąsieniec et al., SOFSEM'17] as the Bamboo Garden Trimming (BGT) problem, where the goal is that of computing a perpetual schedule (i.e., the sequence of bamboos to cut) for the robotic gardener to follow in order to minimize the makespan, i.e., the maximum height ever reached by a bamboo.

Two natural strategies are Reduce-Max and Reduce-Fastest(x). Reduce-Max trims the tallest bamboo of the day, while Reduce-Fastest(x) trims the fastest growing bamboo among the ones that are taller than x. It is known that Reduce-Max and Reduce-Fastest(x) achieve a makespan of O(logn) and 4 for the best choice of x=2, respectively. We prove the first constant upper bound of 9 for Reduce-Max and improve the one for Reduce-Fastest(x) to 3+52<2.62 for x=1+15.

Another critical aspect stems from the fact that your robotic gardener has a limited amount of processing power and memory. It is then important for the algorithm to be able to quickly determine the next bamboo to cut while requiring at most linear space. We formalize this aspect as the problem of designing a Trimming Oracle data structure, and we provide three efficient Trimming Oracles implementing different perpetual schedules, including those produced by Reduce-Max and Reduce-Fastest(x).

Introduction

You just bought a house by a lake. A bamboo garden grows outside the house and obstructs the beautiful view of the lake. To solve the problem, you also bought a robotic panda gardener which, once per day, can instantaneously trim a single bamboo. You have already measured the growth rate of every bamboo in the garden, and you are now faced with programming the gardener with a suitable schedule of bamboos to trim in order to keep the view as clear as possible.

This problem is known as the Bamboo Garden Trimming (BGT) Problem [1] and can be formalized as follows: the garden contains n bamboos b1,,bn, where bamboo bi has a known daily growth rate of hi>0, with h1hn and i=1nhi=1. Initially, the height of each bamboo is 0, and at the end of each day, the robotic gardener can trim at most one bamboo to instantaneously reset its height to zero. The height of bamboo bi at the end of day d1 and before the gardener decides which bamboo to trim is equal to (dd)hi, where d<d is the last day preceding d in which bi was trimmed (if bi was never trimmed before day d, then d=0). See Fig. 1 for an example.

The main task in BGT is to design a perpetual trimming schedule that keeps the tallest bamboo ever seen in the garden as short as possible. In the literature of scheduling problems, this maximum height is called makespan.

A simple observation shows that the makespan must be at least 1 for every instance. Indeed, for any ε(0,1], a makespan of 1ε would imply that the daily amount of bamboo cut from the garden is at most 1ε, while the overall daily growth rate of the garden is 1. This is a contradiction. Furthermore, there are instances for which the makespan can be made arbitrarily close to 2. Consider, for example, two bamboos b1,b2 with daily growth rates h1=1ε and h2=ε, respectively. Clearly, when bamboo b2 is eventually cut, the height of b1 becomes at least 22ε. This implies that the best makespan one can hope for is 2.

Two natural strategies are known for the BGT problem, namely Reduce-Max and Reduce-Fastest(x). The former consists of trimming the tallest bamboo at the end of every day, while the latter cuts the bamboo with fastest growth rate among those having a height of at least x. Experimental results show that Reduce-Max performs very well in practice and it is conjectured to guarantee a makespan of 2 [2], [3]. However, the best known upper bound to the makespan is 1+Hn1=Θ(logn), where Hn1 is the (n1)-th harmonic number [4]. Interestingly, this Θ(logn) bound also holds for the adversarial setting in which at every day an adversary decides how to distribute the unit of growth among all the bamboos. In this adversarial case such upper bound can be shown to be tight, while understanding whether Reduce-Max achieves a constant makespan in the non-adversarial setting is a major open problem [1], [3]. On the other hand, in [1] it is shown that Reduce-Fastest(x) guarantees a makespan of 4 for x=2. Furthermore, it is also conjectured that Reduce-Fastest(1) guarantees a makespan of 2 [3].

As observed in [1], it is possible to achieve makespan 2 by relating the BGT problem with known results for the Pinwheel Scheduling (PS) problem. The PS problem asks to compute a periodic schedule S of a set of n input jobs, each associated with an integer frequency fi1, so that each job i appears at least once in any contiguous subsequence of length fi of S. An important quantity associated to a PS instance is called density and is defined as i=1n1fi. It is known that instances with density greater than 1 do not admit any feasible schedule, while it is possible to compute a feasible schedule for any instance having a density of at most 1 if the job frequencies are powers of 2 [5]. To achieve makespan 2, we would like to cut each bamboo bi at least once every 2/hi days. This allows us to transform a BGT instance into a corresponding PS instance in which the generic i-th job represents bamboo bi and has a frequency of fi that is obtained by rounding 2/hi down to the previous power of 2. One can observe that the density of the obtained PS instance is at most i=1n1fi2i=1nhi2=1 and hence we can compute a feasible schedule using the results in [5], [6].1 However, this approach has a problematic aspect since it is known that all feasible schedules for an instance of PS might have length Ω(i=1n1fi) in the worst case [5].

The above observation gives rise to the following complexity issue: Can a perpetual schedule be efficiently implemented in general? Essentially, a solution consists of designing a trimming oracle, namely a compact data structure that is able to provide a quick answer to the query “What is the next bamboo to trim?”.

It is worth noticing that similar problems are discussed in [1], where the authors ask for the design of trimming oracles that implement known BGT algorithms. For example, they explicitly leave open the problem of designing an oracle implementing Reduce-Max with query time of o(n).

Our results. Our contribution is twofold. In Section 2, we provide the following improved analyses of Reduce-Max and Reduce-Fastest(x):

  • We show that Reduce-Max achieves a makespan of at most 9. This is the first constant upper bound for this strategy and shows a separation between the static and the adversarial setting for which the makespan is known to be Θ(logn).

  • We show that, for any x>1, Reduce-Fastest(x) guarantees a makespan of at most max{x+x24(x1),12+x+x24(x12)}. For the best choice of x=1+15, this results in a makespan of 1+ϕ=3+52<2.62, where ϕ is the golden ratio. Notice also that for x=2 (the best choice of x according to the analysis of [1]) we obtain an upper bound of 19/6 which improves over the previously known upper bound of 4.

Then, in Section 3, we provide the following trimming oracles:

  • A trimming oracle implementing Reduce-Max whose query time is O(log2n) in the worst-case or O(logn) amortized. The size of the oracle is O(n) while the time needed to build it is O(nlogn). This answers the open problem given in [1].

  • A trimming oracle implementing Reduce-Fastest(x) with O(logn) worst-case query time. This oracle has linear size and can be built in O(nlogn) time.

  • A trimming oracle guaranteeing a makespan of 2. This oracle uses the rounding strategy from [1] but it uses a different approach to compute a perpetual schedule. Our oracle answers queries in O(logn) worst-case time, requires O(n) space, and can be built in O(nlogn) time.

    This result favorably compares with the existing oracles achieving makespan 2 implicitly obtained when the reduction of [1] is combined with the results in [5], [6] for the Pinwheel Scheduling problem. Indeed, once the instance G of BGT has been transformed into an instance P of Pinwheel Scheduling, any oracle implementing a feasible schedule for P is an oracle for G with makespan 2. In [5], the authors show how to compute a schedule for P of length L=Ω(i=1n1hi), which results in an oracle with exponential building time and constant query time. In [6], an oracle having query time of O(1) is claimed, but attaining such a complexity requires the use of Θ(n) parallel processors and the ability to perform arithmetic operations modulo L (whose binary representation may need Ω(n) bits) in constant time.

An interactive implementation of our Trimming Oracles described above is available at https://www.isnphard.com/g/bamboo-garden-trimming/.

Other related work. The BGT problem has been introduced in [1]. Besides the aforementioned results, this paper also provides an algorithm achieving a makespan better than 2 for a subclass of instances with balanced growth rates; informally, an instance is said to be balanced if at least a constant fraction of the overall daily growth is due to bamboos b2,,bn. The authors also introduce a generalization of the problem, named Continuous BGT, where each bamboo bi grows continuously at a rate of hi per unit of time and is located in a point of a metric space. The gardener can instantaneously cut a bamboo that lies in its same location, but needs to move from one bamboo to the next at a constant speed. Notice that this is a generalization of BGT problem since one can consider the trivial metric in which all distances are 1 (and it is never convenient for the gardener to remain in the same location).

Another generalization of the BGT problem called cup game can be equivalently formulated as follows: each day the gardener can reduce the height of a bamboo by up to 1+ε units, for some constant parameter ε0. This implies that any schedule achieving makespan m in the cup game also guarantees a makespan of at most m for the BGT problem (but the converse is not true). Cup games have been also studied when the growth rates are chosen by an adversary that distributes the daily unit of growth among the bamboos. In this case, a makespan of O(logn) can still be achieved using the Reduce-Max strategy [8]. Interestingly, if the growth rates are fixed and ε=0, all strategies must attain a makespan of Ω(logn) on some instance [8]. In contrast, our results show how to achieve makespan O(1) on any fixed-rate instance when ε8. Moreover, if the gardener's algorithm is randomized and has to face an oblivious adversary, i.e., an adversary that is aware of gardener's algorithm but does not know the random bits nor the previously trimmed bamboos, then it is possible to guarantee a makespan of O(m) with probability at least 1O(22m), i.e., a makespan of O(loglogn) with high probability [9], as long as ε is not too small. The above bound of O(loglogn) can be achieved even for stronger adversaries that can observe the height of bamboos that are tall enough [10]. For more results on the cup game and its variants we refer the interested reader to the following recent works and the references therein [9], [11], [12], [13], [14].

As we already mentioned, a problem closely related to BGT is the Pinwheel Scheduling problem that received a lot of attention in the literature [6], [5], [15], [16], [17], [18]. Recently, Della Croce exploited this connection to provide an algorithm that computes a 3200016947-approximated perpetual schedule for BGT [19]. Here the approximation ratio of a schedule is defined as the ratio between the makespan it attains and that of an optimal schedule. The above approximation ratio converges to 127 when h1 approaches 0 (and n approaches +∞). Later, van Ee [20] extended the approach of [19] and designed a polynomial-time algorithm that computes a 127-approximated schedule for any generic input BGT instance.

The BGT problem and its generalizations also appeared in a variety of other applications, ranging from deamortization, to buffer management in network switches, to quality of service in real-time scheduling (see, e.g., [21], [22], [8] and the references therein).

Section snippets

New bounds on the makespan of known BGT algorithms

In this section we provide an improved analysis on the makespan guaranteed by the Reduce-Fastest(x) strategy and the first analysis that upper bounds the makespan of Reduce-Max by a constant. In the rest of this section, we say that a bamboo bi is trimmed at day d to specify that the schedule computed using the heuristic chooses bi as the bamboo that has to be trimmed at the end of day d.

Trimming oracles

This section is devoted to the design of trimming oracles. We start by designing two trimming oracles that respectively implement Reduce-Fastest(x) and Reduce-Max. The trimming oracle that implements Reduce-Fastest(x) has a O(logn) worst-case query time, uses linear size and can be built in O(nlogn) time. The trimming oracle that implements Reduce-Max has a O(log2n) worst-case query time or a O(logn) amortized query time, uses linear space, and can be built in O(nlogn) time. We conclude

Declaration of Competing Interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Acknowledgements

The authors would like to thank Francesca Marmigi for the picture of the robotic panda gardener in Fig. 1. We are also grateful to an anonymous reviewer whose comments allowed us to significantly simplify the analysis of Reduce-Max.

References (26)

  • S. Im et al.

    The matroid cup game

    Oper. Res. Lett.

    (2021)
  • R. Holte et al.

    Pinwheel scheduling with two distinct numbers

    Theor. Comput. Sci.

    (1992)
  • M.H. Overmars et al.

    Maintenance of configurations in the plane

    J. Comput. Syst. Sci.

    (1981)
  • L. Gasieniec et al.

    Bamboo garden trimming problem (perpetual maintenance of machines with different attendance urgency factors)

  • S.S. Alshamrani et al.

    Efficient discovery of malicious symptoms in clouds via monitoring virtual machines

  • M. D'Emidio et al.

    Bamboo garden trimming problem: priority schedulings

    Algorithms

    (2019)
  • M.H.L. Bodlaender et al.

    Cinderella versus the wicked stepmother

  • R. Holte et al.

    The pinwheel: a real-time scheduling problem

  • M.Y. Chan et al.

    Schedulers for larger classes of pinwheel instances

    Algorithmica

    (1993)
  • S.K. Baruah et al.

    Proportionate progress: a notion of fairness in resource allocation

    Algorithmica

    (1996)
  • M. Adler et al.

    A proportionate fair scheduling rule with good worst-case performance

  • M.A. Bender et al.

    Achieving optimal backlog in multi-processor cup games

  • M.A. Bender et al.

    Randomized cup game algorithms against strong adversaries

  • Cited by (0)

    This work was partially supported by the Research Grant FBS2016_BILO funded by “Fondazione di Sardegna” in 2016, and by the Research Grant “ALgorithmic aspects of BLOckchain TECHnology” (E89C20000620005) funded by the University of Rome “Tor Vergata”.

    View full text