1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
Online Weighted Bipartite Matching with Capacity ConstraintsHao Wang, Zhenzhen Yan, Xiaohui Bei
Nanyang Technological UniversitySingapore
ABSTRACTWe investigate an online edge-weighted bipartite matching problemwith capacity constraints. In this problem, the supply vertices areoffline with different capacities. Demand vertices arrive online andeach consumes a certain amount of resources. The goal is to maxi-mize the total weight of the matching. This framework can captureseveral real-world applications such as the trip-vehicle assignmentproblem in ridesharing. We model the offline optimization problemas a deterministic linear program and provide several randomizedonline algorithms based on the solution to the offline linear pro-gram. We analyze the performance guarantee of each algorithmmeasured by its competitive ratio. Importantly, we introduce a re-solving heuristic that periodically re-computes the offline linearprogram and uses the updated offline solution to guide the onlinealgorithm decisions. We find that the algorithm’s competitive ratiocan be improved when re-solving at carefully selected time steps. Fi-nally, we investigate the value of the demand distribution in furtherimproving the algorithm efficiency.
KEYWORDSonline bipartite matching, randomized algorithm, re-solving heuris-tic, competitive ratio
1 INTRODUCTIONIn a typical online bipartite matching problem, requests arrive se-quentially following some probability distribution. Upon the arrivalof each request, a decision has to be made to either match the re-quest to an appropriate resource, or reject it. If the request getsmatched, it consumes a certain amount of resources. Resourcescan be replenishable or non-replenishable. Each match made be-tween the request and the resource generates a profit. The goal isto maximize the total profit generated from all matches.
The online bipartite matching has been widely applied to var-ious resource allocation problems. Examples include airline seatallocation, clinic appointment slot allocation, and car allocation inthe online ride hitch problem. Particularly, ride hitch is a recentinnovation of ride sharing. It refers to a mode of transportation inwhich private car drivers offer to share their journeys to multiplepassengers based on coordination through a centralized dispatch.For example, drivers may share part of their ride on the way towork with other passengers who have similar itineraries, and thedrivers will receive remuneration to compensate the petrol andlabor costs. An example is the grab hitch service launched by Grabin 2015, the leading super app in Southeast Asia. A ride requestmay involve multiple passengers. In each trip, a driver could takemultiple ride requests as long as the capacity permits. Each ridetrip of a driver can be regarded as a non-replenishable resource.
Once the capacity is used up, it becomes unavailable in demand ful-fillment. This new generation of ridesharing significantly increasesvehicle occupancy rates and the efficiency of urban transportationsystems, consequently reducing congestion and pollution.
In the grab hitch platform, drivers are not allowed to pick uppassengers by themselves via self-arrangements, but can only takeride requests assigned by the platform. Therefore, one key problemfaced by the platform is to automatically match ride requests toavailable drivers in real-time so as to maximize the total profit.
A rich literature has been devoted to the study of onlinematchingalgorithms with different models and under different assumptions.Karp et al. [19] first studied the online bipartite matching problemto maximize the number of matches under the assumption that thearrival process is determined by the adversary. In their paper, eachresource has a single unit of capacity and each request is assumedto consume only one unit of resource. Feldman et al. [14] revisitedthe problem by assuming the arrival process to be stochastic, thatis, the arrival of online vertices follows a known independent andidentical distribution (i.i.d). Brubach et al. [8] extended the earlierwork to the model to maximize the vertex-weighted sum of matchesand the edge-weighted sum of matches. They again assumed unitdemand size for each online request and unit capacity for eachoffline resource. However, in practice, the resources often havegeneral capacities, and each request may consume multiple unitsof capacity in one match. The ride hitch problem described earlieris an example. Different cars have different number of vacancies toaccommodate passengers. Each ride request could involve multiplepassengers, hence occupy multiple vacancies. The model studied inthis paper considers such a general problem settings. We assumethere are multiple types of resources and each type of resourcehas a general capacity. Each online request consumes a single typeof resource but by multiple units. We also assume an i.i.d arrivalprocess. Our goal is to maximize the edge-weighted sum of matches.To the best of our knowledge, this is the first paper considering theonline matching problem in such a general setting.
Our ContributionTo solve this general online matching problem, we start by propos-ing a simple randomized algorithm based on linear program round-ing. The algorithm allocates an appropriate resource to each requestwith certain probability that is based on the solution of an offlinelinear program. We analyze the performance of this simple algo-rithm. Following the convention in the literature, we measure theefficiency of an online algorithm by the competitive ratio, which isdefined as the total profit generated from the algorithm, divided bythe maximum profit achievable if full information on the arrivalof demand requests is known beforehand. Next, as the main resultof this paper, we introduce a re-solving heuristic to the random-ized algorithm. The idea of re-solving is to periodically re-compute
1
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
Conference’17, July 2017, Washington, DC, USA Wang, et al.
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
the offline linear program and uses the updated offline solution toguide the online algorithm. We show that re-solving at a right timecould help significantly improve the performance of the algorithm.We also investigate the value of demand distribution of the onlinerequest to further improve the algorithm’s efficiency.
Finally, we conduct extensive experimental studies to test theefficiency of our proposed algorithms. On average, our online algo-rithm achieves 70% − 80% of the optimal profit on both syntheticand real-world datasets. In particular, the proposed randomizedalgorithm with the re-solving heuristic significantly outperformsall the other algorithms. We observe that by re-solving the linearprogram at our proposed time, the profit obtained is increased byalmost 20% compared with the standard randomized online algo-rithm. We also show that the advantage of our proposed algorithmsbecomes more salient when the demand in the market increases.
We summarize our main contributions as follows:(1) We solve a general online bipartite matching problem where
the offline resources are equipped with multiple capacities andeach online request consumes multiple units of capacity oncematched. The arrival process is assumed to be i.i.d and the goalis to maximize the edge-weighted sum of matches.
(2) We propose a randomization algorithm based on the solution toan offline linear program and establish its competitive ratio asa function of the maximal demand among requests. In a specialcase that the maximal demand is 2, the competitive ratio is 14 ,which is comparable to the existing results on similar problemsettings.
(3) We further introduce a re-solving heuristic to the randomiza-tion algorithm and show that re-solving at the right time couldsignificantly improve the performance of the algorithm.
(4) We investigate the value of demand distribution of the onlinerequest to further improve the algorithm’s efficiency.
2 RELATEDWORKThe problem of online bipartite matching has been intensively stud-ied, and the literature is too vast to survey here. We provide anoverview of the work most directly relevant to ours. The first algo-rithm for the single-capacity unweighted online bipartite match-ing problem was given by Karp et al. [19]. They introduced theRANKING algorithm and proved a tight 1 − 1e competitive ratiowith adversary online vertex arrival order. The analysis was latersimplified by Devanur et al. [11]. Aggarwal et al. [3] generalizedthe problem by considering weigthed offline vertices. Mehta et al.[25] investigated the multi-demand case known as the AdWordsproblem and presented a 1 − 1e competitive algorithm.
Another line of works considers the random arriving model,in which the online vertices arrives in a uniformly random order.Karande et al. [18] and Mahdian et al. [22] independently showedthat the RANKING algorithm can achieve a competitive ratio betterthan 1 − 1e in the random arrival model. Huang et al. [16] furthergeneralized the analysis to the vertex-weighted setting. Devanurand Hayes [10] presented a 1 − ϵ competitive algorithm for theAdWord problem in the random arrival model.
Finally, a third line of works, which also includes this work, as-sumes the arrival of online vertices follows a known independentand identical distribution [6, 14, 15, 17, 23]. In this model, a closely
related work is Xu et al. [27].In their paper, there are multiple typesof resources and each request could consume at most one unit ofeach type. The objective is to maximize the vertex-weighted sumof matches. They designed an algorithm which achieves 14∆ com-petitive ratio, where ∆ denotes the maximal number of resourcesrequested by arrivals. Although their paper shares a similar settingto ours, our paper distinguishes from theirs in the following aspects:First, the profit in our paper is defined on edges instead of vertices.The edge-weighted matching is known to be much more nebulousthan the vertex-weighted case [13]. Second, we assume each arrivalonly requests one type of resource but could consume multipleunits of resources.
Another relevant problem to online bipartite matching is theonline generalized assignment problem. In the online generalizedassignment problem, there arem (static) bins each with a capacitylimit. Items arrive online and consume some capacity of the assignedbins. Alaei et al. [4] provided an algorithm for this problem with1− 1k competitive ratio, assuming that no item consumes more than1k fraction of any bin’s capacity. Kesselheim et al. [20] and Naori etal. [26] considered the online generalized assignment problem inthe random arrival model and provided the best-known competitiveratio of 16.99 .
Other extensions include generalizing the graph to a generalnetwork structure and allowing a matching delay, i.e. the requestis allowed to wait for some time before being matched (c.f. Chenet al. [9], Adamczyk et al. [1], Adamczyk et al. [2], Baveja et al.[7], Mehta et al. [24], Ashlagi et al. [5], Dickerson et al. [12] andLowalekar et al. [21]).
3 MODELWe define our online bipartite matching problem in a ride hitchcontext. Consider a bipartite graphG = (U ,V ,E), whereU denotesthe set of drivers’ offers and V denotes the set of possible riders’requests. Each offer u ∈ V is associated with a capacity cu , andeach request v has a demand dv . An edge (u,v) exists for u ∈ Uand v ∈ V if the offer u can can be matched to the request v . Theedge is also associated with a weight (i.e. revenue)wuv .
In our problem definition, we will treat drivers’ offers as offlineresources and riders’ requests as online demands. This is becausegenerally, the driver has amuch longer time tolerance to bematched.He/She might plan to pick up some friends in the evening but putup an offer in system in the morning. In contrast, a rider’s requestusually needs to be matched in seconds. If no suitable drivers canbe found within one minute, the request will be rejected.
We assume an i.i.d. distribution model of request arrival overan online time horizon of T rounds. That is, the set U is madeavailable offline beforehand. In each round, a rider request v issampled with replacement from a known distribution {pv } over V .The distribution is independent and identical in every round. Uponthe arrival of request v , a decision has to be made to either reject v ,or to match it to some neighbor offer u ∈ U that still has enoughremaining capacity. If a pair (u,v) is matched, a revenue ofwuv isgenerated and the capacity of u is decreased by dv .
Below is the list that summarizes the notations.
• T : total numbers of online requests.• pv : the probability of type v vertex in each arrival.
2
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
Online Weighted Bipartite Matching with Capacity Constraints Conference’17, July 2017, Washington, DC, USA
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
• dv : the demand of online request v .• D: the maximal demand of all online requests.• cu : the capacity of offer u.• C: the maximal capacity of all offers.• wuv : the weight (i.e., revenue) associated with edge (u,v)
MILP formulation. Given a realized arrival sequence s of requests,we can solve a mixed integer linear program (MILP) to optimallymatch them to the offers.
max∑
(u,v)∈EwuvXuv (s)
s.t.∑
v :(u,v)∈EdvXuv (s) ≤ cu ,∀u ∈ U∑
u :(u,v)∈EXuv (s) ≤ Nv (s),∀v ∈ V
Xuv (s) ∈ {0, 1},∀(u,v) ∈ E
(1)
Here Nv (s) denotes the number of type v vertex appeared insequence s . The first set of constraint restricts the total consumptionof each resourceu below its capacity and the second set of constraintspecifies the matched request cannot exceed the total arrivals.
We denote the optimal solution to (1) as H (s) and the optimalobjective value asOFF (s). Then the expected revenue generated byoptimally solving each possible arrival realization can be formulatedas E[OFF ] = ∑s P(s)OFF (s), where P(s) denotes the probability ofsequence s among all possible sequences.
Competitive Ratio Analysis. Note that one usually cannot achieveE[OFF ] via an online algorithm due to an unforeseen circum-stance in the future. In this paper, we aim to design online al-gorithms to achieve as a larger expected revenue as possible. Toevaluate the performance of an online algorithm L, we adopt acommonly used performance criterion— competitive ratio (CR). Fora given sequence s , we denote the outcome achieved by an algo-rithm L asALGL(s). Then the expected outcome by the algorithm isE[ALGL] =
∑s P(s)ALGL(s). The competitive ratio of an algorithm
L is defined as
CRL =E[ALGL]E[OFF ] (2)
Noticed thatOFF (s) of (1) is a concave function in Nv (s) for eachsequence s . By taking the expectation over all possible arrivingsequences, replacing E[Nv (s)] by pvT , and defining yuv = xuvpvT ,we get upper bound E[OFF ] by the following linear program.
max∑
(u,v)∈ETpvwuvyuv
s.t.∑
v :(u,v)∈Epvdvyuv ≤
cuT,∀u ∈ U∑
u :(u,v)∈Eyuv ≤ 1,∀v ∈ V
yuv ≥ 0,∀(u,v) ∈ E
(3)
We use OPT to denote the optimal value of (3).
Proposition 3.1. OPT ≥ E[OFF ], i.e., E[OFF ] is upper boundedby the optimal value of (3).
Algorithm 1: Samp(α) AlgorithmResult: Online matchingsMSolve the LP (3) and get the optimal solution y∗;Time t = 1;MatchingsM = ϕ;while t ≤ T do
Online vertex v arrives;Randomly choose u with probability αy∗uv ;if cu ≥ dv then
Match u and v : cu = cu − dv ,M = M + (u,v);else
Reject v ;endt = t + 1;
end
We omit the proof due to space constraints.In the subsequent sections, we will use linear program (3) to aid
our design of the randomized online algorithms and analyze theircompetitive ratios.
4 A RANDOMIZED ALGORITHM — SAMP (α )Our first online algorithm takes a common linear-program-roundingapproach. First solve the optimal solution y∗uv from (3). Then foreach arrival request v , an offer u is randomly chosen to match vwith probability αy∗uv . Here α is a parameter that controls howaggressively the online algorithm makes the matches.
Let Cut denote the amount of capacity of offer u consumed bythe requests before time t . We have
E[Cut ] =t−1∑t ′=1
∑v ′∈V
pv ′αy∗uv ′dv ′ =
t−1∑t ′=1
∑v ′∈V
αy∗uv ′dv ′pv ′
≤t−1∑t ′=1
αcuT=
αcu (t − 1)T
(4)
where the last inequality is from offline vertex’s capacity constraint.By Markov’s inequality, we can write the probability that v ismatched to u at time step t as
Prα (u,v, t) ≥ αpvy∗uv[1 − (t − 1) αcu
T (cu − dv + 1)
]This allows us to bound the expected number of times that edge(u,v) is matched by the algorithm during the first t ′ steps.
Nα (u,v, t ′) ≥t ′∑t=1
Prα (u,v, t)
=
t ′∑t=1
αpvy∗uv
[1 − (t − 1) αcu
T (cu − dv + 1)
]≥
[−(t ′
T
)2 α2cu2(cu − dv + 1)
+t ′
Tα
]Tpvy
∗uv
≥[−(t ′
T
)2 α2D2+t ′
Tα
]Tpvy
∗uv
(5)
3
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
Conference’17, July 2017, Washington, DC, USA Wang, et al.
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
The last inequality holds as 1 ≤ cu ≤ C and 1 ≤ dv ≤ D andcu ≥ dv , which implies that for every u and v ,
cucu − dv + 1
= 1 +dv − 1
cu − dv + 1≤ 1 + D − 1
1= D.
Therefore, we can further bound the expected performance of theSamp(α) algorithm as follows.ALGα =
∑(u,v)∈E
[wuvNα (u,v,T )]
≥(−α
2D
2+ α
) ∑(u,v)∈E
Tpvwuvy∗uv ≥
(−α
2D
2+ α
)OPT
(6)
Proposition 4.1. The Samp(α) algorithm has competitive ratioCR ≥ 12D .
The proof of the proposition is a straightforward result from theanalysis above and is omitted here.
4.1 Re-solving HeuristicNote that in algorithm Samp(α), the linear program (3) is solvedonce at the beginning of the algorithm. Then the solution will beused to guide the online algorithmmatching probability throughoutthe whole time span. However, in the middle of the process, dueto the randomness of the request arriving sequence, it is probablythat the capacities of the orders are consumed disproportionately.In such cases, the original LP can no longer capture the correctresource configuration. As such, we need to re-solve the linearprogram with the updated capacity information, and update the LPsolution to guide the subsequent allocation. We call this refinementstep the re-solving heuristic.
In this section, we will analyze the re-solving heuristic. Our goalis to decide whether and when this heuristic will improvement thealgorithm performance.
4.1.1 Re-solving does not always help. First we try to answer thequestion of whether the re-solving heuristic, regardless of when itis applied, always helps the algorithm to generate a better solution.Intuitively this may seem true. However, in the following we showvia a counterexample that the re-solving heuristic may make thingsworse sometimes.
• 1 offline vertex: c = 2• 2 online vertices: v0 and v1• v0: p0 = 12 , d0 = 1,w0 = w > 1• v1: p1 = 12 , d1 = 1,w1 = 1• T = 4
In this case, D = 1 hence α = 1D = 1. By solving the offlineLP (3), we know that algorithm Samp will always accept v0 as longas the capacity permits and reject v1. To understand the perfor-mance of algorithm Samp, let s denote the realized sequence. Ifs = (v1,v1,v1,v1), then the offline optimal profit is 2 while Sampgives 0. If there is exactly one v0 in s , the offline optimal profit is1 +w while Samp givesw . If there are more than one v0 in s , bothoffline optimal profit and the expected profit by Samp are 2w . Let q0denote the probability that s has nov0 and q1 denote the probabilitythat s has one v0. In summary, the expected profits generated bythe offline linear program and Samp are different only if the realized
sequence has less than two v0. According to the i.i.d assumption,we have q0 = 116 and q1 =
14 . Therefore we have:
E[OFF ] = E[ALG] + 2q0 + q1 = E[ALG] +38
Next we study the effect of re-solving heuristic. Suppose we re-solvethe linear program after the first arrival. Consider such a realizedsequence s0 = (v1,v1,v0,v0). The re-solved LP will suggest toaccept v0 with probability 1 and accept v1 with probability 13 fromthe second arrival on. Hence the expected profit generated underthis sequence is 23 ×2w+
13 (1+w) by the re-solving method, which is
equivalent to say the expected loss compared to the offline optimalsolution is w−13 . Noticed that the probability of having a sequences = s0 is 116 . Then we can upper bound the expected outcome ofthis re-solving method as follows
E[ALG ′] ≤ P(s0)[OFF (s0) −
w − 13
]+∑s,s0
P(s)OFF (s)
≤ E[OFF ] − w − 148
By settingw > 19, we have E[ALG ′] < E[ALG]. In other words,to re-solve LP could generate a worse performance.
4.1.2 Re-solving at the right time helps. In this section we focus onthe problem of when to re-solve. Consider the following question: ifwe are only allowed to re-solve the LP once during the whole timespan, when should we re-solve the LP to maximize the expectedperformance of the algorithm? Suppose we re-solve at time t ′ =(1 − β)T = γT . Let T ′ denote the remaining time period. ThenT ′ = βT . LetXu denote the remaining capacity ofu at time t ′. Thenthe new LP becomes
max∑
(u,v)∈ET ′pvwuvyuv ,
s.t.∑
v :(u,v)∈Epvdvyuv ≤
XuT ′,∀u ∈ U ,∑
u :(u,v)∈Eyuv ≤ 1,∀v ∈ V ,
yuv ≥ 0,∀(u,v) ∈ Eyuv = 0,∀(u,v) ∈ E,Xu < dv .
(7)
We add the last constraint because when running the algorithmfor several rounds, some offline vertex might have less remainingcapacity than the demand. In this case, the edge between them stillexists but the matching is not possible. Denote the optimal solutionof the re-solved linear program as y′∗ and the optimal value asOPT ′. The optimal solution and optimal value of the new linearprogram depend on the remaining capacity, which is a randomvariable. Hence the optimal solution y
′∗ and optimal value OPT ′are also random variables. To simplify the analysis, we condition ona particular realization of the remaining capacity in the subsequentpresentation, i.e. Xu = c ′u , in which case, y
′∗ and optimal valueOPT ′ are deterministic.Let N ′α (u,v,T ) be the expected number of (u,v) that is matched byre-solved algorithm, which is to match the resource based on αy∗
before t ′ and on α1y′∗ after t ′. Following a similar analysis above,
4
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
Online Weighted Bipartite Matching with Capacity Constraints Conference’17, July 2017, Washington, DC, USA
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
we have from the re-solve point t ′, the expected match between aresource-request pair (u,v) can be analyzed as follows:
N ′α (u,v,T ′) ≥[−(T
′
T ′)2
α21c′u
2(c ′u − dv + 1)+T ′
T ′α1
]Tpvy
′∗uv
≥[−α21D
2+ α1
]Tpvy
′∗uv
(8)
By choosing α1 = 1D , we have N′α (u,v,T ′) ≥ 12DTpvy
′∗uv . The
second inequality holds as y′∗uv = 0 if c ′u < dv , which implies
for any y′∗uv > 0, c ′u ≥ dv , hence
c ′uc ′u−dv+1 ≤ 1 +
dv−1c ′u−dv+1 ≤ dv .
Therefore,
N ′α (u,v,T ) ≥[−α
2D
2γ 2 + αγ
]Tpvy
∗uv +
12D
Tpvy′∗uv (9)
The expected outcome of re-solve algorithm is∑uv
wuvN′α (u,v,T ) ≥
[−α
2D
2γ 2 + αγ
]OPT +
12D
OPT ′
Then we can bound the competitive ratio from below, i.e.,
CR′ ≥[−α 2D2 γ 2 + αγ
]+ 12D
OPT ′OPT = −
γ 2α 2D2 + γα +
12D
OPT ′OPT .
(10)Now we want to show the lower bound (LB) of OPT
′OPT and check if
we need to re-solve according to this LB. We construct a solutiony′ for LP’ based on the optimal solution of LP. We denoteU+ as theset of offline vertices whose capacity without change, i.e., c ′u = cuandU− as the rest of the offline vertices. Consider such a solution
y′uv =
{y∗uv u ∈ U+0 u ∈ U−
(11)
It is easy to check thaty′ is feasible for the re-solved linear program(7). Therefore,
OPT ′
OPT≥ T
′(w ′(U+) +w ′(U−))T (w(U+) +w(U−))
= βw ′(U+)
w(U+) +w(U−)(12)
where wu =∑v ∈Adj(u) pvwuvy∗uv , w(S) =
∑u ∈S wu and w ′(S) =∑
u ∈S∑v ∈Adj(u) pvwuvy′uv . Bearing in mind that the remaining
capacity Xu is a random variable, OPT ′ is also random. From theanalysis above, we have
Proposition 4.2. Define R = maxucuminvdv , E[OPT ′OPT
]≥ (1−γ )e−αγR
We omit the proof of the proposition due to space constraints.Based on the result in Proposition 4.2. Let α = 1 and γ = 1D .We can further establish the following proposition to demonstratethat re-solving at γT helps to achieve a better lower bound for thecompetitive ratio.
Proposition 4.3. Re-solving at TD helps to generate a better com-petitive ratio which is CR′ ≥ 12D +
12D (1 −
1D )e
− RD
The first term in the established competitive ratio is exactly theone we have built for algorithm Samp. The second term is non-negative as long as D ≥ 1, which indicates that to re-solve at ourproposed time will generate at least the same competitive ratio asSamp(α).
4.1.3 Re-solving Many Times At the Right Time Further Helps toImprove the Bound. Consider such a randomization algorithm. Ran-domly allocate the resource based on Samp(α) until γT . After ithre-solve, the allocation is based on Samp(αi ) and the new re-solvetime point is at γ proportion of the remaining time period. We callsuch an algorithm as a log-resolving algorithm with parameter γto specify the re-solving time point. Denote the remaining timeperiod at ith re-solve as T (i). T (0) = T . Let X (i)u denote the remain-ing capacity right before ith re-solve. Notice that X (i)u is a randomvariable, we first study the bound of the expected ratio betweenthe optimal values of two consecutive linear programs conditionedon a realization of X (i)u .
Proposition 4.4. Conditioned on X (i)u = c(i)u ,∀u, under the con-
dition that RT (i )
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
Conference’17, July 2017, Washington, DC, USA Wang, et al.
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
Conditioning onc(1),OPT1 is deterministic, henceE[ALG(t1,T )OPT1
��c(1)]represents the expected performance of the randomization algo-rithm. Starting from t1, we can follow a similar analysis to get thefollowing inequality
E[ALG(t1,T )OPT1
��c(1)]≥ E
[−γ
2α 21D2 + γα1
��c(1)] + E [ALG(t2,T )OPT2 OPT2OPT1 ��c(1)]≥ E
[−γ
2α 21D2 + γα1
��c(1)] + E [ALG(t2,T )OPT2 ��c(1),c(2)] (1 − γ )e−α1γR≥ −γ
2α 21D2 + γα1 + E
[ALG(t2,T )OPT2
��c(1),c(2)] (1 − γ )e−α1γR(14)
With the same analysis we have for each i ,
E[ALG(ti ,T )OPTi
��c(1), . . . ,c(i)] ≥ −γ 2α 2i D2 + γαi+E[ALG(ti+1,T )OPTi+1
��c(1), . . . ,c(i+1)] (1 − γ )e−αiγRIn the last period, we have
E
[ALG(tK ,T )
OPTK
���c(1), . . . ,c(K )] ≥ −α2KD2+ αK
Denote E[ALG(ti ,T )OPTi | c(1), . . . ,c(i)] as li . Hence we have
li ≥ −γ 2α 2i D
2 + γαi + li+1(1 − γ )e−αiγR ,∀l = 0, ...,K − 1and lK ≥ −
α 2KD2 + αK . Set αK =
1D , αi = 1,∀i = 0, ...,K − 1 and
γ = 1D . We have lK ≥12D and li ≥
12D + li+1(1 − γ )e
− RD ,∀i =0, . . . ,K − 1. Aggregate all the inequalities, we have
l0 ≥K∑i=0
12D
((1 − γ )e− RD
)i= 12D
1−((1−γ )e−
RD
)K+11−(1−γ )e−
RD
→ 12D1
1−(1−γ )e−RD= 12D
11−(1− 1D )e−
RD
4.1.4 Time Complexity. For each arrival, the matching decision isdone by flipping a coin based on the optimal solution to a linear pro-gram and checking the capacity availability. Hence the computationefficiency is mainly determined by the computation time of a linearprogram. For Samp(1), we need to solve O(1) linear programs, andit requires O(log |V |) linear programs for the re-solving heuristic.
4.2 With Information of Demand DistributionPrevious section has established the competitive ratio as a func-tion of the maximal demand. But we have not made use of thedemand distribution. To see the value of the information, we firstaggregate the type of each online arrival as follows: For online ver-tices with the same adjacent offline vertices and the same weightfor each corresponding incident edges, we aggregate them into agroup. In other words, the set defined by Q(v) = {v ′ | Adj(v ′) =Adj(v),wuv ′ = wuv ,∀u ∈ Adj(v)} contains all the online verticesin the same group as v . Then we can distinguish online arrivalvertices by its affiliated group and demand size. We denote thewhole set of groups as Q and the demand set in group q as Lq . Forany vertex v ∈ V , its group is defined by q(v) ∈ Q . The probabilityof getting a vertex in group q ∈ Q is ∑
v ∈V:q(v)=qpv . For vertex in
group q, we define the demand distribution as pl |q =pqlpq , where
pql =∑
v ∈V:q(v)=q,dv=lpv and pq =
∑l ∈Lq
pql .
From the definition of groups, it is easy to get
Lemma 4.6. There exists an optimal solution to (3), such thatyuv =yuv ′ is q(v) = q(v ′) and dv = dv ′ .
Then we can revise the linear program (3) accordingly as below
max∑
(u,(q,l ))∈ETwuq
∑lpqlyuql
s .t .∑
q∈Q
∑l ∈Lq
pql lyuql ≤ cuT ,∀u ∈ U∑u ∈Adj(q,l )
yuql ≤ 1,∀(q, l) ∈ Vyuql ≥ 0,∀(u, (q, l)) ∈ E
(15)
We prove in the following lemma that the revised LP is equivalentto (3).
Lemma 4.7. (15) is equivalent to (3). Specifically, For all v thatq(v) = q,dv = l , we have an optimal solution y∗ to (15) such thaty∗uql = y
∗uv for every adjacent vertex u, where y
∗uv is an optimal
solution to (3).
In other words, we can regard the vertices in the same group andcapacity as a super vertex with arrival probability pql and solvethe revised linear program. For each arrival, a resource is matchedaccording to the revised linear program. The randomization algo-rithm based on the revised linear program will generate the sameresults as the original linear program. In the following analysis,we will focus on the revised linear program. Denote the optimalsolution to (15) as y∗uql for each u,q, l .
LetNα (u,q, l , t ′) be the expected number ofmatched edge (u,q, l)from t = 1 to t = t ′. Following a similar analysis to (5), we have
Nα (u,q, l , t ′) ≥[−( t
′
T)2 α
2cu2(cu − l + 1)
+t ′
Tα
]Tpqly
∗uql
≥[−( t
′
T)2 α
2l
2+t ′
Tα
]Tpqly
∗uql
(16)
as cucu−l+1 ≤ 1 +l−1
cu−l+1 ≤ l since l ≤ cu .Let Al (t ′) = −( t
′T )2
α 2l2 +
t ′T α and Al (t ′) is decreasing in l for
any 0 < t ′ ≤ T .Then write down the expected outcome of this algorithm:
ALGα =∑u,q,l
[wuqNα (u,q, l ,T )]
≥∑u,q,l
TpqlwuqAl (T )y∗uql
≥∑q∈Q
∑l ∈Lq
TpqlAl (T )∑u
wuqy∗uql
=∑q∈Q
∑l ∈Lq
TpqlAl (T )Wql
(17)
For notation simplicity, we omitT and useAl to denoteAl (T ). Tofurther analyze the lower bound, we first establish some propertiesof vertices in the same group. We defineWql =
∑u wuqy
∗uql for
a fixed group q to represent the expected profit generated by thevertices in the group.
6
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
Online Weighted Bipartite Matching with Capacity Constraints Conference’17, July 2017, Washington, DC, USA
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
Lemma 4.8. If q(v) = q(v ′) = q and dv = l < m = dv ′ , thenWql ≥Wqm .
Lemma 4.8 indicates that within the same group, the verticeswith a smaller demand generates a higher expected profit. Basedon such an observation, we can build the following lemma.
Lemma 4.9. For each type q ∈ Q , given a fixed ∑l ∈Lq
TpqlWql , we
have∑l ∈Lq TpqlAlWql ≥ (−
12E[Dq ]α2 +α)Wq , where E[Dq ] is the
expected demand of type q arrivals andWq represents∑
l ∈LqTpqlWql .
Denote Me = maxq∈Q E[Dq ]. Then we are ready to presenta new lower bound of the Samp(α) when demand distribution isavailable.
Theorem 4.10. With the distribution of demand, Samp(α) gener-ates a competitive ratio 12Me , whereMe = maxq∈Q E[Dq ].
Proof: From Lemma 4.9, we have for all possible type q,∑l ∈Lq
TpqlAlWql ≥ (−E[Dq ]12α2 + α)Wq ≥ (−Me
12α2 + α)Wq
Therefore,∑q∈Q
∑l ∈Lq TpqlAl (T )Wql ≥ (−Me
12α
2+α)∑q∈QWq =(−Me 12α2 + α)W . In other words, the competitive ratio is lowerbounded by −Me 12α2+α . By setting α =
1Me , we can get a constant
a competitive ratio 12Me .
4.2.1 Re-solve with Demand Distribution. With information of de-mand distribution, we can again apply the re-solving heuristic to seewhether we can further improve the competitive ratio. Accordingto Lemma 4.7, the deterministic linear program (3) can be reformu-lated as (15). When revolving the problem, the deterministic linearprogram can be revised accordingly as follows:
max∑
(u,(q,l ))∈ETwuq
∑lpqlyuql
s.t.∑
q∈Q
∑l ∈Lq
pql lyuql ≤ cuT ,∀u ∈ U∑u ∈Adj(q,l )
yuql ≤ 1,∀(q, l) ∈ Vyuql ≥ 0,∀(u, (q, l)) ∈ Eyuql = 0,∀(u, (q, l)) ∈ E, cu < l
(18)
Follow a similar analysis in the previous section, we have
E[ALG(0,T )] ≥[−(t ′
T
)2 α2Me2+t ′
Tα
]OPT +
12MeE[OPT ′]
(19)
Following a similar analysis to Proposition 4.3, we can easily derivethe new competitive ratio 12Me +
12Me (1 −
1Me )e
− RMe if re-solvingonce at TMe . The same analysis applies to the case with multipletimes of re-solve.
Theorem 4.11. When demand distribution is available, the log-resolving algorithm with γ gives a competitive ratio after Kth re-solveis:
12Me
1 −((1 − 1Me )e
− RMe)K+1
1 − (1 − 1Me )e− RMe
If the number of re-solving time K increases the ratio can be better.When K is large, this ratio converges to
12Me
1
1 − (1 − 1Me )e− RMe
5 EXPERIMENTWe test the online algorithms proposed in Section 4 over severalsynthetic data sets and a New York city taxi data set. Each dataset specifies a bipartite graph, which is represented byG(U ,V ,E),whereU ,V represents the offline and online request set respectivelyand E denotes the arc set. Let r = |V ||U | denote the ratio between thenumber of online and offline vertices. We compare our algorithmsto the greedy algorithm, which is a widely used benchmark in theliterature (c.f. Xu et al. [27], Dickerson et al. [12] and Lowalekar etal.[21]). Specifically, we analyze the following algorithms in thissection.• Greedy: Assign an arriving request v to the resource u withthe largest weight on the edge (u,v) among all the availableresources; if no available resource found, reject v .
• Samp(1): Refer to the Samp(α) algorithm and choose α = 1.• RES-γ : Under the Samp(1) framework, update the offline linearprogram at t = T (1 − (1 − γ )i ) for 1 ≤ i ≤ K , where K is themaximal re-solve times. Set K = 10. We test over different γincluding γ = 1D =
13 as D = 3 in the data.
The comparison is based on the empirical competitive ratio (ECR).The empirical competitive ratio (ECR) is defined as the ratio betweenthe total profit generated from an algorithm and the total offlineoptimal profit for a sample of request sequences.
ECRL =
∑s ∈S PL(s)∑s ∈S OFF (s)
,
where S denotes the set of sampled request sequences and PL(s)denotes the profit by algorithm L for the sequence s . Noticed thatdifferent algorithms share the same offline optimal profit, the com-parison of empirical competitive ratio is equivalent to a comparisonof profit. For a given bipartite graph G and a planing horizon T ,we generateM request sequences by uniformly sampling each re-quest from the demand pool. We run tests for T = k |V | wherek = 1, 2, 3, 4, 5.
The test is organized in the following manner: We first testdifferent algorithms in New-York city taxi data, with the requestweights ranging from 1 to 5. We examine the performance of eachalgorithm in different markets and investigate the effect of differentre-solving time points. Lastly, we extend the test to some syntheticdata generated and test different request weight ranges.
The first column of Figure 1 presents the performance of differ-ent algorithms in different markets. The parameter k and r indicatethe unbalance between the supply and demand in the market. Thelarger they are, the more overwhelming the demand is. From thefigure we can see that in general, the re-solving method outper-forms both greedy method and Samp(1) algorithm. On average,incorporating re-solving heuristic in the randomization algorithmimproves the profit by 20%. Greedy method performs well whendemand is not high. But its performance drops significantly when
7
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
Conference’17, July 2017, Washington, DC, USA Wang, et al.
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
(a) r = 1 (b) r = 1 (c) Synthetic data: 1 ≤ wuv ≤ 5
(d) r = 2 (e) r = 2 (f) NYC data, 1 ≤ wuv ≤ 2
(g) r = 3 (h) r = 3 (i) Synthetic data: 1 ≤ wuv ≤ 2
Figure 1: Result Summary
demand increases. In contrast, the performance of the proposed ran-domization algorithms is more robust across different markets. Onepossible reason is that when demand is high, strategically skippingsome inferior demand can better utilize the resource capacity.
To further understand how important it is to re-solve at a righttime. We compare algorithms with different re-solving time points.The second column in Figure 1 compares the performance of al-gorithms with different γ when applying RES-γ algorithm. Fromthe figure we can see that resolving at our proposed time whichis to set γ = 1D =
13 outperforms the other time points. It could
achieve up to 12% improvement compared to some other resolvingtime. Consistent with the observation in the column in Figure 1, therandomization algorithms gets better performance whenγ becomeslarger, for all the tested γ s.
We extend the test to the synthetic data generated and plot theresults in Figure (a) in the last column of Figure 1. The observationsare consistent with those in the first column . We further test the
data with edge weights in a smaller range. It is observed that whenthe weight range becomes smaller, online algorithms’ performanceincreases. This observation is more significant when it applies tothe greedy method. It implies that the randomization algorithm ismore robust across different data sets.
6 CONCLUSIONSWe study the online weighted bipartite matching problem withcapacity constraints in this paper. We propose a randomized algo-rithm based on the solution to an offline linear program and analyzeits competitive ratio. We further introduce a re-solving heuristicto the randomized algorithm and demonstrate that re-solving atthe right times could significantly improve the performance of thealgorithm. Finally, we investigate the value of demand distributionof the online request to further improve the algorithm’s efficiency.Several experiments are conducted to test the performance of theproposed algorithms based on an application in ride hitch.
8
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
Online Weighted Bipartite Matching with Capacity Constraints Conference’17, July 2017, Washington, DC, USA
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
REFERENCES[1] Marek Adamczyk. 2011. Improved analysis of the greedy algorithm for stochastic
matching. Inform. Process. Lett. 111, 15 (2011), 731–737.[2] Marek Adamczyk, Fabrizio Grandoni, and Joydeep Mukherjee. 2015. Improved
approximation algorithms for stochastic matching. In Algorithms-ESA 2015.Springer, 1–12.
[3] Gagan Aggarwal, Gagan Goel, Chinmay Karande, and Aranyak Mehta. 2011.Online vertex-weighted bipartite matching and single-bid budgeted allocations.In Proceedings of the twenty-second annual ACM-SIAM symposium on DiscreteAlgorithms. SIAM, 1253–1264.
[4] Saeed Alaei, MohammadTaghi Hajiaghayi, and Vahid Liaghat. 2013. The onlinestochastic generalized assignment problem. In Approximation, Randomization,and Combinatorial Optimization. Algorithms and Techniques. Springer, 11–25.
[5] Itai Ashlagi, Yossi Azar, Moses Charikar, Ashish Chiplunkar, Ofir Geri, HaimKaplan, Rahul Makhijani, Yuyi Wang, and Roger Wattenhofer. 2017. Min-costbipartite perfect matching with delays. Approximation, Randomization, andCombinatorial Optimization. Algorithms and Techniques (APPROX/RANDOM 2017)81 (2017), 1–1.
[6] Bahman Bahmani and Michael Kapralov. 2010. Improved bounds for onlinestochastic matching. In European Symposium on Algorithms. Springer, 170–181.
[7] Alok Baveja, Amit Chavan, Andrei Nikiforov, Aravind Srinivasan, and Pan Xu.2018. Improved bounds in stochastic matching and optimization. Algorithmica80, 11 (2018), 3225–3252.
[8] Brian Brubach, Karthik Abinav Sankararaman, Aravind Srinivasan, and Pan Xu.2016. Online Stochastic Matching: New Algorithms and Bounds. arXiv preprintarXiv:1606.06395 (2016).
[9] Ning Chen, Nicole Immorlica, Anna R Karlin, Mohammad Mahdian, and AtriRudra. 2009. Approximatingmatches made in heaven. In International Colloquiumon Automata, Languages, and Programming. Springer, 266–278.
[10] Nikhil R Devanur and Thomas P Hayes. 2009. The adwords problem: online key-wordmatchingwith budgeted bidders under random permutations. In Proceedingsof the 10th ACM conference on Electronic commerce. ACM, 71–78.
[11] Nikhil R Devanur, Kamal Jain, and Robert D Kleinberg. 2013. Randomized primal-dual analysis of ranking for online bipartite matching. In Proceedings of thetwenty-fourth annual ACM-SIAM symposium on Discrete algorithms. Society forIndustrial and Applied Mathematics, 101–107.
[12] John P Dickerson, Karthik A Sankararaman, Aravind Srinivasan, and Pan Xu.2018. Allocation problems in ride-sharing platforms: Online matching with offlinereusable resources. In Thirty-Second AAAI Conference on Artificial Intelligence.
[13] Matthew Fahrbach, Zhiyi Huang, Runzhou Tao, and Morteza Zadimoghaddam.2020. Edge-Weighted Online Bipartite Matching. arXiv preprint arXiv:2005.01929(2020).
[14] Jon Feldman, Aranyak Mehta, Vahab Mirrokni, and Shan Muthukrishnan. 2009.Online stochastic matching: Beating 1-1/e. In 2009 50th Annual IEEE Symposiumon Foundations of Computer Science. IEEE, 117–126.
[15] Bernhard Haeupler, Vahab S Mirrokni, and Morteza Zadimoghaddam. 2011. On-line stochastic weighted matching: Improved approximation algorithms. In Inter-national workshop on internet and network economics. Springer, 170–181.
[16] Zhiyi Huang, Zhihao Gavin Tang, Xiaowei Wu, and Yuhao Zhang. 2018. OnlineVertex-Weighted Bipartite Matching: Beating 1-1/e with Random Arrivals. arXivpreprint arXiv:1804.07458 (2018).
[17] Patrick Jaillet and Xin Lu. 2014. Online stochastic matching: New algorithmswith better bounds. Mathematics of Operations Research 39, 3 (2014), 624–646.
[18] Chinmay Karande, Aranyak Mehta, and Pushkar Tripathi. 2011. Online bipartitematching with unknown distributions. In Proceedings of the forty-third annualACM symposium on Theory of computing. ACM, 587–596.
[19] Richard M Karp, Umesh V Vazirani, and Vijay V Vazirani. 1990. An optimalalgorithm for on-line bipartite matching. In Proceedings of the twenty-secondannual ACM symposium on Theory of computing. ACM, 352–358.
[20] Thomas Kesselheim, Andreas Tönnis, Klaus Radke, and Berthold Vöcking. 2014.Primal beats dual on online packing LPs in the random-order model. In Proceed-ings of the forty-sixth annual ACM symposium on Theory of computing. 303–312.
[21] Meghna Lowalekar, Pradeep Varakantham, and Patrick Jaillet. 2020. CompetitiveRatios for Online Multi-capacity Ridesharing. In Proceedings of the 19th Interna-tional Conference on Autonomous Agents and MultiAgent Systems. 771–779.
[22] Mohammad Mahdian and Qiqi Yan. 2011. Online bipartite matching with randomarrivals: an approach based on strongly factor-revealing lps. In Proceedings of theforty-third annual ACM symposium on Theory of computing. 597–606.
[23] Vahideh H Manshadi, Shayan Oveis Gharan, and Amin Saberi. 2012. Onlinestochastic matching: Online actions based on offline statistics. Mathematics ofOperations Research 37, 4 (2012), 559–573.
[24] Aranyak Mehta and Debmalya Panigrahi. 2012. Online matching with stochasticrewards. In 2012 IEEE 53rd Annual Symposium on Foundations of Computer Science.IEEE, 728–737.
[25] AranyakMehta, Amin Saberi, Umesh Vazirani, and Vijay Vazirani. 2007. Adwordsand generalized online matching. Journal of the ACM (JACM) 54, 5 (2007), 22.
[26] David Naori and Danny Raz. 2019. Online multidimensional packing problemsin the random-order model. arXiv preprint arXiv:1907.00605 (2019).
[27] Pan Xu, Yexuan Shi, Hao Cheng, John Dickerson, Karthik Abinav Sankararaman,Aravind Srinivasan, Yongxin Tong, and Leonidas Tsepenekas. 2019. A UnifiedApproach to Online Matching with Conflict-Aware Constraints. (2019).
9
Abstract1 Introduction2 Related Work3 Model4 A Randomized Algorithm — SAMP ()4.1 Re-solving Heuristic4.2 With Information of Demand Distribution
5 Experiment 6 Conclusions References