Manuscript Offprint
arXiv:2611.04275Online Metric Matching with Unknown i.i.d. Arrivals
Abstract
We study online metric matching with servers and requests drawn independently from an unknown distribution. Each request must be matched immediately and irrevocably to an unused server, and the algorithm receives no samples before the process starts. We give a randomized algorithm that is -competitive on arbitrary metric spaces and -competitive on tree metrics. These guarantees match the corresponding bounds for known i.i.d. request distributions in [GGPW19] up to constant factors. More generally, our competitive ratio is whenever the FAIR-BIAS algorithm introduced in that work has competitive ratio for known i.i.d. arrivals on the same class of metrics. Consequently, proving that FAIR-BIAS is constant-competitive on general metrics would also yield a constant-competitive algorithm for unknown i.i.d. arrivals.
1 Introduction
In online metric matching, servers are available in a metric space before the process begins, and requests arrive sequentially. Each request must be assigned to an unused server as soon as it arrives. Assignments cannot be changed later, and the objective is to minimize the total distance between requests and their assigned servers. The performance of an algorithm is measured by its competitive ratio, which compares its cost with the minimum cost of a perfect matching between all requests and all servers. Informally, an algorithm is -competitive if its cost is at most times the cost of a minimum-cost perfect matching.
Under adversarial arrivals, the optimal deterministic competitive ratio for general metrics is [KP93, KMV94], while randomized algorithms achieve [BBGN14].
When requests arrive at random, there are three natural models to consider. In the known-i.i.d. model, requests are drawn independently from a common distribution that is given to the algorithm before any requests arrive. In the unknown-i.i.d. model, requests are generated in the same way, but the distribution is not given to the algorithm. In the random-order model, an adversary fixes the request locations in advance without revealing them to the algorithm. The requests then arrive in a uniformly random order, and each location is revealed only upon arrival.
The known-i.i.d. model is no harder than the unknown-i.i.d. model, since an algorithm can ignore the supplied distribution. The unknown-i.i.d. model is in turn no harder than the random-order model: conditional on the multiset of i.i.d. requests, their order is uniformly random. Thus, any algorithm that is -competitive in the random-order model is also -competitive in the unknown-i.i.d. model.
For the known i.i.d. model, [GGPW19] obtain an competitive ratio for general metrics and for tree metrics, whereas the optimal ratio in the random-order model is [Rag16]. This gap raises a question also posed in [GGPW19, Section 5]: in terms of achievable competitive ratios, is the intermediate unknown-i.i.d. model closer to the known-i.i.d.
model or the random-order model? For line metrics, [VMF25] report an -competitive algorithm in the unknown-i.i.d. model.¹ Their bound matches the known-i.i.d. bound on the line, providing a partial answer to this question.
Theorem 1.1. For every metric space and every placement of labeled servers, there is a randomized online algorithm that, for every unknown request distribution , satisfies
when the requests are drawn i.i.d. from . Here, the expectation is over both the requests and the algorithm's random choices.
More generally, our competitive ratio is whenever FAIR-BIAS has competitive ratio for known i.i.d. arrivals on the same class of metrics; see Theorem 6.2 and the reduction in Section 2.1. Thus, if the competitive ratio of FAIR-BIAS on general metrics is proved to be , our algorithm would also be -competitive.
The resulting bound is , so it separates unknown i.i.d. arrivals from random-order arrivals. It matches the order of the known-i.i.d. upper bound. On tree metrics, our algorithm is constant-competitive; see Corollary 6.3. The guarantees for the three arrival models are summarized in Table 1.
Note that our results do not imply that the optimal competitive ratios in the known-i.i.d. and unknown-i.i.d. models have the same asymptotic order. For example, a separation between the two models could still occur on general metrics if an algorithm other than FAIR-BIAS were -competitive in the known-i.i.d. model while FAIR-BIAS had competitive ratio .
Table 1: Competitive-ratio bounds for general and tree metrics.
| Arrival model | General metrics | Tree metrics | Source |
|---|---|---|---|
| Known i.i.d. | [GGPW19] | ||
| Unknown i.i.d. | Theorem 1.1 and Corollary 6.3 | ||
| Random order | [Rag16] |
1.2 Algorithm overview
Let denote the point mass at and write
for the distribution obtained by choosing a server label uniformly, where is the position of server . For a known request distribution , the reduction in [GGPW19, Lemma 2.1] uses an optimal transport plan from to to generate virtual requests from . This plan can be fixed before any requests arrive.
¹Our account is based solely on the symposium abstract. We have not confirmed the full model assumptions or technical details.
Our algorithm replaces in this construction by the empirical distribution
which includes the current request . At each time , it computes an optimal transport plan from to . Using the conditional probabilities in the row corresponding to the current request, it draws a virtual server label and passes it to FAIR-BIAS. The actual request is assigned to the server chosen by FAIR-BIAS.
Although the transport plan changes as requests arrive, we prove that the generated virtual labels are independent and each is uniformly distributed over the server labels; see Lemma 5.1. Consequently, their positions form independent samples from , so the guarantees of FAIR-BIAS apply to its execution on the virtual requests. It remains to bound the distances between actual and virtual requests. We show that their expected sum is at most , where is the competitive ratio of FAIR-BIAS for independent requests from ; see Theorem 6.2.
1.3 Related work
Adversarial online metric matching. [KP93] and [KMV94] independently give deterministic -competitive algorithms and matching lower bounds. For randomized algorithms, an lower bound is stated in [KP98]. [MNP06] give an -competitive algorithm, and [BBGN14] improve this bound to .
Random order and known i.i.d. arrivals. [Rag16] gives an -competitive algorithm and proves a matching lower bound in the random-order model. For known i.i.d. arrivals, [GGPW19] introduce FAIR-BIAS and obtain the general-metric bound, together with constant bounds on trees. [DSX22] study uniform metric spaces and provide a more detailed competitive-ratio analysis under random-order arrivals.
In Euclidean spaces. [BFP23] study greedy matching on the line. They prove constant competitiveness when all server and request locations are sampled independently from the uniform distribution on . When the server locations are chosen adversarially and the requests are still sampled independently from the uniform distribution on , they obtain an competitive ratio. [YY26] obtain -competitive algorithms for online metric matching in the known-i.i.d. model on , under the uniform distribution in any fixed dimension and under distributions with densities bounded above by a constant in fixed dimensions . [LVY26] analyze online metric matching with independent requests whose distributions need not be identical.
Separation between arrival models in other matching problems. [ABCG26] separate random-order and unknown-i.i.d. arrivals for a different matching problem. They study non-bipartite minimum-cost matching on the line, where all participants arrive online. Upon each arrival, the algorithm either matches the new participant to a previously unmatched participant or leaves it unmatched for a future arrival. They obtain an competitive ratio under unknown i.i.d. arrivals, whereas the competitive ratio is unbounded under random-order arrivals.
2 Preliminaries
2.1 The model and benchmark
Let be an arbitrary metric space and let be the known server placement, with labels in . Distinct server labels may occupy the same position. Each server can be used once. The requests are drawn independently from a distribution on , which is not given to the algorithm. The algorithm observes before assigning it, can retain all previously observed requests, and receives no samples from before time 1.
For a request sequence , define
where is the set of permutations of . We abbreviate this random variable by OPT when the placement and request distribution are understood. For an online algorithm, let ALG denote its total matching cost. An algorithm is -competitive in the unknown-i.i.d. model if, for every and , its total cost satisfies . This is a ratio-of-expectations guarantee, not a bound on or on each realized request sequence.
Reduction to finite metric spaces. We prove the result for finite metric spaces. For an arbitrary metric space, use the reduction in [MNP06]: move each request to a nearest server location, run the algorithm on the resulting requests, and assign the original request to the same server as the transformed one. The nearest server is chosen among all servers, whether used or unused, with ties broken by a fixed order of labels. This converts a -competitive guarantee into a -competitive guarantee, without changing its asymptotic order. Therefore, we assume that is finite in Sections 3 to 6.
2.2 Transport costs
Let denote the point mass at . For probability distributions on the finite metric space , let
where are finite index sets, and are probability vectors, and . The positions in either representation need not be distinct. Define
The variable is the mass sent from source index at to destination index at . A feasible matrix is called a transport plan. Its row indexed by sums to , and its column indexed by sums to . When and for every , a diagonal entry represents mass left at the same position.
Let be the uniform distribution over the server labels, and let be the empirical distribution of the first requests:
We will use the fact that common mass can be left at the same index in an optimal plan; see Lemma A.1.
The following lemma expresses the optimal matching cost as a transport cost.
Lemma 2.1. For every realized request sequence ,
Proof. Sending mass along each edge of a perfect matching gives a feasible transport plan, so . For the reverse inequality, let be an optimal plan in (2.2) from to , with rows indexed by requests and columns by servers . Every row and column sums to , so is doubly stochastic. A convex decomposition of into permutation matrices therefore contains a permutation of cost at most . This permutation gives a perfect matching, proving the reverse inequality.
For the analysis, we introduce two expected transport costs. Let be drawn independently from the uniform distribution on and put . This sequence of requests from is separate from the unknown request sequence. Define
For nonempty , write
Let be the uniform distribution over all -element subsets of , and define
In particular, , although need not be zero. Both definitions continue to distinguish co-located labels. If denotes the offline cost for i.i.d. requests from , Lemma 2.1 gives
3 The Fair-Bias algorithm
We recall FAIR-BIAS [GGPW19, Algorithm 1] for requests drawn independently from . All numbered statements cited from [GGPW19] refer to its full version, arXiv:1904.09284v1.
3.1 Definition of FAIR-BIAS
Suppose is the current set of unused servers and . Fix an optimal plan from to by solving
Rows index input server labels , and columns index available server labels . The rule selecting an optimal plan depends only on and , not on the current input label. On input label , FAIR-BIAS chooses server with probability and removes from . The optimal value in (3.1) is , denoted by in [GGPW19].
3.2 Properties and competitive-ratio bounds
Run FAIR-BIAS on the labels drawn independently from the uniform distribution on . Let be the set of server labels it uses for the first requests, and let be the total cost of those assignments.
Lemma 3.1 (A version of [GGPW19, Lemma 2.2]). For every ,
In particular, .
Proof. Condition on the past input labels and past internal random choices. The free set is then fixed, and the next input label remains uniformly distributed on and independent of that past. For each , its probability of being chosen next is
Hence the successive server labels are a uniformly random permutation of , and . Under the same conditioning, the expected next assignment cost is
When , the unconditional distribution of is , so the unconditional expected cost of that step is . The first steps use free sets of sizes , giving the stated sum.
The assertion is a statement about the distribution without conditioning on the requests. It does not state that is independent of . In general these variables are dependent.
We also use the following competitive-ratio bounds.
Proposition 3.2 ([GGPW19, Theorems 3.10 and 4.6]). For every server placement, FAIR-BIAS with requests drawn independently from satisfies
For tree metrics, one may take .
4 Comparing cumulative transport costs
We prove (4.6) using the execution of FAIR-BIAS on independent requests from in Section 3. Only Lemma 3.1 is used in this section; the competitive-ratio bound (3.3) is not needed until the comparison has been established.
We first relate to . The following identity is also used in the proof of [GGPW19, Lemma 3.9, Appendix C.3].
Lemma 4.1. If and has size , then, writing ,
Consequently,
Proof. Use server labels on both sides of the transport plans. By Lemma A.1, an optimal plan from to may leave mass at each label of . After removing these zero-cost diagonal entries, the remaining plan has entries only for , , with
Conversely, any nonnegative matrix satisfying (4.3) can be completed to a feasible plan by restoring those diagonal entries. Thus is exactly the minimum cost over such matrices.
For transport from to , leave mass at each label of . After removing these diagonal entries, the remaining entries must satisfy
Given a feasible in (4.3), set
Its row and column sums are, respectively,
It is therefore feasible for (4.4). By symmetry of the distance, its cost is
The inverse transformation is . Its feasibility follows by checking the row and column sums in the same way. Hence the two optimal residual costs differ by exactly the factor , proving (4.1). Finally, complementation maps a uniform -element subset to a uniform -element subset. Taking expectations gives (4.2).
We next bound using the first assignments made by FAIR-BIAS.
Lemma 4.2. For every ,
Proof. Consider the execution of FAIR-BIAS on independent requests from defining and in Lemma 3.1. For each realization, send mass along each of its first assignment edges. The source distribution is ; the destination distribution is , because these servers are distinct. Thus
and the triangle inequality gives
Take expectation over this same execution, including the requests drawn from and the internal random choices. The left-hand expectation is , since that term depends only on the requests.
The last term depends only on , so its expectation is by the unconditional distribution . Using Lemma 3.1 for the middle term yields
Neither taking expectations nor evaluating these individual terms requires independence between and .
Summing the preceding bounds over time and using Lemma 4.1 gives the following theorem.
Theorem 4.3. For every server placement,
Proof. The claim is immediate for , since . For , sum (4.5) over :
Since , reversing the order of summation gives
The inner sum has terms, each at most . By (4.2),
Substituting into (4.7) proves the theorem.
Combining the theorem with (3.3) and (2.6) gives
5 Generating virtual requests
We return to the actual requests from the unknown distribution . The algorithm uses two different transport plans: an optimal transport plan from to that generates a virtual request from the actual request , and the plan used by FAIR-BIAS to match that virtual request to an available server.
Algorithm 1 Online metric matching for unknown i.i.d. requests in a finite metric space
Require: Server placement and the fixed plan-selection rules
1:
2: for do
3: Observe and form .
4: Choose the fixed optimal plan from to in (2.2), using request indices and server labels .
5: Draw with probability .
6: Choose the fixed FAIR-BIAS plan in (3.1).
7: Draw with probability .
8: Assign irrevocably to server and set .
9: end for
5.1 The algorithm and plan-selection rules
At time , choose an optimal plan from to in (2.2), with rows indexed by requests at and columns by server labels at . Thus
We use any fixed tie-breaking rule that selects the same transport plan whenever the request locations coincide as multisets.
Having observed , draw a virtual label with probabilities
and set . These probabilities are nonnegative and sum to one because row of sums to . The draw uses fresh randomness independent of the request sequence and the randomness used to draw the virtual labels at other times.
Pass to FAIR-BIAS, whose plan is allowed to depend on the current free set . Use randomness for FAIR-BIAS that is independent of the request sequence and of all randomness used to draw the virtual labels. If FAIR-BIAS selects label , assign the actual request to that same server. FAIR-BIAS bases its decisions only on its virtual inputs, its own state, and its own randomness; it does not inspect the original request history.
The virtual label does not specify the final assignment and may refer to a server that has already been used. The transport plans can be computed using only the observed request positions and the known server locations.
5.2 Independence of the virtual sequence
We first show that the virtual requests are independent samples from . For a fixed multiset of requests , write for the selected plan, with row corresponding to request .
Lemma 5.1. Fix and any multiset of requests. Present these requests in a uniformly random order and apply the conversion rule above. For every ,
Consequently, for i.i.d. actual requests, are independent and each is uniformly distributed on , and are independent samples from .
Proof. We prove the lemma by induction on , simultaneously over all multisets of size . For , the plan has for every server label , so the base case follows.
For the inductive step, fix . Let be the index of the final request, so for every . Conditional on , the preceding requests are a uniformly random ordering of the remaining requests. By the induction hypothesis,
By the conversion rule, we have
Therefore,
The last equality is the destination constraint for server label . This completes the induction.
By Lemma 5.1, the virtual requests generated in Section 5.1 are i.i.d. samples from . They are also independent of the internal randomness of FAIR-BIAS, so the analysis in Section 3 applies to the execution of FAIR-BIAS on the virtual requests.
5.3 The conversion cost
We next relate the expected cost of converting an actual request to a virtual request to the expected transport cost between and .
Lemma 5.2. For each ,
Proof. Let be the multiset of the first actual requests. Conditioned on , each request has probability of being the final request. When request is last, its virtual label is drawn with probabilities . Thus
The last equality uses optimality of . Averaging over yields the lemma.
Let be the cost of running FAIR-BIAS on the virtual requests. For each realization, the triangle inequality yields . Summing and using Lemmas 5.1 to 5.2, we obtain
6 Competitive analysis
We now compare the two terms in (5.6) with the expected offline optimum for the actual requests. The unknown distribution is used only in the analysis.
Lemma 6.1. For every server placement and request distribution ,
Proof. Write and . For (6.1), fix an optimal matching for each realization and define a plan on by
The expected plan has row sums and column sums , so it is a feasible plan from to . Since its cost is , (6.1) is proved.
Next fix an optimal plan from to in (2.2), with source indices at and destination indices at . Independently for each , draw an index pair with probabilities
and set and . The sequence is i.i.d. from , and is i.i.d. from . For each , the empirical distribution of follows . In addition, the empirical distribution of follows and we have . For each realization and each , define a plan with source and destination by
Every row and column sums to , so this is a feasible plan from to . Its cost is , so
Adding transport from to and taking expectations gives
proving (6.2).
Finally, let be an optimal matching of to . Match each to as well. This is feasible, because the server labels are all distinct. Therefore,
Taking expectations and using (6.1) proves (6.3).
We now combine these inequalities with Theorem 4.3 to obtain the competitive-ratio bound.
Theorem 6.2. Suppose FAIR-BIAS is -competitive for requests drawn independently from on the server placements under consideration. Then Algorithm 1 satisfies
for every unknown i.i.d. request distribution on a finite metric space.
Proof. By (5.6), (6.2), and Theorem 4.3,
The last line uses (6.1) and (6.3).
Proof of Theorem 1.1. Combining Theorem 6.2 and Proposition 3.2 gives the stated asymptotic ratio on finite metric spaces. The reduction in Section 2.1 gives the same asymptotic ratio on arbitrary metric spaces.
For tree metrics, substituting from Proposition 3.2 into Theorem 6.2 gives a constant competitive ratio.
Corollary 6.3. On tree metrics, unknown i.i.d. requests can be served with competitive ratio 51, with no restriction on the support of the request distribution. If the request distribution has finite support, Algorithm 1 is 25-competitive.
Proof. If has finite support, its support together with the server locations forms a finite metric space, so Theorem 6.2 gives . The reduction in Section 2.1 gives for arbitrary request distributions.
7 Comparison with random-order arrivals
As summarized in Table 1, the upper bounds in Theorem 1.1 and Corollary 6.3 are asymptotically smaller than the random-order lower bound [Rag16].
Lemma 5.1 holds for a uniformly random ordering of any fixed multiset. It is therefore important to identify why the competitive analysis cannot simply be repeated for random-order inputs. The obstruction is the comparison in (6.3) between the offline optimum for independent requests from and the offline optimum for the actual requests: exchangeability alone does not imply that comparison.
For example, take two servers at 0 and 1 with distance one, and let the random-order request multiset be . Its empirical distribution is , and
However, two independent requests from coincide with probability ; when they do, their optimal matching cost is one. Hence
Thus the counterpart of (6.3) is false in the random-order model. The exact generation of independent virtual inputs by itself is not a competitive-ratio guarantee; the conversion cost must also be charged to an appropriate offline benchmark.
AI Disclaimer
OpenAI's Codex and ChatGPT 6 Astra were used to assist with revising the text and notation and discussing the proofs. The author is responsible for the final content of this manuscript.
References
[ABCG26] Josh Ascher, Eric Balkanski, Jason Chatzitheodorou, and Vasilis Gkatzelis. Online min-cost matching with general arrivals. arXiv:2606.05546, 2026. Accepted to the 27th ACM Conference on Economics and Computation (EC 2026). doi: 10.48550/arXiv.2606.05546.
[BBGN14] Nikhil Bansal, Niv Buchbinder, Anupam Gupta, and Joseph Naor. A randomized -competitive algorithm for metric bipartite matching. Algorithmica, 68(2):390–403, 2014. doi:10.1007/s00453-012-9676-9.
[BFP23] Eric Balkanski, Yuri Faenza, and Noémie Périvier. The power of greedy for online minimum cost matching on the line. In Proceedings of the 24th ACM Conference on Economics and Computation (EC 2023), pages 185–205. Association for Computing Machinery, 2023. doi:10.1145/3580507.3597794.
[DSX22] Sharmila V. S. Duppala, Karthik A. Sankararaman, and Pan Xu. Online minimum matching with uniform metric and random arrivals. Operations Research Letters, 50(1):45–49, 2022. doi:10.1016/j.orl.2021.12.005.
[GGPW19] Anupam Gupta, Guru Guruganesh, Binghui Peng, and David Wajc. Stochastic online metric matching. In 46th International Colloquium on Automata, Languages, and Programming (ICALP 2019), volume 132 of Leibniz International Proceedings in Informatics, pages 67:1–67:14. Schloss Dagstuhl–Leibniz-Zentrum für Informatik, 2019. Full version: arXiv:1904.09284v1. Theorem and lemma numbers cited in this paper refer to that version. doi:10.4230/LIPIcs.ICALP.2019.67.
[KMV94] Samir Khuller, Stephen G. Mitchell, and Vijay V. Vazirani. On-line algorithms for weighted bipartite matching and stable marriages. Theoretical Computer Science, 127(2):255–267, 1994. doi:10.1016/0304-3975(94)90042-6.
[KP93] B. Kalyanasundaram and Kirk Pruhs. Online weighted matching. Journal of Algorithms, 14(3):478–488, 1993. doi:10.1006/jagm.1993.1026.
[KP98] Bala Kalyanasundaram and Kirk Pruhs. On-line network optimization problems. In Amos Fiat and Gerhard J. Woeginger, editors, Online Algorithms: The State of the Art, volume 1442 of Lecture Notes in Computer Science, pages 268–280. Springer, 1998. doi:10.1007/BFb0029573.
[LVY26] Yingxi Li, Ellen Vitercik, and Mingwei Yang. Smoothed analysis of online metric matching with a single sample: Beyond metric distortion. In 17th Innovations in Theoretical Computer Science Conference (ITCS 2026), volume 362 of Leibniz International Proceedings in Informatics, pages 94:1–94:23. Schloss Dagstuhl–Leibniz-Zentrum für Informatik, 2026. doi:10.4230/LIPIcs.ITCS.2026.94.
[MNP06] Adam Meyerson, Akash Nanavati, and Laura J. Poplawski. Randomized online algorithms for minimum metric bipartite matching. In Proceedings of the 17th Annual ACM–SIAM Symposium on Discrete Algorithms (SODA 2006), pages 954–959. Society for Industrial and Applied Mathematics, 2006. URL: https://dl.acm.org/doi/10.5555/1109557.1109662.
[Rag16] Sharath Raghvendra. A robust and optimal online algorithm for minimum metric bipartite matching. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques (APPROX/RANDOM 2016), volume 60 of Leibniz International Proceedings in Informatics, pages 18:1–18:16. Schloss Dagstuhl–Leibniz-Zentrum für Informatik, 2016. doi:10.4230/LIPIcs.APROX-RANDOM.2016.18.
[VMF25] Phanu Vajanopath, Pasin Manurangsi, and Jittat Fakcharoenphol. Stochastic online metric matching for unknown distribution. Research and Innovation Grant Progress Symposium 2025: Book of Abstracts, 2025. Symposium abstract. URL: https://fliphtml5.com/martr/gqjp/Research_Grant_Progress_Symposium_2025/.
[YY26] Mingwei Yang and Sophie H. Yu. Online metric matching: Beyond the worst case. Operations Research, 74(1):130–140, 2026. doi:10.1287/opre.2025.1646.
A Leaving common mass in place
We use the matrix representation of transport plans from Section 2.2.
Lemma A.1. Let and be nonnegative masses of the same total mass on a finite label set. With transport cost , an optimal plan may be chosen so that
Proof. The feasible set of transport plans is nonempty and compact. Among its cost-minimizing plans, choose one maximizing the total diagonal mass . If at some label , then there exist and with and . Let
Decrease and by , and increase and by . The source row sums and destination column sums are unchanged, and no entry becomes negative. The cost change is
Thus the modified plan is still optimal. Its diagonal mass has increased by , or by if , contradicting the choice of . Hence all diagonal entries equal the common mass.
After that common mass is removed, only labels with excess source mass need send mass, and only labels with excess destination mass need receive it. This is the residual transport used in Lemma 4.1.