The k-server problem #
This file defines the k-server problem of Manasse, McGeoch and Sleator, Competitive
algorithms for server problems (see also Borodin and El-Yaniv,
Online Computation and Competitive Analysis, Chapter 10) as an instance of
the online framework Cslib.DataStructure.Online.Problem, together with the matching distance
between configurations used by potential-function analyses.
k servers occupy points of a metric space. Each request is a point, and to serve it some server
must move onto it. Serving a request costs the total distance moved by all servers.
Model #
- Distances are natural numbers (
NatMetric), so step costs fitOnline.Problem.stepCost : Nat.NatMetric.lineis the lineℤwith|x - y|, andNatMetric.uniformthe uniform metric, where the problem is paging withkcache slots up to the cost of an eviction. - A configuration is a labeled tuple
Fin k → α, so coincident servers are allowed. A transition is any configuration with a server on the request, and it costsmoveCost, the summed per-label distance. Relabeling is free: a schedule may pass tos' ∘ σfor any permutationσ. The cheapest such move fromsto the multiset ofs'is thereforematchCost s s', the minimum-cost perfect matching (matchCostAlong_eq_moveCost). So the labeled model has the same offline optimum as the multiset formulation of the source. - Online algorithms are
Online.DetStrategys and competitiveness isOnline.IsCompetitiveFrom.
Main definitions #
Cslib.DataStructure.KServer.NatMetric: a metric with natural-number distances, with the instancesNatMetric.lineandNatMetric.uniform.Cslib.DataStructure.KServer.moveCost: total server movement between two configurations.Cslib.DataStructure.KServer.problem: thek-serverOnline.Problemon a metric.Cslib.DataStructure.KServer.matchCost: minimum-cost perfect matching between configurations.Cslib.DataStructure.KServer.pairSum: summed pairwise distance within a configuration.
Main results #
matchCost_le_add_moveCost: moving the second configuration changes the matching distance by at most the movement.matchCostAlong_swap_le: uncrossing a matching along a geodesic does not increase its cost.matchCostAlong_update_toward: moving a server toward its partner lowers the cost by the distance moved.
References #
A metric on α with natural-number distances.
- dist : α → α → ℕ
The distance between two points.
The line metric on ℤ, dist x y = |x - y|.
The uniform metric: distinct points are at distance 1.
Server movement #
The problem #
The k-server problem on the metric M: configurations are labeled server positions, any
initial configuration is admissible, serving r means reaching a configuration with a server at
r, and a step costs the total server movement.
Minimum-cost matching between configurations #
Cost of matching server i of s to server σ i of t.
Matching along σ is the movement to the relabeled configuration t ∘ σ.
Uncrossing: if s b lies on a geodesic from t (σ a) to s a, swapping the partners of
a and b does not increase the matching cost.
Moving one server changes a fixed matching's cost by at most the distance moved.
Moving one server along a geodesic toward its partner lowers the cost by the distance moved.