Before revision:  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:  We present an O(n^2) time algorithm for computing a one dimensional MMD (OMMD) of minimum cost where |S| + |T| = n. In an OMMD 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.