arXiv:2107.10777v9 [cs.DS] 19 Sep 2021 * upre npr yNFgatCCF-1815901. grant NSF by part in Supported isfrec idr hssesaraoal supinfor assumption reasonable of a values seems moderate This bidder. each for bids of called rcia infiac na utos[ auctions ad in significance practical ena aua xesoso RANKING. of extensions natural as seen of ratio competitive a achieving , online ih o niebpriemthn,gvni [ in given , bipartite online rema for approach rithm new our of impact the LP-duality; on based were  h eea dod rbe a eandlreyunresolve largely remained has problem adwords general The nte ucs,we isaesalcmae obdes ha budgets, to compared small are bids when subcase, Another h e oteerslsi ipicto ftepoffrRA for proof the of simplification a is results these to key The 1 − k-TYPICAL admzdOln loihsfrAdwords for Online Randomized 1 e − 1 k  o hsproblem. this for , , k k ∈ egv admzdoln loih,aheigacompeti a achieving algorithm, online randomized a give We . Z + sflos h oa ugto l h idr ssufficient is bidders the all of budget total the follows: as , 1 nvriyo aiona Irvine California, of University ia .Vazirani V. Vijay MSVV07 Abstract .Frti ae egv notmlrandomized optimal an give we case, this For ]. 1 KVV90  1 − .Oragrtm o dod a be can adwords for algorithms Our ]. * 1 e 1  rvosagrtm o hscase this for algorithms Previous . tpcl ntne tlatfor least at instance, “typical” a n ob seen. be to ins KN,teotmlalgo- optimal the NKING, .W en subcase a define We d. eno considerable of been s ieratio tive obuy to k 1 Introduction

The adwords problem captures a key computational issue that arises in the context of ad auctions, for instance in Google’s AdWords marketplace. Informally, this problem involves matching key- word queries, as they arrive online, to advertisers having budget limits. For formal statements of problems studied in this paper, see Section 2; for the sake of brevity, they will not be repeated in this section. For its small bids case, called SMALL in this paper, an optimal algorithm achieving 1 a competitive ratio of 1 − e was first given in [MSVV07]; for the impact of this result in the marketplace, see 1.1. However, the general adwords problem (GENERAL) has remained largely  unresolved; see below for marginal progress made recently.

We define a special case of GENERAL, called adwords under typical bidders, k-TYPICAL, k ∈ Z+, as follows: the total budget of all bidders is sufficient to buy k bids for each bidder. Observe that our definition is less restrictive than requiring that the budget of each bidder is sufficient to buy k bids. Even the latter seems a reasonable assumption for a “typical” bidder1, at least for moderate values of k. We give a randomized online algorithm achieving a competitive ratio of 1 1 1 1 − e − k for this problem. For example, our ratio is 0.9 − e = 0.5321 for 10-TYPICAL and 0.99 − 1 = 0.6221 for 100-TYPICAL. e   The online bipartite matching (OBM) problem is a special case of GENERAL in which each bidder has a budget of $1 and the bids are 0/1. This problem has been of much consequence to theory and practice, see Sections 1.1 and 1.2. For OBM, a simple optimal randomized online algorithm, 1 called RANKING, was given in [KVV90]. Its competitive ratio is 1 − e and [KVV90] showed that no randomized online algorithm can achieve a better ratio than 1 − 1 + o(1); clearly, this  e upper bound applies to GENERAL as well.  The analysis of RANKING given in [KVV90] was considered “extremely difficult”. Over the years, several researchers contributed valuable ideas to simplifying its proof; indeed, our work would not have been possible without these ideas, see details in Section 1.2. Our paper starts by further simplifying the analysis, arriving at a proof that is suitable for a textbook2. Our simplification involves two main ideas, which are described in Section 1.3. These ideas turned out to be sufficiently powerful to give natural extensions of RANKING and its analysis to the following special cases of GENERAL, while still retaining its simplicity: k-TYPICAL and SMALL. Similar to the previous online algorithms for SMALL [MSVV07, BJN07], our algorithm is also op- 1 timal, with a competitive ratio of 1 − e . The difference lies in that the previous algorithms were obtained by viewing SMALL as a special case of b-matching, for which an optimal (deterministic)  algorithm, called BALANCE, was given in [KP00]. In turn, the algorithms of [MSVV07, BJN07] can we viewed as extensions of BALANCE; both are LP-duality-based and are deterministic, see Section 1.2 for further details. In contrast, our algorithm for SMALL builds directly on RANKING and is randomized. It is more elementary than the previous algorithms — the effective bid of each bidder j for a query wj−1 is simply its bid multiplied by its price pj = e , where wj, called the rank of j, is picked at

1It is highly unlikely that an advertiser would want to buy only two or three queries in a day, since that may not result in the sale of even one item. Furthermore, our definition allows such bidders, as long as the average is fine. 2For a textbook-style exposition, see [EIV22].

2 random from [0, 1]. Our new approach to SMALL is expected to provide new insights into this important problem. Will it also lead to new applications? That remains to be seen. For GENERAL, the greedy algorithm, which matches each query to the highest bidder, achieves a competitive ratio of 1/2. Until recently, that was the best possible. In [HZZ20] a marginally improved algorithm, with a ratio of 0.5016, was given. It is important to point out that this 60- page paper was a tour-de-force, drawing on a diverse collection of ideas — a testament to the difficulty of this problem. Part of the difficulty of GENERAL arises from an inherent structural issue, see Section 1.4. It turns out that these difficulties do not blend well with our proof technique, and as a result, the revenue generated by our algorithm needs to consist of real as well as “fake” money. Consequently, we are unable to ascertain the competitive ratio of our algorithm for GENERAL. However, for k- TYPICAL and SMALL, we manage to bound the fake money used, thereby giving the competitive ratio results mentioned above.

Remark 1. The objective of all adwords problems studied in this paper is to maximize the total revenue accrued by the online algorithm. In economics, such a solution is referred to as efficient, since the amount bid by an advertiser is indicative of how useful the query is to it, and hence to the economy.

1.1 Significance and Practical Impact Google’s AdWords marketplace generates multi-billion dollar revenues annually and the current annual worldwide spending on digital advertising is almost half a trillion dollars. These revenues of Google and other Internet services companies enable them to offer crucial services, such as search, email, videos, news, apps, maps etc. for free – services that have virtually transformed our lives. We note that SMALL is the most relevant case of adwords for the search ads marketplace. A remarkable feature of Google, and other search engines, is the speed with which they are able to show search results, often in milliseconds. In order to show ads at the same speed, together with search results, the solution for SMALL needed to be minimalistic in its use of computing power, memory and communication. The online algorithm of [MSVV07] satisfied these criteria and therefore had a substantial impact in this marketplace. Furthermore, the idea underlying their algorithm was extracted into a simple heuristic, called bid scaling, which uses even less computation and is widely used by search engine companies today. Our randomized algorithm for SMALL is equally minimalistic as mentioned above. It will be useful to view the AdWords marketplace in the context of a bigger revolution, namely the advent of the Internet and mobile computing, and the consequent resurgence of the area of matching-based market design. The birth of this area goes back to the seminal 1962 paper of Gale and Shapley on stable matching [GS62]. Over the decades, this area became known for its highly successful applications, having economic as well as sociological impact. These included matching medical interns to hospitals, students to schools in large cities, and kidney exchange.

3 The resurgence led to a host of highly innovative and impactful applications. Besides the Ad- Words marketplace, which matches queries to advertisers, these include Uber, matching drivers to riders; Upwork, matching employers to workers; and Tinder, matching people to each other, see [Ins19] for more details. A successful launch of such markets calls for economic and game-theoretic insights, together with algorithmic ideas. The Gale-Shapley deferred acceptance algorithm and its follow-up works provided the algorithmic backbone for the “first life” of matching-based market design. The algorithm RANKING has become the paradigm-setting algorithmic idea in the “second life” of this area. Interestingly enough, this result was obtained in the pre-Internet days, over thirty years ago.

1.2 Related Works We start by describing simplifications3 to the proof of RANKING for OBM. The first simplifica- tions, in [GM08, BM08], got the ball rolling, setting the stage for the substantial simplification given in [DJK13], using a randomized primal-dual approach. [DJK13] introduced the idea of splitting the contribution of each matched edge into primal and dual contributions and lower- bounding each part separately. Their method for defining prices pj of goods, using randomiza- tion, was used by subsequent papers, including this one4. Interestingly enough, the next simplification involved removing the scaffolding of LP-duality and casting the proof in purely probabilistic terms5, using notions from economics to split the contribution of each matched edge into the contributions of the buyer and the seller. This elegant analysis was given by [EFFS21]. We note that when we move to generalizations of OBM, even this economic interpretation needs to be dropped, see Remark 15. An important generalization of OBM is online b-matching. This problem is a special case of GENERAL in which the budget of each advertiser is $b and the bids are 0/1. [KP00] gave a simple optimal online algorithm, called BALANCE, for this problem. BALANCE awards the next query to the interested bidder who has been matched least number of times so far. [KP00] 1 showed that as b tends to infinity, the competitive ratio of BALANCE tends to 1 − e . The importance of online b-matching arises from the fact that it is a special case of SMALL, if b is large. Indeed, the first online algorithm [MSVV07] for SMALL was obtained by extending BALANCE as follows: [MSVV07] first gave a simpler proof of the competitive ratio of BALANCE using the notion of a factor-revealing LP [JMM+03]. Then they gave the notion of a tradeoff-revealing 1 LP, which yielded an algorithm achieving a competitive ratio of 1 − e . [MSVV07] also proved that this is optimal for b-matching, and hence SMALL, by proving that no randomized algorithm  can achieve a better ratio for online b-matching; previously, [KP00] had shown a similar result for deterministic algorithms. Following [MSVV07], a second optimal online algorithm for SMALL was given in [BJN07], using a primal-dual approach.

3Due difficulty of the subject matter, some of these papers have incorrect/missing proofs, etc.; however at this juncture, there is little point in going into these details. 4For a succinct proof of optimality of the underlying function, ex−1, see Section 2.1.1 in [HT22]. 5Even though there is no overt use of LP-duality in the proof of [EFFS21], it is unclear if this proof could have been obtained directly, without going the LP-duality-route.

4 Another relevant generalization of OBM is online vertex weighted matching, in which the of- fline vertices have weights and the objective is to maximize the weight of the matched vertices. [AGKM11] extended RANKING to obtain an optimal online algorithm for this problem. A spe- cial case of GENERAL in which bidders are single-valued is called SINGLE-VALUED, see Sec- tion 2 for a precise definition. Clearly, this problem is a generalization of online vertex weighted matching; moreover, it can be reduced to the latter by creating kj copies of each advertiser j. As observed by [AGKM11], via this reduction, their algorithm for online vertex weighted matching yields an optimal online algorithm for SINGLE-VALUED, see Section 1.3 for additional com- ments on this. In the decade following the conference version (FOCS 2005) of [MSVV07], search engine com- panies generously invested in research on models derived from OBM and adwords. Their moti- vation was two-fold: the substantial impact of [MSVV07] and the emergence of a rich collection of digital ad tools. It will be impossible to do justice to this substantial body of work, involving both algorithmic and game-theoretic ideas; for a start, see the surveys [Meh13, HT22]. However, we would like to mention one generalization of OBM, namely edge-weighted online bipartite matching, since it is similar to GENERAL in some respects. It also admits a straight- forward ratio 1/2 greedy algorithm, which was the best known until recently, and it also suffers from inherent structural difficulties mentioned in Section 1.4. The result of [FHTZ20]6 achieves a competitive ratio of 0.5086; for an improved ratio of 0.5368, see [BC21]. This problem has important applications to display advertising.

1.3 Technical Ideas Our simplification of the proof of RANKING is built on the following two ideas that go hand in hand. 1. For each edge e =(i, j) ∈ E in the underlying graph, G =(V, E), we run RANKING on the graph Ge, which is G with edge e removed, to determine where vertex i gets matched.

2. We define a new random variable, ue, called threshold, corresponding to each edge e = (i, j) ∈ E in the underlying graph, see Definition 8. We note that in contrast, all the previous papers analyzing RANKING, from [KVV90]to[EFFS21], run it on Gj, the graph with vertex j removed, for each choice of j. The proof of RANKING then needs additional facts, involving a complicated case-analyses. The difficulty we had in extending this scheme to more general problems led us to the simplification presented above. The key fact needed in the analysis of RANKING is that for any edge (i, j), its expected contri- bution is at least (1 − 1/e); this is established in Lemma 11. The proof of this fact crucially uses the threshold random variable for edge (i, j). As noted in Section 1.2, RANKING has been extended all the way to SINGLE-VALUED. Our goal is to extend it to GENERAL, and thereby address SMALL and k-TYPICAL. However, GENERAL is very different from SINGLE-VALUED in the following sense. Whereas the latter can be reduced to online vertex weighted matching, the former cannot. The reason is that the manner in which budget Bj of bidder j gets partitioned into bids is not predictable; it depending on the queries,

6Best Paper Award, FOCS 2020.

5 their order of arrival and the randomization executed in a run of the algorithm. Therefore, in order to solve GENERAL, we will first need to solve SINGLE-VALUED without reducing it to online vertex weighted matching. An immediate advantage is that such an algorithm for SINGLE-VALUED will require fewer random bits — only one random rank for each bidder j, as opposed one rank for each of the kj copies of j. A couple of new ideas are needed for analyzing Algorithm 17, for SINGLE-VALUED. First, since vertex j is not split into kj copies, we cannot talk about the contribution of edges anymore. E Instead, the notion of a j-star, Xj, is needed (see Definition 19), and its contribution, [Xj], needs E to be lower bounded. This involves lower bounding [rj], the expected revenue of j. Once again, since j is not split up, the total revenue rj, accrued by j, is accumulated in the same “account” each time j gets matched, over all randomizations of the algorithm. As a result, lower bounding E [rj] is not straightforward, see Lemma 21. Second, we need to modify threshold to the notion of truncated threshold, see Definition 18. Con- sider advertiser j in Algorithm 17. Observe that if j gets matched to query i in run R, then ui is 1 upper-bounded by bj · (1 − e ). On the other hand, in run Re, where e = (i, j), ui can be as large 1 as B · (1 − e ), where B = maxj∈A{bj}, thereby interfering with the conditioning needed for lower E 1 1 bounding [rj] in Lemma 21. We observe that in run Re, whenever ui ∈ [bj · (1 − e ), B · (1 − e )], 1 the contribution to rj is zero, thereby justifying truncating ue to bj · (1 − e ). Finally, Algorithm 26 for GENERAL needs to get around the structural difficulties mentioned in Section 1.4. The idea of “fake” money helps partially finesse this problem: On the one hand, by upper-bounding the fake money in the worst case, we obtain our results for k-TYPICAL and SMALL. On the other hand, since we cannot put an upper bound on the expected fake money used, we cannot obtain a competitive ratio for GENERAL; we leave this as an interesting open problem, see Section 7.

1.4 Structural Difficulties in GENERAL We first describe the inherent structural difficulties in the edge-weighted online bipartite match- ing problem. Competitive analysis demands that vertices coming online be matched irrevocably at the moment of their arrival. Via a well-chosen example, [FHTZ20] show that without violating irrevocability, a good ratio is not possible. They then appeal to the assumption of free disposal to obtain their result as follows. Their algorithm matches an advertiser to more than one impres- sion, if appropriate. However, at the end, it uses free disposal to dispose all but the heaviest matched edge incident at each advertiser, thereby obtaining a valid matching. To describe the structural difficulties in GENERAL, we provide three instances in Example 2. In order to obtain a completely unconditional result, we would need to adopt the following convention: assume bidder j has Lj money leftover and impression i just arrived. Assume that j’s bid for i is bid(i, j). If bid(i, j) > Lj, then j should not be allowed to bid for i, since j has insufficient money. Under this convention, it is easy to see that even a randomized algorithm will accrue only $W expected revenue on at least one of the instances given in Example 2, provided it is greedy, i.e., if a match is possible, it does not rescind this possibility; the latter condition is a simple way

6 of ensuring that the algorithm is “fine tuned” for a particular type of example. Note that the optimal for each instance is $2W.

Example 2. Let W ∈ Z+ be a large number. We define three instances of GENERAL, each having two bidders, b1 and b2, with budgets of $W each. Instances I1 and I2 have W + 1 queries, where for the first W queries, both bidders bid $1 each. For the last query, under I1, b1 bids $W and b2 is not interested. Under I2, b2 bids $W and b1 is not interested. Instance I3 has 2W queries and both bidders bid $1 for each of them. Therefore, to obtain a non-trivial competitive ratio, bidder j must be allowed to bid for i even if Lj < bid(i, j). This amounts to the use of free disposal, since j will be allowed to obtain query i for less money than its value for i. Next, let’s consider a second convention: if Lj < bid(i, j), then j will bid Lj for i. As stated in Remark 31, this convention is not supported by our proof technique, since Claim 29 fails to hold, breaking the proof of Lemma 28 and hence Lemma 30.

This led us to a third convention: if Lj < bid(i, j), then j will bid Lj real money and bid(i, j) − Lj “fake” money for i. As a result, the total revenue of the algorithm consists of real money as well as fake money; in Algorithm 26, these are denoted by W and Wf , respectively. The problem now is that Lemma 30, which compares the total revenue of the algorithm, namely W + Wf , with the optimal offline revenue, does not yield the competitive ratio of Algorithm 26. One saving grace is that our proof technique does present the opportunity of diminishing the amount of fake money used. These ideas are presented in Section 5.2. An exciting problem left E open is to place an upper bound on the fake money used, [Wf ], for the algorithm given in Section 5.2. This will yield the true competitive ratio of the algorithm. Remark 31 explains why our proof technique does not allow us to dispense with the use of fake money altogether. We note that when Algorithm 26 is run on instances of OBM, it reduces to RANKING. Therefore, it is indeed a (simple) extension of RANKING to GENERAL. Algorithm 26 does yield two useful results, namely competitive algorithms for k-TYPICAL and SMALL. Both involve bounding the fake money used in the worst case.

2 Preliminaries

Online Bipartite Matching (OBM): Let B be a set of n buyers and S a set of n goods. A bipartite graph G = (B, S, E) is specified on vertex sets B and S, and edge set E, where for i ∈ B, j ∈ S, (i, j) ∈ E if and only if buyer i likes good j. G is assumed to have a perfect matching and therefore each buyer can be given a unique good she likes. Graph G is revealed in the following manner. The n goods are known up-front. On the other hand, the buyers arrive one at a time, and when buyer i arrives, the edges incident at i are revealed. We are required to design an online algorithm A in the following sense. At the moment a buyer i arrives, the algorithm needs to match i to one of its unmatched neighbors, if any; if all of i’s neighbors are matched, i remains unmatched. The difficulty is that the algorithm does not “know” the edges incident at buyers which will arrive in the future and yet the size of the matching produced by the algorithm will be compared to the best off-line matching; the latter of course is a perfect matching. The formal measure for the algorithm is defined in Section 2.1.

7 General Adwords Problem (GENERAL): Let A be a set of m advertisers, also called bidders, and Q be a set of n queries. A bipartite graph G = (Q, A, E) is specified on vertex sets Q and A, and edge set E, where for i ∈ Q and j ∈ A, (i, j) ∈ E if and only if bidder j is interested in query i. Each query i needs to be matched7 to at most one bidder who is interested in it. For each edge (i, j), bidder j knows his bid for i, denoted by bid(i, j) ∈ Z+. Each bidder also has a budget Z Bj ∈ + which satisfies Bj ≥ bid(i, j), for each edge (i, j) incident at j. Graph G is revealed in the following manner. The m bidders are known up-front and the queries arrive one at a time. When query i arrives, the edges incident at i are revealed, together with the bids associated with these edges. If i gets matched to j, then the matched edge (i, j) is assigned a weight of bid(i, j). The constraint on j is that the total weight of matched edges incident at it be at most Bj. The objective is to maximize the total weight of all matched edges at all bidders. Adwords under Single-Valued Bidders (SINGLE-VALUED): SINGLE-VALUED is a special case Z of GENERAL in which each bidder j will make bids of a single value, bj ∈ +, for the queries he is interested in. If i accepts j’s bid, then i will be matched to j and the weight of this matched edge Z will be bj. Corresponding to each bidder j, we are also given kj ∈ +, the maximum number of times j can be matched to queries. The objective is to maximize the total weight of matched edges. Observe that the matching M found in G is a b-matching with the b-value of each query i being 1 and of advertiser j being kj. Adwords under Typical Bidders (k-TYPICAL): k-TYPICAL is a special case of GENERAL in which the total budget of all m bidders is sufficient to buy k bids for each bidder. The exact statement is a bit less stringent:

∑ Bj ≥ k · ∑ max {bid(i, j) − 1}. j∈A j∈A (i,j)∈E

Adwords under Small Bids (SMALL): SMALL is a special case of GENERAL in which for each bidder j, each bid of j is small compared to its budget. Formally, we will capture this condition by imposing the following constraint. For a valid instance I of SMALL, define

max(i,j)∈E {bid(i, j) − 1} µ(I)= max . j∈A ( Bj )

Then we require that lim µ(I)= 0, n(I)→∞ where n(I) denotes the number of queries in instance I.

2.1 The competitive ratio of online algorithms We will define the notion of competitive ratio of a randomized online algorithm in the context of OBM. 7Clearly, this is not a matching in the usual sense, since a bidder may be matched to several queries.

8 Algorithm 5. (Algorithm RANKING)

1. Initialization: Pick a random permutation, π, of the goods in S.

2. Online buyer arrival: When a buyer, say i, arrives, match her to the first unmatched good she likes in the order π; if none, leave i unmatched.

Output the matching, M, found.

Definition 3. Let G = (B, S, E) be a bipartite graph as specified above. The competitive ratio of a randomized algorithm A for OBM is defined to be:

E[A(G, ρ(B))] c(A)= min min , G=(B,S,E) ρ(B) n where E[A(G, ρ(B))] is the expected size of matching produced by A; the expectation is over the random bits used by A. We may assume that the worst case graph and the order of arrival of buyers, given by ρ(B), are chosen by an adversary who knows the algorithm. It is important to note that the algorithm is provided random bits after the adversary makes its choices.

Remark 4. For each problem studied in this paper, we will assume that the offline matching is complete. It is easy to extend the arguments, without changing the competitive ratio, in case the offline matching is not complete. As an example, this is done for OBM in Remark 14.

3 Online Bipartite Matching: RANKING

Algorithm 5 presents an optimal algorithm for OBM. Note that this algorithm picks a random 1 permutation of goods only once. Its competitive ratio is (1 − e ), as shown in Theorem 13. Furthermore, as shown in [KVV90], it is an optimal online bipartite matching algorithm: no randomized algorithm can do better, up to an o(1) term. We will analyze Algorithm 7 which is equivalent to Algorithm 5 and operates as follows. Before the execution of Step (1), the adversary determines the order in which buyers will arrive, say ρ(B). wj−1 In Step (1), each good j is assigned a price pj = e , where wj, called the rank of j, is picked at 1 random from [0, 1]; observe that pj ∈ [ e , 1]. In Step (2), buyers will arrive in the order ρ(B), picked by the adversary, and will be matched to the cheapest available good. With probability 1 all n prices are distinct and sorting the goods by increasing prices results in a random permutation. Furthermore, since Algorithm 7 uses this sorted order only and is oblivious of the actual prices, it is equivalent to Algorithm 5. As we will see, the random variables representing actual prices are crucially important as well – in the analysis. We remark that for the generalizations of OBM studied in this paper, the prices are used not only in the analysis, but also by the algorithms.

9 3.1 Analysis of RANKING We will use an economic setting for analyzing Algorithm 7 as follows. Each buyer i has unit-demand and 0/1 valuations over the goods she likes, i.e., she accrues unit utility from each good she likes, and she wishes to get at most one of them. The latter set is precisely the set of neighbors of i in G. If on arrival of i there are several of these which are still unmatched, i will pick one having the smallest price 8. Therefore the buyers will maximize their utility as defined below.

For analyzing this algorithm, we will define two sets of random variables, ui for i ∈ B and rj, for j ∈ S. These will be called utility of buyer i and revenue of good j, respectively. Each run of RANKING defines these random variables as follows. If RANKING matches buyer i to good j, then define ui = 1 − pj and rj = pj, where pj is the price of good j in this run of RANKING. Clearly, pj is also a random variable, which is defined by Step (1) of the algorithm. If i remains unmatched, define ui = 0, and if j remains unmatched, define rj = 0. Observe that for each good 1 1 j, pj ∈ [ e , 1] and for each buyer i, ui ∈ [0, 1 − e ]. Let M be the matching produced by RANKING and let random variable |M| denote its size.

A key idea in the analysis of Algorithm 7 is a new random variable, ue, for each edge e ∈ E of graph G. This is called the threshold for edge e and is given in Definition 8. Lemma 6 pulls apart the contribution of each matched edge (i, j) into ui and rj. Next, using the threshold, we established in Lemma 11 that for each edge (i, j) in the graph, the total expected contribution of 1 ui and rj is at least 1 − e . Then, linearity of expectation allows us to reassemble the 2n terms in the right hand side of Lemma 6 so they are aligned with a perfect matching in G, and this yields Theorem 13.

Lemma 6. n n E E E [|M|] = ∑ [ui] + ∑ [rj]. i j

Proof. By definition of the random variables,

n n n n E E E E [|M|] = ∑ ui + ∑ rj = ∑ [ui] + ∑ [rj ], "i=1 j=1 # i j where the first equality follows from the fact that if (i, j) ∈ M then ui + rj = 1 and the second follows from linearity of expectation.

While running Algorithm 7, assume that the adversary has picked the order of arrival of buyers, say ρ(B), and Step (1) has been executed. We next define several ways of executing Step (2). Let R denote the run of Step (2) on the entire graph G. Corresponding to each edge e ∈ E, let Ge denote graph G with edge e removed. Define Re to be the run of Step (2) on graph Ge.

Definition 8. Let e = (i, j) ∈ E be an arbitrary edge in G. Define random variable, ue, called the 1 threshold for edge e, to be the utility of buyer i in run Re. Clearly, ue ∈ [0, 1 − e ].

8As stated above, with probability 1 there are no ties.

10 Algorithm 7. (Algorithm RANKING: Economic Viewpoint)

1. Initialization: ∀j ∈ S: Pick wj independently and uniformly from [0, 1]. wj−1 Set price pj ← e .

2. Online buyer arrival: When a buyer, say i, arrives, match her to the cheapest un- matched good she likes; if none, leave i unmatched.

Output the matching, M, found.

Lemma 9. Corresponding to each edge (i, j) ∈ E, the following hold.

1. ui ≥ ue, where ui and ue are the utilities of buyer i in runs R and Re, respectively. 1 < 2. Let z ∈ [0, 1 − e ]. Conditioned on ue = z, if pj 1 − z, then j will definitely be matched in run R.

Proof. 1). Clearly, the two runs R and Re are identical before the arrival of buyer i. In case j is already matched before the arrival of buyer i, the set of unmatched edges incident at i are identical in R and Re and therefore, ui = ue. Otherwise, in R, i will have an additional available edge (i, j), and therefore ui ≥ ue.

2). Conditioned on ue = z, the best bid that i gets, outside of the bid of j, has value z. Assume that pj < 1 − z. If j is not yet matched when i arrives, then the best bid that i gets is that from j, of value 1 − pj > z. Therefore, i will get matched to j. Hence j will definitely be matched in run R.

Remark 10. The random variable ue is called threshold because of the second statement of Lemma 9. It defines a value such that whenever pj is smaller than this value, j is definitely matched in run R.

The intuitive reason for the next, and most crucial, lemma is the following. The smaller ue is, the larger is the range of values for pj, namely [0, 1 − ue), over which (i, j) will be matched and j E will accrue revenue of pj. Integrating pj over this range, and adding [ui] to it, gives the desired bound.

Lemma 11. Corresponding to each edge (i, j) ∈ E,

1 E[u + r ] ≥ 1 − . i j e E E Proof. By the first part of Lemma 9, [ui] ≥ [ue]. E 1 Next, we will lower bound [rj]. Let z ∈ [0, 1 − e ] and let us condition on the event ue = z. By the second part of Lemma 9, rj = pj whenever pj < 1 − z. We will ignore the contribution to E w−1 [rj] when pj ≥ 1 − z. Let w be s.t. e = 1 − z.

11 When pj < 1 − z, the random variable rj is defined as follows: pick x uniformly at random from x−1 [0, w) and let rj be e . Therefore,

w 1 1 E[r | u = z] ≥ ex−1 dx = ew−1 − = 1 − − z. j e e e Z0

1 Let fZ(z) be the probability density function of ue; clearly, fZ(z)= 0 for z ∈/ [0, 1 − e ]. Therefore,

1−1/e E E E E [rj] = [ [rj | ue]] = [rj | ue = z] · fZ(z)dz Zz=0 1−1/e 1 1 ≥ 1 − − z · f (z)dz = 1 − − E[u ], e Z e e Zz=0   where the first equality follows from the law of total expectation and the inequality follows from E fact that we have ignored the contribution to [rj | ue] when pj ≥ 1 − z. Hence we get

1 E[u + r ]= E[u ]+ E[r ] ≥ 1 − . i j i j e

Remark 12. Observe that Lemma 11 is not a statement about i and j getting matched to each other, but about the utility accrued by i and the revenue accrued by j by being matched to various goods and buyers, respectively, over the randomization executed in Step (1) of Algorithm 7.

1 Theorem 13. The competitive ratio of RANKING is at least 1 − e .

Proof. Let P denote a perfect matching in G. The expected size of matching produced by RANK- ING is n n 1 E [|M|] = ∑ E [u ] + ∑ E[r ] = ∑ E[u + r ] ≥ n 1 − , i j i j e i j (i,j)∈P   where the first equality uses Lemma 6, the second follows from linearity of expectation and the inequality follows from Lemma 11 and the fact that |P| = n. The theorem follows.

Remark 14. In case G does not have a perfect matching, let P denote a maximum matching in G, E E of size k, say. Then summing [ui] and [rj ] over the the vertices i and j matched by P, we get 1 that the expected size of matching produced by RANKING is at least k 1 − e .  4 Algorithm for SINGLE-VALUED

Algorithm 17, which will be denoted by A2, is an online algorithm for SINGLE-VALUED. Before execution of Step (1) of A2, the order of arrival of queries, say ρ(B), is fixed by the adversary. In 1 Step (1), for each bidder j, A2 picks a price pj ∈ [ e , 1] via the specified randomized process. Fur- thermore, the revenue rj and degree dj of bidder j are both initialized to zero, the latter represents the number of times j has been matched. During the run of A2, j will get matched to at most kj

12 queries, with each match adding bj to the revenue of the algorithm. bj is broken into a revenue and a utility component, with the former being added to rj and the latter forming ui. At the end of A2, rj will contain all the revenue accrued by j.

In Step (2), on the arrival of query i, each bidder j makes a bid if (i, j) ∈ E and dj < kj. The 1 effective bid of j for i is defined to be ebid(i, j) = bj · (1 − pj); clearly, ebid(i, j) ∈ [0, bj · 1 − e ]. Query i accepts the bidder whose effective bid is the largest. If there are no bids, matching M  remains unchanged. If i accepts j’s bid, then edge (i, j) is added to matching M and the weight of this edge is set to bj. Furthermore, the utility of i, ui, is defined to be ebid(i, j) and the revenue rj of j is incremented by bj · pj. Once all queries are processed, matching M and its weight W are output.

Remark 15. The economics-based names of random variables used in our proof of RANKING come from [EFFS21]. Although we use the same names for similar random variables in Sections 4 and 5, for SINGLE-VALUED and GENERAL, they don’t have any economic interpretation in the new contexts9.

4.1 Analysis of Algorithm 17

For the analysis of Algorithm A2, we will use the random variables W, pj, rj and ui defined above; their values are fixed during the execution of A2. In addition, corresponding to each edge e = (i, j) ∈ E, in Definition 18, we will introduce a new random variable, ue, which will play a central role.

Lemma 16. n m E E E [W] = ∑ [ui] + ∑ [rj]. i j

Proof. For each edge (i, j) ∈ M, its contribution to W is bj. Furthermore, the sum of ui and the contribution of (i, j) to rj is also bj. This gives the first equality below. The second equality follows from linearity of expectation.

n m n m E E E E [W] = ∑ ui + ∑ rj = ∑ [ui] + ∑ [rj], "i=1 j=1 # i j

While running Algorithm 17, assume Step (1) has been executed. We next define several ways of executing Step (2). Let R denote the run of Step (2) on the entire graph G. Corresponding to each edge e ∈ E, let Ge denote graph G with edge e removed. Define Re to be the run of Step (2) on graph Ge.

9We failed to come up with meaningful names for these random variables and therefore stuck to the old names.

13 Algorithm 17. (A2: Algorithm for SINGLE-VALUED)

1. Initialization: M ← ∅. ∀j ∈ A, do: wj−1 (a) Pick wj uniformly from [0, 1] and set price pj ← e . (b) rj ← 0. (c) dj ← 0.

2. Query arrival: When query i arrives, do: (a) ∀j ∈ A s.t. (i, j) ∈ E and dj < kj do: i. ebid(i, j) ← bj · (1 − pj). ii. Offer effective bid of ebid(i, j) to i. (b) Query i accepts the bidder whose effective bid is the largest. (If there are no bids, matching M remains unchanged.) If i accepts j’s bid, then do: i. Set utility: ui ← bj · (1 − pj). ii. Update revenue: rj ← rj + bj · pj. iii. Update degree: dj ← dj + 1. iv. Update matching: M ← M ∪ (i, j). Define the weight of (i, j) to be bj. (c) Output: Output matching M and its total weight W.

Definition 18. Let e =(i, j) ∈ E be an arbitrary edge in G. Define random variable, ue, called the 1 truncated threshold for edge e, to be ue = min{ui, bj · 1 − e }, where ui is the utility of buyer i in run R . e 

Definition 19. Let j ∈ A. Henceforth, we will denote kj by k in order to avoid triple subscripts. Let i1,..., ik be queries such that for 1 ≤ l ≤ k, (il, j) ∈ E. Then (j; i1,..., ik) is called a j-star. Let E E ∑k E Xj denote this j-star. The contribution of Xj to [W] is [rj]+ l=1 [uil ], and it will be denote E by [Xj].

Corresponding to j-star Xj = (j; i1,..., ik), denote by el the edge (il, j) ∈ E, for 1 ≤ l ≤ k.

Furthermore, let uel denote the truncated threshold random variable corresponding to el.

Lemma 20. Corresponding to j-star Xj =(j; i1,..., ik), the following hold.

• For 1 ≤ l ≤ k, uil ≥ uel .

Proof. Clearly, the two runs R and Re are identical before the arrival of buyer il. In case j is fully matched before the arrival of buyer il, the set of unmatched edges incident at i are identical in

R and Re and therefore, uil = uel . Otherwise, in run R, i will have the additional edge (i, j) available and therefore uil ≥ uel .

Our next goal is to lower bound the contribution of an arbitrary j-star, as stated in Lemma 21.

14 Lemma 21. Let j ∈ A and let Xj =(j; i1,..., ik) be a j-star. Then 1 E[X ] ≥ k · b · 1 − . j j e   E Proof. We will first lower bound [rj ]. Let fZ(bj · z1,... bj · zk) be the joint probability density 1 function of (ue1 ,... uek ); clearly, fZ(bj · z1,... bj · zk) can be non-zero only if zl ∈ [0, 1 − e ], for 1 ≤ l ≤ k. By the law of total expectation,

E E [rj] = [rj | ue1 = bj · z1,..., uek = bj · zk] · fZ(bj · z1,... bj · zk) dz1 ... dzk, Z(z1,...,zk) 1 where the integral is over zl ∈ [0, 1 − e ], for 1 ≤ l ≤ k.

wl −1 For lower-bounding the conditional expectation in this integral, let wl ∈ [0, 1] be s.t. e = 1 − zl, for 1 ≤ l ≤ k. For x ∈ [0, 1], define the set S(x)= {l | 1 ≤ l ≤ k and x < wl}.

x−1 Claim 22. Conditioned on (ue1 = bj · z1,..., uek = bj · zk), if pj = e , then the degree of j at the end of Algorithm A2 is at least |S(x)|, i.e., the contribution to rj in this run was ≥ bj · pj · |S(x)|. < Proof. Suppose l ∈ S(x), then x wl. In run Rel , the maximum effective bid that il received has value bj · zl. In run R, if at the arrival of query il, j is already fully matched, the contribution to rj in this run was k · bj · pj and the claim is obviously true. If not, then since x < wl, 1 − pj < zl. Therefore, query il will receive its largest effective bid from j. Hence, il will get matched to j and rj will be incremented by bj · pj. The claim follows.

For 1 ≤ l ≤ k, define indicator functions Il : [0, 1] → {0, 1} as follows.

1 if x < wl, Il(x) = (0 otherwise.

k Clearly, |S(x)| = ∑l=1 Ij(x). By Claim 22,

1 E x−1 [rj | ue1 = bj · z1,..., uek = bj · zk] ≥ bj · |S(x)| · e dx Z0

1 k k 1 k wl x−1 x−1 x−1 = bj · ∑ Il(x) · e dx = bj · ∑ Il(x) · e dx = bj · ∑ e dx Z0 l=1 l=1 Z0 l=1 Z0

k 1 k 1 wl −1 = bj · ∑ e − = bj · ∑ 1 − − z . e e l l=1   l=1  

1 x−1 wl x−1 Above, we have used the fact that 0 Il(x) · e dx = 0 e dx. This holds because Il(x)= 0 for x ∈ [w , 1]. Therefore, l R R E E [rj ] = [rj | ue1 = bj · z1,..., uek = bj · zk] · fZ(bj · z1,... bj · zk) dz1 ... dzk Z(z1,...,zk)

15 k 1 ≥ bj · ∑ 1 − − z · fZ(bj · z1,... bj · z ) dz1 ... dz e l k k Z(z1,...,zk) l=1  

k 1 E = k · bj · 1 − − ∑ [ue ], e l   l=1 1 where both integrals are over zl ∈ [0, 1 − e ], for 1 ≤ l ≤ k. E E By Lemma 20, [uil ] ≥ [uel ], for 1 ≤l ≤ k. Hence we get

k E E E 1 [Xj] = [rj ]+ ∑ [ui ] ≥ k · bj · 1 − , l e l=1  

1 Theorem 23. The competitive ratio of Algorithm A2 is at least 1 − e .

Proof. Let P denote a maximum weight b-matching in G, computed in an offline manner. By the assumption made in Remark 4, its weight is

m w(P)= ∑ kj · bj. j=1

Let Tj denote the j-star, under P, corresponding to each j ∈ A. The expected weight of matching produced by A2 is

n m m m E E E E 1 1 [W] = ∑ [ui] + ∑ [rj ] = ∑ [Tj] ≥ ∑ bj · kj 1 − = 1 − · w(P), e e i=1 j=1 j=1 j=1     where the first equality uses Lemma 6, the second follows from linearity of expectation and the inequality follows from Lemma 21. The theorem follows.

5 Algorithm for GENERAL

Algorithm 26, which will be denoted by A3, is an attempt an online algorithm for GENERAL. As stated in Section 1.4, because of the use of fake money, we will not be able to give a competitive ratio for it, instead, in Lemma 30, we will compare the sum of real and fake money spent by the algorithm with the real money spent by an optimal offline algorithm. Z In algorithm A3, Lj ∈ + will denote bidder j’s leftover budget; it is initialized to Bj. At the arrival of query i, bidder j will bid for i if (i, j) ∈ E and Lj > 0. In general, i will receive a number of bids. The exact procedure used by i to accept one of these bids is given in algorithm A3; its steps are self-explanatory. If i accepts j’s bid then i is matched to j, the edge (i, j) is assigned a weight of bid(i, j) and Lj is decremented by min{Lj, bid(i, j)}.

Note that we do not require that there is sufficient left-over money, i.e., Lj ≥ bid(i, j), for j to bid for i. In case Lj < bid(i, j) and i accepts j’s bid, then bid(i, j) − Lj of the money paid by j for i is

16 fake money; this will be accounted for by incrementing Wf by bid(i, j) − Lj. The rest, namely Lj, is real money and is added to W. If bid(i, j) ≥ Lj and i accepts j’s bid, then Lj becomes zero and j does not bid for any future queries. At the end of the algorithm, random variable W denotes the total real money spent and Wf denotes the total fake money spent. The offline optimal solution to this problem is defined to be a matching of queries to advertisers that maximizes the weight of the matching; this is done with full knowledge of graph G. As stated in Remark 4, we will assume that under such a matching, P, the budget Bj of each bidder m j is fully spent, i.e., w(P)= ∑j=1 Bj.

5.1 Analysis of Algorithm 26 Lemma 24. n m E E E [W + Wf ] = ∑ [ui] + ∑ [rj ]. i j

Proof. For each edge (i, j) ∈ M, its contribution to W + Wf is bid(i, j). Furthermore, the sum of ui and the contribution of (i, j) to rj is also bid(i, j). This gives the first equality below. The second equality follows from linearity of expectation.

n m n m E E E E [W + Wf ] = ∑ ui + ∑ rj = ∑ [ui] + ∑ [rj], "i=1 j=1 # i j

Lemma 20 carries over and Definition 18 needs to be modified to the following.

Definition 25. Let e = (i, j) ∈ E be an arbitrary edge in G. Define random variable, ue, called 1 the truncated threshold for edge e, to be ue = min{ui, bid(i, j) · 1 − e }, where ui is the utility of query i in run R . e 

Definition 19 needs to be changed to the following.

Definition 27. Let j ∈ A. Let i1,..., ik be queries such that for 1 ≤ l ≤ k, (il, j) ∈ E and k ∑l=1 bid(il , j)= Bi. Then (j; i1,..., ik) is called a Bj-star. Let Xj denote this Bj-star. The contribu- E E ∑k E E tion of Xj to [W] is [rj]+ l=1 [uil ], and it will be denote by [Xj].

Corresponding to Bj-star Xj = (j; i1,..., ik), denote by el the edge (il , j) ∈ E, for 1 ≤ l ≤ k.

Furthermore, let uel denote the truncated threshold random variable corresponding to el.

Lemma 28. Let j ∈ A and let Xj =(j; i1,..., ik) bea Bj-star. Then

1 E[X ] ≥ B · 1 − . j j e  

17 Algorithm 26. (A3: Algorithm for GENERAL)

1. Initialization: M ← ∅, W ← 0 and Wf ← 0 ∀j ∈ A, do: wj−1 (a) Pick wj uniformly from [0, 1] and set price pj ← e . (b) rj ← 0. (c) Lj ← Bj.

2. Query arrival: When query i arrives, do: (a) ∀j ∈ A s.t. (i, j) ∈ E and Lj > 0 do: i. ebid(i, j) ← bid(i, j) · (1 − pj). ii. Offer effective bid of ebid(i, j) to i. (b) Query i accepts the bidder whose effective bid is the largest. (If there are no bids, matching M remains unchanged.) If i accepts j’s bid, then do: i. Set utility: ui ← bid(i, j) · (1 − pj). ii. Update revenue: rj ← rj + bid(i, j) · pj. iii. Update matching: M ← M ∪ (i, j). iv. Update weight: W ← min{Li, bid(i, j)} and Wf ← max{0, bid(i, j) − Li}. v. Update Lj: Lj ← Lj − min{Lj, bid(i, j)}. 3. Output: Output matching M, real money spent W, and fake money spent Wf .

E Proof. We will first lower bound [rj]. Let fZ(bid(i1, j) · z1, ... ,bid(ik, j) · zk) be the joint proba- bility density function of (ue1 ,... uek ); clearly, fZ(bid(i1, j) · z1, ... ,bid(ik, j) · zk) can be non-zero 1 only if zl ∈ [0, 1 − e ], for 1 ≤ l ≤ k. E By the law of total expectation, [rj ]=

E [rj | ue1 = bid(i1, j) · z1,..., uek = bid(ik, j) · zk] · fZ(bid(i1, j) · z1,...bid(ik, j) · zk) dz1 ... dzk, Z(z1,...,zk) 1 where the integral is over zl ∈ [0, 1 − e ], for 1 ≤ l ≤ k.

wl −1 For lower-bounding the conditional expectation in this integral, let wl ∈ [0, 1] be s.t. e = 1 − zl, for 1 ≤ l ≤ k. Let x ∈ [0, 1]. For1 ≤ l ≤ k, define indicator functions Il : [0, 1] → {0, 1} as follows. 1 if x < wl, Il(x) = (0 otherwise.

Furthermore, define k V(x)= ∑ Il(x) · bid(il, j). l=1

x−1 Claim 29. Conditioned on (ue1 = bid(i1, j) · z1,..., uek = bid(ik, j) · zk), if pj = e , where x ∈ [0, 1], then the contribution to rj in this run of algorithm A3 was ≥ pj · V(x).

18 < Proof. Suppose Il(x)= 1, then x wl. In run Rel , the maximum effective bid that il received has value bid(il, j) · zl. In run R, if on the arrival of query il, Lj = 0, i.e., j is already fully matched, then the contribution to rj in this run was Bj · pj and the claim is obviously true. If Lj > 0, then since x < wl, 1 − pj < zl. Therefore, query il will receive its largest effective bid from j. Hence, il will get matched to j and rj will be incremented by bid(il, j) · pj. The claim follows.

By Claim 29,

1 E x−1 [rj | ue1 = bid(i1, j) · z1,..., uek = bid(ik, j) · zk] ≥ V(x) · e dx Z0

k 1 k wl x−1 x−1 = ∑ bid(il, j) · Il (x) · e dx = ∑ bid(il, j) · e dx l=1 Z0 l=1 Z0

k 1 k 1 wl −1 = Bj · ∑ e − = Bj · ∑ 1 − − z . e e l l=1   l=1   E Therefore, [rj ] =

E [rj | ue1 = bid(i1, j) · z1,..., uek = bid(ik, j) · zk] · fZ(bid(i1, j) · z1,...bid(ik, j) · zk) dz1 ... dzk, Z(z1,...,zk)

k 1 ≥ B · ∑ 1 − − z · fZ(bid(i , j) · z ,...bid(i , j) · z ) dz ... dz j e l 1 1 k k 1 k Z(z1,...,zk) l=1  

k 1 E = Bj · 1 − − ∑ [ue ]. e l   l=1 E E By Lemma 20, [uil ] ≥ [uel ], for 1 ≤ l ≤ k. Hence we get

k E E E 1 [Xj] = [rj]+ ∑ [ui ] ≥ = Bj · 1 − , l e l=1  

Lemma 30. Algorithm A3 satisfies

1 E W + W ≥ 1 − · w(P). f e     Proof. Let P denote a maximum weight b-matching in G. By the assumption made in Remark 4, its weight is m w(P)= ∑ Bj. j=1

19 Let Tj denote the j-star, under P, corresponding to each j ∈ A. The expected weight of matching produced by A3 is

n m m m E E E E 1 1 W + W = ∑ [ui] + ∑ [rj] = ∑ [Tj] ≥ ∑ Bj · 1 − = 1 − · w(P), f e e i=1 j=1 j=1 j=1       where the first equality uses Lemma 6, the second follows from linearity of expectation and the inequality follows by using Lemma 28.

5.2 Using Less “Fake” Money

In Step 2(b) of Algorithm 26, suppose query i is matched to j and at that point, Lj < bid(i, j). Then, in that step, bid(i, j) − Lj fake money is distributed to rj and ui. In this section, we show how to decrease the amount of fake money spent, while still ensuring the statement of Lemma 30. The decrease in the amount of fake money spent is attributed to the use of free disposal, see Section 1.4. Modify Step 2(b)(ii) of Algorithm 26 to the following.

rj ← rj + pj · min{Lj, bid(i, j)}

As a result, rj is always paid by real money. In particular, if Lj < bid(i, j), then by the modification given above, the money added to rj is pj fraction of Lj and not bid(i, j). Observe however, that in Step 2(b)(i), ui is still set to bid(i, j) · (1 − pj). Of the latter, (bid(i, j) − Lj) · (1 − pj) is fake money, which needs to be added to Wf . For this purpose, we need to modify Step 2(b)(iv) of Algorithm 26 to the following. Wf ← max{0, (1 − pj) · min{Lj, bid(i, j)}}.

The only change needed in the proof is in Claim 29. The last case, Lj > 0, now needs to be split into two further cases: Case 1: If Lj ≥ bid(i, j) then the proof given holds.

Case 2: If Lj < bid(i, j) then observe that only Lj · pj needs to be added to rj for the claim to hold. That is precisely the amount added in the modified Step 2(b)(ii) given above.

Note that we did not change Step 2(b)(i), which sets ui to bid(i, j) · (1 − pj). As a result, the proof of Lemma 28 remains unchanged. Overall, the amount of fake money distributed drops from bid(i, j) − Lj to (bid(i, j) − Lj) · (1 − pj). The proof of Lemma 30 also remains unchanged.

Remark 31. Let us consider the following two avenues for dispensing with the use of fake money altogether; we will show places where our proof technique breaks down for each one. Assume Lj < bid(i, j).

1. Why not modify Step 2 of Algorithm 26 so that j’s bid for i is taken to be Lj instead of bid(i, j)?

2. Why not modify Step 2(b)(i) so it sets ui to Lj · (1 − pj) rather than Bj · (1 − pj)

20 Under the first avenue, we cannot ensure ui ≥ ue, since it may happen that ue > Lj · (1 − pj )= ui. E E The condition ui ≥ ue is used for deriving [ui] ≥ [ue], which is essential in the proof of Lemma 28. To make the second avenue work, the proof of Claim 29 would need to be changed as follows: the last case, Lj > 0, will need to be split into the two cases given above. However, under Case 2, which applies if Lj < bid(i, j), even though pj < p, the largest effective bid that query il receives may not be the one from j, since the effective bid of j has value Lj · (1 − pj) < bid(il, j) · (1 − pj). Therefore, il may not get matched to j, thereby invalidating Claim 29.

6 k-TYPICAL and SMALL

We will use Lemma 30 to show that Algorithm 26 yields algorithms for k-TYPICAL and for SMALL, by upper bounding the fake money used in the worst case; we leave open the question of upper bounding the expected fake money used.

1 1 Theorem 32. Algorithm A3 achieves a competitive ratio of 1 − e − k for k-TYPICAL.  Proof. The worst case for the amount of fake money used by bidder j is the following. At some point in the algorithm, bidder j has $1 left and needs to make a bid of max(i,j)∈E{bid(i, j)}, thereby spending max(i,j)∈E{bid(i, j)}− 1 fake money. Therefore, in the worst case, the total fake money spent 1 w(P) Wf ≤ ∑ max {bid(i, j) − 1} ≤ · ∑ Bj ≤ , j∈A (i,j)∈E k j∈A k where the second inequality follows from the definition of k-TYPICAL. Now, by Lemma 30,

1 1 1 E[W] ≥ 1 − · w(P) − E[W ] ≥ 1 − − · w(P). e f e k    

Theorem 33. Algorithm A3 is an optimal online algorithm for SMALL.

Proof. Let I be an instance of SMALL. As in the proof of Theorem 32,

Wf ≤ ∑ max {bid(i, j) − 1} j∈A (i,j)∈E

Therefore,

max(i,j)∈E {bid(i, j) − 1} ∑j∈A max(i,j)∈E {bid(i, j) − 1} Wf µ(I)= max ≥ ≥ , j∈A ( Bj ) ∑j∈A Bj w(P) where µ(I) is defined in Section 2. Now, by definition of SMALL,

lim µ(I)= 0, n(I)→∞

21 where n(I) denotes the number of queries in instance I. Therefore Wf lim = 0. n(I)→∞ w(P) The theorem follows from Lemma 30.

7 Discussion

We leave open the difficult and exciting problem of placing a good upper bound on the fake E money, [Wf ], used by the algorithm given in Section 5.2. This will yield the competitive ratio of our algorithm for GENERAL and an improved competitive ratio for k-TYPICAL. Of course, the even more difficult problem, of obtaining an optimal online algorithm for GENERAL, also remains open.

References

[AGKM11] Gagan Aggarwal, Gagan Goel, Chinmay Karande, and Aranyak Mehta. Online vertex-weighted bipartite matching and single-bid budgeted allocations. In Proceed- ings of the twenty-second annual ACM-SIAM symposium on Discrete Algorithms, pages 1253–1264, 2011. [BC21] Guy Blanc and Moses Charikar. Multiway online correlated selection. arXiv preprint arXiv:2106.05579, 2021. [BJN07] Niv Buchbinder, Kamal Jain, and Joseph Seffi Naor. Online primal-dual algorithms for maximizing ad-auctions revenue. In European Symposium on Algorithms, pages 253–264, 2007. [BM08] Benjamin Birnbaum and Claire Mathieu. On-line bipartite matching made simple. ACM Sigact News, 39(1):80–87, 2008. [DJK13] Nikhil R Devanur, Kamal Jain, and Robert D Kleinberg. Randomized primal-dual analysis of ranking for online bipartite matching. In Proceedings of the twenty-fourth annual ACM-SIAM symposium on Discrete algorithms, pages 101–107. SIAM, 2013. [EFFS21] Alon Eden, Michal Feldman, Amos Fiat, and Kineret Segal. An economic-based analysis of ranking for online bipartite matching. In SIAM Symposium on Simplicity in Algorithms, 2021. [EIV22] Federico Echenique, Nicole Immorlica, and Vijay V. Vazirani. One-sided matching markets. In Federico Echenique, Nicole Immorlica, and Vijay V. Vazirani, editors, On- line and Matching-Based Market Design. Cambridge University Press, 2022. [To appear] https://www.ics.uci.edu/~vazirani/Chapter2.pdf. [FHTZ20] Matthew Fahrbach, Zhiyi Huang, Runzhou Tao, and Morteza Zadimoghaddam. Edge-weighted online bipartite matching. In 2020 IEEE 61st Annual Symposium on Foundations of Computer Science (FOCS), pages 412–423, 2020.

22 [GM08] Gagan Goel and Aranyak Mehta. Online budgeted matching in random input models with applications to adwords. In SODA, volume 8, pages 982–991, 2008. [GS62] David Gale and Lloyd S Shapley. College admissions and the stability of marriage. The American Mathematical Monthly, 69(1):9–15, 1962. [HT22] Zhiyi Huang and Thorben Trobst. Online matching. In Federico Echenique, Nicole Immorlica, and Vijay V. Vazirani, editors, Online and Matching-Based Market Design. Cambridge University Press, 2022. [To appear] https://www.ics.uci.edu/~vazirani/Ch4.pdf. [HZZ20] Zhiyi Huang, Qiankun Zhang, and Yuhao Zhang. Adwords in a panorama. In 2020 IEEE 61st Annual Symposium on Foundations of Computer Science (FOCS), pages 1416– 1426. IEEE, 2020. [Ins19] Simons Institute. Online and matching-based market design, 2019. https://simons.berkeley.edu/programs/market2019. [JMM+03] Kamal Jain, Mohammad Mahdian, Evangelos Markakis, Amin Saberi, and Vijay V Vazirani. Greedy facility location algorithms analyzed using dual fitting with factor- revealing LP. Journal of the ACM (JACM), 50(6):795–824, 2003. [KP00] Bala Kalyanasundaram and Kirk R Pruhs. An optimal deterministic algorithm for online b-matching. Theoretical Computer Science, 233(1-2):319–325, 2000. [KVV90] Richard M Karp, Umesh V Vazirani, and Vijay V Vazirani. An optimal algorithm for on-line bipartite matching. In Proceedings of the twenty-second annual ACM symposium on Theory of computing, pages 352–358, 1990. [Meh13] Aranyak Mehta. Online matching and ad allocation. 2013. [MSVV07] Aranyak Mehta, Amin Saberi, , and Vijay Vazirani. Adwords and generalized online matching. Journal of the ACM (JACM), 54(5), 2007.

23