We consider the problem of placing k identical resources in a graph where each vertex is associated with a nonnegative weight representing the frequency of requests issued by that vertex for the resource. We define the cost of a placement as the sum over all vertices of their distances to the closest resource weighted by their weights. The optimal placement is the placement with the least cost among all placements. We give an algorithm for placing optimally k resources on a growing line. The algorithm starts with an empty line. At each step a new vertex is appended to the line and the algorithm has to recompute the optimal placement of the k resources. Our algorithm processes each new vertex in O(k) amortized time. As a corollary, we obtain an algorithm that computes the optimal placement of k resources in an n-vertex line in time O(kn), which optimal for constant k.
[1]
J. Vitter,et al.
Approximations with Minimum Packing Constraint Violation
,
1992
.
[2]
S. L. HAKIMIt.
AN ALGORITHMIC APPROACH TO NETWORK LOCATION PROBLEMS.
,
1979
.
[3]
Mimmo Parente,et al.
Dynamic and Static Algorithms for Optimal Placement of Resources in a Tree
,
1996,
Theor. Comput. Sci..
[4]
Greg N. Frederickson,et al.
Parametric Search and Locating Supply Centers in Trees
,
1991,
WADS.
[5]
Christos H. Papadimitriou,et al.
Worst-Case and Probabilistic Analysis of a Geometric Location Problem
,
1981,
SIAM J. Comput..
[6]
Nimrod Megiddo,et al.
On the Complexity of Some Common Geometric Location Problems
,
1984,
SIAM J. Comput..