Table of Contents
Fetching ...

Ruler Rolling

Xing Lyu, Travis Gagie, Meng He

TL;DR

Ruler Rolling extends Ruler Folding to 90-degree folds, seeking Pareto-optimal rectangle dimensions $(h,w)$ for a given ruler. The authors present an online dynamic-programming approach that, under the assumption that the last segment is strictly longer than the third-to-last, computes all Pareto-optimal rollings in $O(n^2)$ time; without this assumption, the solution space becomes quadratic and reporting incurs $O(n^2 \log n)$ time, not online. They establish correctness via induction on the prefix of the ruler and discuss the challenges and open problems of a fully general (no-assumption) setting, including potential quadratic-time solutions under suitable objective functions. The work provides practical algorithms, analyzes their complexity, and suggests future extensions to other folding variants and performance optimizations, accompanied by experimental observations of speedups through implementation techniques.

Abstract

At CCCG '21 O'Rourke proposed a variant of Hopcroft, Josephs and Whitesides' (1985) NP-complete problem {\sc Ruler Folding}, which he called {\sc Ruler Wrapping} and for which all folds must be 180 degrees in the same direction. Gagie, Saeidi and Sapucaia (2023) noted that if the last straight section of the ruler must be longest, then {\sc Ruler Wrapping} is equivalent to partitioning a string of positive integers into substrings whose sums are increasing such that the last substring sums to at most a given amount. They gave linear-time algorithms for the versions of {\sc Ruler Wrapping} both with and without this assumption. In real life we cannot repeatedly fold a carpenter's ruler 180 degrees in the same direction. In this paper we propose the more realistic problem of {\sc Ruler Rolling}, in which we repeatedly fold the segments 90 degrees in the same direction and thus fold the ruler into a rectangle instead of into an interval. We should report all the Pareto-optimal rollings. We note that if the last straight section of the ruler must be longer than the third to last -- analogously to Gagie et al.'s assumption -- then {\sc Ruler Rolling} is equivalent to partitioning a string of positive integers into substrings such that the sums of the even substrings are increasing, as are the sums of the odd substrings. We give a simple dynamic-programming algorithm that reports all the Pareto-optimal rollings in quadratic time under this assumption. Our algorithm still works even without the assumption, but then we are left with a quadratic number of two-dimensional feasible solutions, so finding the Pareto-optimal ones and increases our running time by a logarithmic factor. If we have a nice objective function, however, we still use quadratic time.

Ruler Rolling

TL;DR

Ruler Rolling extends Ruler Folding to 90-degree folds, seeking Pareto-optimal rectangle dimensions for a given ruler. The authors present an online dynamic-programming approach that, under the assumption that the last segment is strictly longer than the third-to-last, computes all Pareto-optimal rollings in time; without this assumption, the solution space becomes quadratic and reporting incurs time, not online. They establish correctness via induction on the prefix of the ruler and discuss the challenges and open problems of a fully general (no-assumption) setting, including potential quadratic-time solutions under suitable objective functions. The work provides practical algorithms, analyzes their complexity, and suggests future extensions to other folding variants and performance optimizations, accompanied by experimental observations of speedups through implementation techniques.

Abstract

At CCCG '21 O'Rourke proposed a variant of Hopcroft, Josephs and Whitesides' (1985) NP-complete problem {\sc Ruler Folding}, which he called {\sc Ruler Wrapping} and for which all folds must be 180 degrees in the same direction. Gagie, Saeidi and Sapucaia (2023) noted that if the last straight section of the ruler must be longest, then {\sc Ruler Wrapping} is equivalent to partitioning a string of positive integers into substrings whose sums are increasing such that the last substring sums to at most a given amount. They gave linear-time algorithms for the versions of {\sc Ruler Wrapping} both with and without this assumption. In real life we cannot repeatedly fold a carpenter's ruler 180 degrees in the same direction. In this paper we propose the more realistic problem of {\sc Ruler Rolling}, in which we repeatedly fold the segments 90 degrees in the same direction and thus fold the ruler into a rectangle instead of into an interval. We should report all the Pareto-optimal rollings. We note that if the last straight section of the ruler must be longer than the third to last -- analogously to Gagie et al.'s assumption -- then {\sc Ruler Rolling} is equivalent to partitioning a string of positive integers into substrings such that the sums of the even substrings are increasing, as are the sums of the odd substrings. We give a simple dynamic-programming algorithm that reports all the Pareto-optimal rollings in quadratic time under this assumption. Our algorithm still works even without the assumption, but then we are left with a quadratic number of two-dimensional feasible solutions, so finding the Pareto-optimal ones and increases our running time by a logarithmic factor. If we have a nice objective function, however, we still use quadratic time.
Paper Structure (5 sections, 2 theorems, 6 equations, 7 figures, 2 tables)

This paper contains 5 sections, 2 theorems, 6 equations, 7 figures, 2 tables.

Key Result

Theorem 1

Given the lengths of the $n$ segments in a carpenter's ruler, in $O (n^2)$ time we can return all Pareto-optimal pairs $(h, w)$ such that the ruler can be rolled into a rectangle of height $h$ and width $w$ with the last segment extending strictly beyond every other in the relevant direction.

Figures (7)

  • Figure 1: Gagie et al.'s GSS23 Figures 3 and 4. When drawing their solutions as intervals (top) became awkward, they eventually resorted to triangles (bottom). The purple triangle is the optimal wrapping when the last straight section of the ruler can be as short as or shorter than the previous one, and the yellow triangle is the optimal wrapping when it must be longer.
  • Figure 2: The best rollings we can get for the ruler in Gagie et al.'s paper with $L = 5, 6, 3, 4, 8, 6, 2, 1, 8, 5$, with the last segment vertical and extending strictly below every other (so the first numbers in $L$ are the lengths of the innermost segments in the spirals).
  • Figure 3: If we cut off the left size of the sixth rolling in Figure \ref{['fig:rollings']}, which has pair $(13, 9)$, and rotate that rolling 90 degrees counter-clockwise, then we obtain a rolling with pair $(9, 8)$ for the ruler with segment lengths $5, 6, 3, 4, 8, 6, 2, 1$.
  • Figure 4: The rollings corresponding to the pairs $(2, 32)$ and $(1, 34)$, left in rows 7 and 8, which do not have the last segment extending beyond every other.
  • Figure 5: Rollings in which we change from increasing to decreasing sums (left) and change the folding direction (right).
  • ...and 2 more figures

Theorems & Definitions (2)

  • Theorem 1
  • Theorem 2