Weighted Rectilinear Approximation of Points in the Plane (original) (raw)
We consider the problem of weighted rectilinear approximation on the plane and offer both exact algorithms and heuristics with provable performance bounds. Let S = {(p i , w i)} be a set of n points pi in the plane, with associated distance-modifying weights wi > 0. We present algorithms for finding the best fit to S among x-monotone rectilinear polylines R with a given number k < n of horizontal segments. We measure the quality of the fit by the greatest weighted vertical distance, i.e., the approximation error is max 1≤i≤n w i d v (p i , R), where d v (p i , R) is the vertical distance from pi to R. We can solve for arbitrary k optimally in O(n 2) or approximately in O(n log 2 n) time. We also describe a randomized algorithm with an O(n log 2 n) expected running time for the unweighted case and describe how to modify it to handle the weighted case in O(n log 3 n) expected time. All algorithms require O(n) space.