An Efficient Algorithm for Unbalanced 1D Transportation
Gabriel Gouvine
TL;DR
This work addresses the lack of efficient algorithms for unbalanced optimal transport in one dimension. It recasts 1D UOT as a minimum-cost flow and develops a successive shortest path algorithm augmented with a positional-encoding representation, enabling fast, monotone, no-hole solutions. The main result is a provably optimal $O((n+m) \log(n+m))$ algorithm (i.e., $O(n \log n)$ when $n$ and $m$ are of the same order) that matches the balanced 1D OT complexity and tightens previous bounds for UOT. The method is implemented in C++ and validated on 10k random instances, with open-source code, highlighting practical impact for fast, exact 1D UOT in applications where the earth mover distance is employed in unbalanced settings.
Abstract
Optimal transport (OT) and unbalanced optimal transport (UOT) are central in many machine learning, statistics and engineering applications. 1D OT is easily solved, with complexity O(n log n), but no efficient algorithm was known for 1D UOT. We present a new approach that leverages the successive shortest path algorithm for the corresponding network flow problem. By employing a suitable representation, we bundle together multiple steps that do not change the cost of the shortest path. We prove that our algorithm solves 1D UOT in O(n log n), closing the gap.
