NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Fast fencing

Mikkel Abrahamsen, Anna Adamaszek, Karl Bringmann, Vincent Cohen-Addad, Mehran Mehr, Eva Rotenberg, Alan Roytman, Mikkel Thorup

Abstract

This paper presents the first polynomial-time algorithms for two classic geometric optimization challenges: the Unit Disk Fencing problem and the $k$-Cluster Fencing problem. These problems, which involve minimizing the total perimeter required to enclose $n$ points under different constraints, have remained open since the early 1990s. Most significantly, we refute the long-standing conjecture that $k$-cluster fencing is NP-hard, demonstrating an $O(n^{27})$ solution. Our approach utilizes quadtree-based dissection for unit disks and a novel separator-based dynamic programming strategy for the $k$-cluster variant.

Introduction

The "fence enclosure" problem is a fundamental challenge in computational geometry. Given $n$ points in a 2D plane, the goal is to find a set of closed curves (fences) that enclose all points while minimizing the total perimeter. This paper addresses two specific versions:

  1. Unit Disk Fencing: Minimizes total perimeter plus a fixed cost $\eta$ per cluster, equivalent to enclosing $n$ unit-radius disks.
  2. $k$-Cluster Fencing: Minimizes total perimeter using at most $k$ separate loops.

While previous work provided $n^{O(k)}$ algorithms for the $k$-cluster problem, the complexity for general $k$ was widely believed to be NP-hard for over 25 years.

Unit Disk Fencing

The proposed algorithm for Unit Disk Fencing achieves a near-optimal running time of $O(n \log^3 n)$. The method employs a quadtree-based dissection to recursively subdivide the plane into cells.

Illustration of the unit disk fencing problem, where the goal is to enclose disks of a fixed radius with minimum total perimeter.

A critical component is an angular sweep subroutine that identifies optimal "angle-monotone" paths. By proving that optimal partitions possess a unique maximal form and that clusters are "indivisible," we can efficiently merge local solutions into a global optimum. This approach can also be generalized to handle objects of varying sizes or polygonal shapes.

The $k$-Cluster Fencing Problem

The most significant contribution of this work is the $O(n^{27})$ algorithm for $k$-cluster fencing, which places the problem firmly in the complexity class P.

Structural decomposition of clusters in the k-cluster fencing problem, showing how convex hulls of point subsets interact.

The algorithm uses dynamic programming over axis-parallel "boxes." We prove a fundamental structural property: for any box containing a subset of points, there exists a horizontal or vertical separator that intersects at most two edges of the optimal solution's convex hulls. This "simple" interaction across separators prevents the exponential explosion of subproblems, allowing for a polynomial-time solution regardless of the value of $k$.

Conclusion

By providing polynomial-time algorithms for these two problems, we resolve decades of uncertainty regarding their computational complexity. While the $O(n^{27})$ exponent is primarily of theoretical interest, the insight regarding separators provides a foundation for more practical algorithms in the future. Further research may extend these techniques to higher dimensions or explore alternative cost functions such as area minimization.

Summary updated

BibTeX
@inproceedings{abrahamsen2018fast,
  author = {Mikkel Abrahamsen and Anna Adamaszek and Karl Bringmann and Vincent Cohen-Addad and Mehran Mehr and Eva Rotenberg and Alan Roytman and Mikkel Thorup},
  title = {{Fast fencing}},
  booktitle = {STOC},
  year = {2018},
  doi = {10.1145/3188745.3188878},
}
Figure