1、,Online Bipartite Matching,A matchmaker and n boys are gathered in a room.n girls appear,one at a time.Each girl has a list of boys who are acceptable to her,which she reveals to the matchmaker as she appears.The matchmaker immediately matches the new girl to one of the boys on her list,if any of th
2、em are available.The goal is to maximize the number of matches.,2,Importance of Matching,Resource AllocationSchedulingMemory Management RoutingRobot Motion PlanningExploring an unknown terrainFinding a destinationComputational Finance,Subroutine in many other algorithms.,Given as input a bipartite g
3、raph G=(U,V,E)in which each vertex u U(girls)arrives in online fashion,devise an algorithm that matches u(girl)to one(boy)of its previously unmatched neighbours in V.The matching has to be immediate and is irrevocable,once made.The objective is to maximize the size of the resulting matching.Assume t
4、hat the input graph G has a perfect matchingi.e.a matching of size n.We denote a perfect matching by a function m:#U V.Hence,a c-competitive algorithm must return a matching of size at least cn.,4,Deterministic Algorithm,when u arrives assign it to a some unmatched neighbour.Lemma 3.10.1.The above a
5、lgorithm has a competitive ratio of 1/2.Proof.If a vertex u1 is not present in the resulting matching M,then it does not have an unmatched neighbour,if not,we would have matched u1 to that neighbour.Hence,the resulting matching must be maximal.For every edge u,m(u),either vertex u or m(u)is present
6、in M.So,at least n/2 vertices are matched and hence the algorithm has a competitive ratio of 1/2.,5,Online bipartite matching,V(boys),U(girls),Online bipartite matching,V(boys),U(girls),Online bipartite matching,V(boys),U(girls),Online bipartite matching,V(boys),U(girls),Online bipartite matching,V(
7、boys),U(girls),Online bipartite matching,V(boys),U(girls),Online bipartite matching,V(boys),U(girls),We can prove that any deterministic algorithm cannot do better than the obvious algorithm.An adversary can limit the size of matching to n/2 in the following way:#Let the first n/2 vertices that arri
8、ve have edges to all the vertices in V.Clearly,the adversary can determine the vertices in V that will be matched.Let the next n/2 vertices that arrive contain edges only to those vertices in V which are already matched.The input graph has a perfect matching but the second half of the vertices are n
9、ot matched;#hence our analysis is tight for the deterministic case.,13,Online bipartite matching,n/2,:#n/2:#,V(boys),U(girls),Online bipartite matching,n/2,:#n/2:#,V(boys),U(girls),Online bipartite matching,:#,:#,n/2,V(boys),U(girls),Randomized Algorithm,For each possible input,calculate the expecta
10、tion of the answer and take the worst expected value among all the inputs.In our case,an input instance would be specified by a graph G along with an arrival order.So the input space would contain all possible(G,)pairs.The most natural way to introduce randomness would be to match u to one of the un
11、matched neighbours picked randomly.This algorithm performs better than the deterministic algorithm;#however the improvement is not substantial.,17,Lemma 3.10.2.A randomized algorithm that picks an unmatched neighbour uniformly and randomly has a competitive ratio of at most 1/2+O(logn)/n.Proof.To se
12、e why this is the case,consider the following input.Let u1,.,un U and v1,.,vnV.There is an edge between ui and vi for all i.Every vertex in the first half of U=u1,.,un/2 is connected to every vertex in the second half of V=vn/2,.,vnas shown below:#,18,Online bipartite matching,:#,:#,n/2,n/2,VU,u1,un
13、/2un/2+1,:#,:#,v(boys)(girls),1,vn/2vn/2+1,vnun,Tight instance for the nave randomized algorithm,The vertices arrive in the order of their indices.Intuitively,the algorithm fails to perform well on this input since it matches too many us from the first half to the vs of the second half.The first n/2
14、 vertices from U are definitely in the matching since all of them get at least one unmatched neighbour when they arrive.Each ui from the second half of U can be matched to vi,if vi is not already matched.What is the probability that this happens?#,20,Let us find the expected number of vertices that
15、are matched in the first half of V.When u1 arrives,it can pick either v1 or vn/2,.,vn.So the probability of v1 getting matched is 1/(n/2+1).Similarly,when u2 arrives,the probability that v2 gets matched is:#,21,Similarly,probability of v3 getting matched is less than 1/(n/2 1)and in general a vertex
16、 vi in the first half of V has less than 1/(n/2 i+2)probability of being in the matching.Let Ev be the expected number of vertices from v1,.,vn/2 in the matching.,Hence,less than O(logn)unmatched neighbours are expected to be available to the second half of U,which proves our claim.22,Ranking algorithm,A slightly different randomized algorithm,named RankingKarp,performs much better.The algorithm is as follows:#Ranking()Initialization:#Pick a random permutation(ranking)of the vertices in VFor each u U that arrives:#
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1