9
Annals of Operations Research 57(1995)135-145 135 A constrained matching problem Andreas Hefner and Peter Kleinschmidt* Department of Business Administration and Economics, University of Passau, Innstrafle 29, 94032 Passau, Germany E-mail: hefner/kleinsch@ winf.uni-passau.de We show that certain manpower scheduling problems can be modeled as the following constrained matching problem. Given an undirected graph G = (V,E) with edge weights and a digraph D = (V,A). A Master~Slave-matching (MS-matching) of G with respect to D is a matching of G such that for each arc (u,v) cA for which the node u is matched, the node v is matched, too. The MS-Matching Problem is the problem of finding a maximum-weight MS-matching. Let k(D) be the maximum size of a (weakly) connected component of D. We prove that MS-matching is an NP-hard problem even if G is bipartite and k(D) < 3. Moreover,we show that in the relevant special case where k(D) < 2, the MS- Matching Problem can be transformed to the ordinary Matching Problem. 1. Introduction and problem formulation The Matching Problem and its special case, the assignment problem, are well- known combinatorial optimization problems for which efficient, i.e. polynomial time, algorithms exist [I 1]. In practice these problems rarely occur in their original setting. Often, additional constraints have to be satisfied. In most cases these additional constraints turn a problem into an NP-hard problem (see [7] for a general reference to the theory of NP-completeness). In the literature various constraints have been studied. The assignment problem with an additional knapsack-type constraint is called the Resource Constrained Assignment Problem (RCAP). This problem has been studied by Aggarwal [4] who solved RCAP by Lagrangian relaxation. In [12], Mazzola and Neebe designed a branch-and-bound algorithm for RCAP which uses subgradient optimization. Aboudi and J0rnsten [ 1] presented several classes of valid inequalities for RCAP which they derived from the cover inequalities for the knapsack polytope. A special case of RCAP where only the variables in the diagonal appear in the knapsack was studied by Balas [5]. Another *This research was supported by Grant 03-KL7PAS-6 of the German Federal Ministry of Research and Technology. © J.C. Baltzer AG, Science Publishers

A constrained matching problem

Embed Size (px)

Citation preview

Page 1: A constrained matching problem

Annals of Operations Research 57(1995)135-145 135

A constrained matching problem

Andreas Hefner and Peter Kleinschmidt*

Department of Business Administration and Economics, University of Passau, Innstrafle 29, 94032 Passau, Germany E-mail: hefner/kleinsch @ winf.uni-passau.de

We show that certain manpower scheduling problems can be modeled as the following constrained matching problem. Given an undirected graph G = (V,E) with edge weights and a digraph D = (V,A). A Master~Slave-matching (MS-matching) of G with respect to D is a matching of G such that for each arc (u,v) cA for which the node u is matched, the node v is matched, too. The MS-Matching Problem is the problem of finding a maximum-weight MS-matching. Let k(D) be the maximum size of a (weakly) connected component of D. We prove that MS-matching is an NP-hard problem even if G is bipartite and k(D) < 3. Moreover, we show that in the relevant special case where k(D) < 2, the MS- Matching Problem can be transformed to the ordinary Matching Problem.

1. Introduction and problem formulation

The Matching Problem and its special case, the assignment problem, are well- known combinatorial optimization problems for which efficient, i.e. polynomial time, algorithms exist [I 1]. In practice these problems rarely occur in their original setting. Often, additional constraints have to be satisfied. In most cases these additional constraints turn a problem into an NP-hard problem (see [7] for a general reference to the theory of NP-completeness).

In the literature various constraints have been studied. The assignment problem with an additional knapsack-type constraint is called the Resource Constrained Assignment Problem (RCAP). This problem has been studied by Aggarwal [4] who solved RCAP by Lagrangian relaxation. In [12], Mazzola and Neebe designed a branch-and-bound algorithm for RCAP which uses subgradient optimization. Aboudi and J0rnsten [ 1] presented several classes of valid inequalities for RCAP which they derived from the cover inequalities for the knapsack polytope. A special case of RCAP where only the variables in the diagonal appear in the knapsack was studied by Balas [5]. Another

*This research was supported by Grant 03-KL7PAS-6 of the German Federal Ministry of Research and Technology.

© J.C. Baltzer AG, Science Publishers

Page 2: A constrained matching problem

138 A. Hefner, P. Kleinschmidt, A constrained matching problem

filled or none of them. Furthermore, the assignment should be optimal with respect to the different qualifications of the workers and the requirements of the jobs.

We can model this situation as an MS-Matching Problem. We construct a bipartite graph G = (VE) with bipartition V = W u U and a dependence digraph D = (V,A). The nodes in W correspond to workers and the nodes in U correspond to jobs. For each machine of type 1 there is a single node in U. For each machine of type 2, U contains a node u associated with the operator job and a node u" associated with the assistant job and A contains the arc (u', u). Finally, for each machine of type 3, U has two nodes u, u" associated with the two operator jobs, and A contains the two arcs (u, u') and (u', u) (consider again figure 1 for an example of this model: the nodes {Ul, U2} model a machine of type 2, {U5, U6} a machine of type 3 and node u 7 a machine of type 1). For two nodes w ~ W and u ~ U the edge [w, u] is included in E if the worker corresponding to w is qualified to do the job corresponding to u. The edge weight cw,, measures how well the worker is trained for the job. A large value of an edge weight means a better qualification of the worker for the job. This completes the description of the model. In section 4 we will see that instances of the MS-Matching Problem resulting from this application can be solved in polynomial time.

3. The complexity of MS-matching

In order to study the complexity of the MS-Matching Problem we introduce a decision version in addition to the optimization version of section 1: (MS-MATCHING) Given a graph G, a dependence digraph D of G and a lower bound L ~ 7/+. Is there an MS-matching of G with cardinality L or more?

THEOREM 1

MS-MATCHING is NP-complete.

Proof

It is clear that MS-MATCHING is in NP, since we can check in polynomial time whether a given set of edges is a matching and satisfies the additional dependence constraints.

We will transform the Satisfiability Problem (SATISFIABILITY) to MS- MATCHING (see [7] for a definition of SATISFIABILITY). Let X = {x t ..... xn } be the set of variables and C = {cl ..... c m } be the set of clauses in an arbitrary instance of SATISFIABILITY. We must construct a graph G = (V,E), a dependence digraph D = (V,A) of G and a bound L such that G has an MS-matching of size L or more if and only if C is satisfiable.

For each variable xj ~X, the graph G has a truth-setting component Tj = (Vj, Ej), where Vj = {wj, Uxi, u~j } and Ej = { [wj, uxfl, [wj, u~j ] }, i.e. Tj is a star of size 2. We

Page 3: A constrained matching problem

A. Hefner, R Kleinschmidt, A constrained matching problem 139

can think of Tj as a switch. Ty forces a matching which matches wj to make a choice between setting xj true and setting ~j true. Thus a matching M which matches all the wj's defines a truth assignment by setting the variable xj true if and only if M matches the node ux.

In or~ter to check whether this truth assignment will satisfy the clauses, the graph G has a satisfaction-testing component Si = (Vi', El) for each clause c i E C. The component Si is a star whose size depends on the number of literals in c i. To be precise, ~ = {w[} u {wizlz Ec i} and E~ = {[wi;Ui'z]lZ Eci} , where the node ui'z is associated with the literal z ~ ci. The intended meaning of S i is that if M is a matching which matches the edge [wi; ui" z ] then the clause c i is satisfied and the literal z is true, i.e. z is a witness for c i being satisfied.

The job of communicating the truth values from the components Ty to the components Si will be performed by the dependence digraph D = (V, A). For each

• m • clause ci and each literal z ~ ci there is an arc (Uiz , uz) ~ A, i.e. A = [-Ji--1 { (uiz ' uz)lz ~ ci}. By this we make sure that a matching M can match ui'z only if M matches u z.

We complete the construction by setting L = IXI + ICl and G = (V ,E) , where n m t V= (U n. . V,) u (U m . V/e) and E = ( U j = I E j) u ( U i _ l E i ) (see figure 2 for an example

. J = l 3 1 = 1

ot this construction).

Figure 2. The MS-MATCHING instance resulting from the SATISFIABILITY instance X = {xl,x2,x3,x4} andC = { {xl, ~2, x3 }, {x2, x3 }, { xl, x2, x3, x4) }. Here L = IxI + I cl = 7. The shown MS-matching corresponds to the satisfying

truth assignment t(xl) = t(x4) = true and t(xz) = t(x3) =false.

The above construction can be performed in polynomial time and space ra C since tVt = 3 n + m + l , IEI = 2 n + / and IAI =/ , where l = ~i=lf i[ < n m , i.e. the

constructed instance is bounded by a polynomial in nm.

Page 4: A constrained matching problem

140 A. Hefner, P. Kleinschmidt, A constrained matching problem

It remains to show that C is satisfiable if and only if G has an MS-matching of size L or more. First suppose that M is an MS-matching of G of cardinality L or more. Since G has L connected components and each connected component is a star, M must contain exactly L edges, one in each connected component Tj and Si. The n edges of M which belong to truth-setting components define a truth assignment t : X ~ { t rue , fa lse } by

f true, Uxj is matched,

t ( x j ) = [ fa lse , u~j ismatched.

To realize that this is a satisfying truth assignment let ci be an arbitrary clause. The MS-matching M contains an edge of Si, say [ w~, ui'z ] for some z ~ ci. Since ( u~ z , Uz) ~ A and M is an MS-matching, M matches u z too. But this means that z is true under the truth assignment t, and hence c i is satisfied by t.

Conversely, let t : X --~ { true, fa l se } be a satisfying truth assignment. We define an MS-matching M of G which includes one edge from each component of G. For each Tj, M contains the edge [wj, ux~] if t(xj) = true and the edge [w j , u~j ] if t(xj) =false. Since t satisfies C, each clause ci contains a literal, say zi, which is set true by t. For each Si, M includes the edge [w~, ui'z]. This completes the definition of M. It is clear that M is a matching of G with cardinality L. To show that M is an MS-matching

t let (ui'z, Uz), 1 < i < m and z ~ ci, be an arc in A such that the node Uiz is matched. From the definition of M it follows that t(z) = true and hence the node u z is matched. Thus M has the desired properties. []

Next, we want to use NP-completeness to analyze subproblems of MS- MATCHING which are motivated by the practical application mentioned in section 2. A first observation is that the problem does not become easier if we allow only instances where G is bipartite and the nodes of the arcs in A belong to just one color class of G. Consider the instance of MS-MATCHING constructed in the proof of

t n theorem 1. If we define W = U~__l{wj} u um__l J - { w i } and U = U._ l {ux j , u~j} u u iml { u[ z Iz ~ ci}, then V = W u U and it is easy to check that each edge has one node in W and the other in U and that each arc in A has both nodes in U.

Another natural restriction to the instances of MS-MATCHING which is also motivated by the application, is to bound k(D), i.e. the size of a maximum connected component of D.

COROLLARY 2

MS-MATCHING remains NP-complete for dependence digraphs D with k(D) <<_ 3.

Proof

Consider again the instance of MS-MATCHING which is constructed in theorem 1 from an arbitrary instance of SATISFIABILITY. The dependence digraph

Page 5: A constrained matching problem

A. Hefner, R Kleinschmidt, A constrained matching problem 141

D has 2n connected components, one for each literal over X. The connected component of D corresponding to a literal z contains the node u z and one node for each clause which contains the literal z. Thus the maximum size of a connected component of D is one greater than the maximum number of occurrences of a literal. Hence, if we apply the construction of theorem 1 to clauses in which each literal occurs at most twice, we obtain an instance of MS-MATCHING with k(D) < 3. Since in [14, p. 394] it is shown that SATISFIABILITY remains NP-complete for formulas in which each variable is restricted to appear once or twice unnegated and once negated, the corollary follows. []

In the next section we will see that 3 is the smallest number K for which MS- MATCHING, restricted to dependence digraphs D with k(D) < K, remains NP-complete.

4. A polynomially solvable special case

In this section we will allow instances of (the optimization version of) the MS- Matching Problem where k(D) < 2. This means that each connected component of D is either an isolated node, a single arc or a cycle of length 2. We call this restricted version of the MS-Matching Problem the 2-MS-Matching Problem. Note that the MS- Matching instances resulting from the application described in section 2 are valid instances of the 2-MS-Matching Problem.

We will show that the 2-MS-Matching Problem can be polynomiaUy transformed to the ordinary Matching Problem. The transformation uses the following auxiliary graph which is constructed from G and D.

The auxiliary graph corresponding to G = (V,E) and D = (V,A) is the graph H = ( V , F ) where F = E u {[u ,v] l (u ,v)cA} . We call the edges in F \ E artificial edges.

Note that from the definition of the auxiliary graph it follows that every node in H is incident with at most one artificial edge. The crucial point in the transformation is that there is a relationship between MS-matchings in G and matchings in H. This is expressed by the following lemma.

LEMMA 3

Let G = (V, E) be a graph, D = (V, A) a dependence digraph of G and H -- (V, F) the auxiliary graph corresponding to G and D. Then we have

(a) If M" is a matching of H which matches all the masters, then M' n E is an MS- matching of G.

(b) If M is an MS-matching of G, then there is a matching M~.of H which contains M and matches all the masters.

Page 6: A constrained matching problem

142 A. Hefner, P. Kleinschmidt, A constrained matching problem

Proof

(a) Let M'be a matching of H which matches all the masters and let M = M' c~ E. Since M ' i s a matching and M C M', M is a matching of G. Let (v ,v ' ) c A , v # v' , and [u, v] ~ M. In order to show that M is an MS-matching of G we must show that M contains an edge [u', v '] for some u' c V. This is trivial if u = v'. Hence we can assume that u # v'. Since v' is a master and M' is a matching of H which matches all the masters, M' contains an edge [u', v']. But since M' also contains the edge [u, v] and [u, v] ~ [u', v" ] the four nodes u, u', v and v" are pairwise different. The edge [u', v" ] is not artificial because otherwise it would follow from k(D) < 2 that u' = v. Thus [u',v'] c E , i.e. v' is matched by M, too (see figure 3 for an example of this).

"02 ,,

"01

"02

~3

"04

(a) (b)

1) 5

?3 6

"0 7

~'O 8

Figure 3 (a) An MS-matching in G. (b) A matching in H which matches all the masters.

(b) Let M be an MS-matching of G and (v ,v ' ) cA, such that v' is exposed by M. Since M is an MS-matching v cannot be incident with an edge in M either. Thus the edge [v,v'] has no node in common with an edge in M. If, for each exposed master v' , we add to M the edge joining v and v' , then we obtain a matching of H which matches all the masters. Note that the added edges have no node in common since we have k(D) < 2. []

The transformation works as follows. Let G = (V,E) be a graph, D = (V,A) a dependence digraph of G with k(D) < 2 and ce an edge weight for each e c E. Further- more, let H = (V, F) be the auxiliary graph corresponding to G and D, and let H" = (V', F') be a disjoint copy of H. The copy of a node v ~ V (edge e ~ F) in the graph H' will be denoted by v" (e'). We construct a new graph G = ( V, E ) by taking H and H" and joining each node v which is not a master to the corresponding v" c V', i.e. V = V u V' and /~ = F • F' u { [v, v' ]1 v is not a master}. For each edge e c E an edge weight Ee is defined by

L + ce, e c E, Ce = L, e q t E ,

Page 7: A constrained matching problem

A. Hefner, P. Kleinschmidt, A constrained matching problem 143

where L is an integer greater than LI VI/2jCma~ and Cm~ = maX{Cele ~E} . (For the graph G of figure 3(a) the graph G is shown in figure 4.)

Figure 4. The graph ~ and the matching M illustrating the transformation from the 2-MS-Matching Problem to the Matching Problem. Edge weights are not shown.

THEOREM 4

If M is a maximum weight matching of G then M n E is a maximum weight MS-matching of G.

Proof

First we show that a maximum weight matching of G must be perfect. It is easy to check that ,~ = { [u, v] I(u, v) ~ A } u { [u, v]'l (u, v) ~ A } L) { [v, v" ] [ v is isolated in D} is a perfect matching of G with weight ~ ( ~ t ) > t VIL (see figure 4). Thus G always has a perfect matching and from the definition of the edge weights ?e it follows that each perfect matching of G has weight at least I VIL. Now let/~t be a non-perfect matching of G, i.e. a matching of cardinality at most I vl - 1.

Page 8: A constrained matching problem

144 A. Hefner, P. Kleinschmidt, A constrained matching problem

At most U VI/2J edges in #1 have weight greater than L so we have e(#1) -< LI V I/2J(L + + (FI v I/2q - 1)L-- (I Vt - 1)L + LI v I/2Jc. < t VtL. But this means that a non-perfect matching of G cannot be optimal.

Now let M be a maximum weight matching of G and let M = M n E. Since is a perfect matching of G- it follows from the construction of G- that M n F is a

I

matching of H which matches all the masters. Hence lemma 3(a) applies and M n E is an MS-matching of G. The weight of /~ is ~( At ) = I VI L + c(M).

In order to show the optimality of M suppose we had an MS-matching M' of G with c(M') > c(M). From lemma 3(b) we know that there is a matching M" of H which contains M' and matches all the masters. We define a perfect matching #1 of G- by #1 = M " u { e ' I e ~ M " } u {[v,v']lv is exposed by M"}. For the weight of #1 we have ?(#1) = I VIL + c(#1 n E) = I VIL + c(M') > I VIL + c(M) = ?(~t) . But this means that M- was not a maximum weight matching of G-which is a contradiction. []

Since our transformation takes O(1VI + IEI) time and the weighted matching problem can be solved in O(I VI 3) time (see [I1]) the 2-MS-Matching Problem can be solved in o ( I v l 3) time, too.

Remark

Consider instances of the 2-MS-Matching Problem resulting from the application mentioned in section 2 where no machine of type 3 is present. In this case the graph G = (V, E) is bipartite with bipartition V = W u U and every connected component of the dependence digraph D = (V,A) is either an isolated node or two nodes in U which are joined by a single arc. We have investigated the polyhedral structure of this subproblem and derived a min-max theorem which characterizes the cardinality of a maximum MS-matching in terms of the weight of a special node cover [8]. This min-max theorem includes as a special case the well-known theorem of Krnig [10] which says that in a bipartite graph a maximum matching and a minimum node cover have the same cardinality.

References

[1] R. Aboudi and K. JCrnsten, Resource constrained assignment problems, Discr. Appl. Math. 26(1990)175-191.

[2] R. Aboudi and G.L. Nemhauser, An assignment problem with side constraints: strong cutting planes and separation, in: Economic Decision Making: Games, Econometrics and Optimization, ed. J.J. Gabszewicz et al. (Elsevier, 1990) pp. 457-471.

[3] R. Aboudi and G.L. Nemhauser, Some facets for an assignment problem with side constraints, Oper. Res. 39(1991)244-250.

[4] V. Aggarwal, A Lagrangian-relaxation method for the constrained assignment problem, Comp. Oper. Res. 12(1985)97-106.

[5] E. Balas, The prize collecting traveling salesman problem, Networks 19(1989)621-636. [6] M.O. Ball, U. Derigs, C. Hildebrand and A. Metz, Matching problems with generalized upper bound

side constraints, Networks 20(1990)703-721.

Page 9: A constrained matching problem

A. Hefner, P. Kleinschmidt, A constrained matching problem 145

[7] M.R. Garey and D.S. Johnson, Computers and Intractability (Freeman, New York, 1979). [8] A. Hefner, A min.max theorem for a constrained matching problem, submitted to SIAM J. Discr.

Math. (1995). [9] A. Itai, M. Rodeh and S.L. Tanimoto, Some matching problems for bipartite graphs, J. ACM

25(1978)517-525. [10] D. KOnig, Gr~ifok 6s aikalmaz~tsuk a determinAnsok 6s halmazok elm61et6ben, Mathematikai 6s

Term6szettudom~inyi i~rtesit6 34(1916)104-119 (in Hungarian). [German transl.: Ober Graphen und ihre Anwendung auf Determinantentheorie und Mengenlehre, Mathematische Annalen 77(1916)453-465.]

[ 11 ] E.L. Lawler, Combinatorial Optimization: Networks and Matroids (Holt, Rinehart and Winston, New York, 1976).

[12] J.B. Mazzola and A.W. Neebe, Resource-constrained assignment scheduling, Oper. Res. 34(1986) 560-572.

[13] M. Padberg and A. Sassano, The complexity of matching with bonds, Inf. Proc. Lett. 32(1989) 297-300.

[14] C.H. Papadimitriou and K. Steiglitz, Combinatorial Optimization (Prentice-Hall, Englewood Cliffs, NJ, 1982).