Before revision:  In an MMD, each point of one set must be matched to a given number of the points of the other set , and the cost of matching a point to another point is equal to the distance between the two points. We present an O(n^2) time algorithm for computing a one dimensional MMD (OMMD) , where the input point sets S and T lie on the line and |S|+|T| = n . Then, we study a generalized version of MMD problem, that is the many-to-many matching with demands and capacities problem (MMDC), that in which each point has a limited capacity in addition to a demand.
After revision:  In an MMD, each point of one set must be matched to a given number of the points of the other set . We propose an O(n^2) time algorithm for computing a one dimensional MMD (OMMD) , where the input point sets S and T lie on the line and |S|+|T| = n . Then, we study a generalized version of MMD problem, that is the many-to-many matching with demands and capacities problem (MMDC), that in which each point has a limited capacity in addition to a demand.