<<

-COMPLETE PROBLEMS AND APPROXIMATE SOLUTIONS

Sartaj Sahni and Teofilo Gonzales

Computer Science Department University of Minnesota Minneapolis, Minnesota

ABSTRACT recognition problems and in order to speak of approximate solutions we shall have to convert We study the class of P-Complete problems and show them to optimisation problems. Thus, the clique the following: problem of [4 J will become the max clique prob­ lem) and i) for any constant e > 0 there is a P-complete b) are there P-Complete problems for which one can problem for which an e-approximate solution can obtain solutions arbitrarily close to the be found in linear time optimal in polynomial time (the of [7] ii) there exist P-Complete problems for which lin­ can get to within 11k of the optimal in O(nk) ear time approximate solutions that get closer time, here we present problems for which one can and closer to the optimal (with increasing get to within 11k in O(n) time, where n is the problem size) can be found space to describe the problem) , remain open. iii) there exist P-Complete problems for which the In this paper, we shall attempt to answer these approximation problems are also P-Complete. questions. The following problems known to be NP-Complete (see KEY WORDS Karp [4 J) shall be used in the reductions:

P-Complete, approximation , polynomial i) Partition: Given s integers (c ,c , •••,c ) is 2 s complexity, k-Partition, k-MaxCut, traveling salesman, there a subset I�{1,2, •••,s} such cycle covers. that E c = E c h h heI htI 1. INTRODUCTION ii) Cut: Given an undirected graph G(N,A) , Our notion of P-Complete corresponds to the one weighting function w : A + Z, positive used in [6] . This can easily be seen to be equivalent integer W, is there a set SeN such that to that of Cook [2]. A problem, L , will be said to E w{u,v} > W be P-Complete iff the following holds: L can be - {u,v}eA solved in polynomial deterministic time iff the class ues of nondeterministic polynomial time languages is the vts same as deterministic polynomial time languages (i.e. P = NP). Knuth [5] suggests the terminology iii) Sum of Subsets: Given n+l positive integers NP-Complete. However, his notion of "completeness" is ( ,r , •••r ,m) , is there a that of Karp [4]. Since the equivalence or non­ l 2 n equivalence of the two notions is not known, we will subset of the r. 's that sums � use the term NP-Complete for problems that can be to m. shown complete with Karp's definition and P-Complete The problems we shall use to answer the questions for those which require the definition of [6]. The posed earlier are: reader unfamiliar with P-Complete problems is referred a) k-Partition: Given n integers r ,r , •••r and to [4] and [6]. All problems that are NP-Complet e l 2 n (i.e. complete under Karp's definitions) are also an integer k � 2, are there P-Complete [2 and 6]. The reverse is unknown. Since disjoint subsets I ,I , •.•,I l 2 k it appears that P � NP, the P-Complete k such that 0 I {1,2, •••n} and problems probably have no polynomial solution. Many i i=l of these problems, especially the optimisation problems, are of practical significance. Often. as in the case of the [7], approximate solutions (i.e. feasible solutions that are guaranteed to be 'reasonably' close to the optimal) would be (The Partition problem i) above acceptable long as they can be obtained 'quickly' is then just the 2-Partition (e. g. by an O(nk) algorithm for small k) . Johnson problem.) [3] and Sahni [7] have studied some P-Complete prob­ lems with respect to obtaining 'good' (i.e. poly­ b) k-Cut: Given and undirected graph G = (N,A), nomial) approximate algorithms. (For·our purposes, integer k � 2, weighting function an algorithm for a maximization problem WillA e said w: A + Z, positive integer W, are to be f(n) -approximate (f.(n) < 1) iff F* - F < f(n) there disjoint sets S ,S "."S such - 2 k F* t k l I that S = Nand l: w(u,v) � W. 0 i for n (F* is the maximum value of the objective i=l {u,v}gA function and F the approximation to the maximum, we ueS i assume F*>O» . For a more formal definition see [7].) ueS However, interesting questions like: j a) are there polynomial time approximation algor­ ;i.�j ithms for all P-Complete problems (note that the (The Cut problem ii) above is just the problems in [4J are stated as language 2-Cut problem. )

28 b' ) Find disjoint sets, S 1 � i � k, i Partition a f/kl -Partition. We prove this only for k 2. From the partition problem (c .c •••• •c ). that s, = N l: > n 2 s such L!:J l and w{u,v} s 3. construct the following r /� lpartition proble� i=l {u,v}EA S c, -< - UES r, l 1 i < i l VES, r,l p s + 1 < i < n J ifj n = 2(s-2) P l:c./2 (if l:c, odd then there is no partition) is maximised. l l Clearly, the partition problem has "a solution iff the n c) [ /J -Partition: same as a) except that the r/� -Partition problem has one. number f disjoint subsets is ..p n n nowin/kl , k � 2. f /kl -Partition a r /f] - MaxCut. The proof for this n is similar to that for k-Partition k-Cut II follows d) f /J Cut: same as b) except the nu�e� of from I and the techniques of [5]. n � disjoint subsets is now I /kl , k 2. • We note that the proofs used in Lemma 1 are minor d') ;/kl -Maxcut: same as b') with k replaced by extensions of the ones used in Karp [4] . The (n-k)­ Partition and (n-k)-MaxCut problems are polynomial. We next prese� an approximation algorithm for the n 2. COMPLETENESS PROOFS AND APPROXIMATIONS k-MaxCut and al /kl-MaxCut problems. Consider the algorithm MAXCUT below: (Intuitively. this algorithm We begin by showing that problems a-d of the intro­ begins by placing one vertex of G into each of the ,Q, duction are P-Complete. sets S, 1 < i < ,Q,; The remaining n-,Q, vertices are examin�d o�e at a time. Examination of a vertex, j, involves determining the set S, 1 < i <,Q, for which Lemma 2.1 l (I) The following problems are NP-COMPLETE l: w{m,j} is minimal. Vertex j is then inserted/ mES, a) k-Partition l b) k-Cut assigned to this set.) c) Inlkl-Partition Algorithm MAXCUT (,Q"G) d) jU/kl -Cut ,Q,•• • number of disjoint sets. S, • into comment. l (II) k-MaxCut and fn/kl -MaxCut are P-Complete. which the vertices, N = (1,2, .••• n), of the graph Proof G(N,A) are to be partitioned.SOL ••• the value of the We have to show that i) if P=NP then a)-d) can be vertex partitioning obtained,w{i.j} ••• weight of the solved in polynomial time and ii) if a)-d) can be edge {i.j} . SET(i) ••• the set to which vertex i solved in polynomial time then the class of P-Complete has been assigned (SET(i) = 0 for all vertices not yet problems is polynomial solvable (this can be shown by assigned to a set). WT(i) ••• used to compute reducing any known P-Complete problem to a)-d». l: w{m.j} , 1 � i � ,Q, i) is trivial. so we shall only show ii). mES ii) Partition a k-Partition. For any Partition i probleIl (c ,c •••• c ) define a k-Partition problem This algorithm assumes that the graph G(N,A) is pre� l 2 s sented as n lists v .v , ••• ,v . Each list v, contains (r ,r ,r l 2 l l 2,,··· s+k_2) where all the edges, {i,j}EA , that � adjacent to vertex i. 1 < i < S No assumption is made on the order in which these edges appear in the list. end comment s + 1 < i < s + k - 2 � > [InitialiseJ If,Q, n --then do (we may assume that l:c, is even as otherwise the - partition problem cleafly has no solution). Now, SOL + l: w{i,j} l:r = kp and the k-Partition problem has a solution i {i,j}EA iff the corresponding Partition problem has one. S + {i} 1< i< n k-Partition g k-Cut i •. .• + !3 If the given k-Partition problem is (r , r ) S,l n+l < i <,Q, l n define the corresponding k-MaxCut problem to be Stop •••• • G = (N,A) with N = (1,2 n) end; A = {{i.j} liEN. jEN, if;t w({i,j}) = r, r, otherwise Set S, + i I < i < ,Q, l J l (k-l) 2 + 0 and W = (l:r,) WT(i) 1 < i �,Q" 2k l SET (i) + i 1 < i < ,Q, < < (Note, we may again assume k divides l:r,l .) SET (i) + 0 .Q, + 1 i n + l: Clearly, there is a k-Cut > W iff (r ,r •• .•,r ) has SOL w{i,j} l 2 n a k-partition. {i.j}EA l�i

lThe k-MaxCut problem is a generalisation of the � [process edge list of vertex jJ 'grouping of ordering data' problem studied in [1). for each edge {j,m} on the edge list of vertex [lJ restricts the sets Si to be sequential. i.e •• if j do ...• i,jES and i < j then i+1.i+2, j-J ES ' [1] f 0 + ,Q, if SET(m) then WT(SET(m» WT(SET(m» + ,Q, 2 - presents an O(kn ) dynamic programming "algorithm for w{j ,m} this. end

29 d. + degree of vertex j = # of edges adjacent to EW = SOL is the approximation obtained by MAXCUT. The J vertex j worst case occurs when TIW approaches EW�-l). Hence � [find the set for which L w{j,m} is minimal] F* SOL ; < l/k. mES I * I i look at WT(a) 1 < a< min{d.+l,�} and determine i • The next two theorems establish the existence of such that WT(i) is minimal Jin this range. (Note P-Complete problems for which linear time approximate that if d. + 1 � � then at least one of WT(a) solutions, that are exceedingly close to the optimal 1 < a < dJ + 1 must be 0 and minimal. For -- j solution value, can be obtained. I.e., there are d. + 1 > � all WT(a) are looked at and the minimal P-Complete problems that can "almost" be solved in J - linear time. In this sense, then, these problems are found.) the simplest P-Complete problems. � [assign vertex j to set S ] i Theorem 2.1 SET(j) + i For any constant c, 0< C < 1, there esists a P­ Complete problem for which an c-approximate solution � [update SOL and reset WT] may be obtained in linear time. for each edge {j,m}EA for which SET(m) � 0 do Proof � + if SET(m) i then SOL SOL + w{j,m} Let k be an integer such the l/k � c. From Lemma WT(SET(m» +-0 -- end 2.1, the k-MaxCut problem is P-Complete. From Lemmas Step 6lnext vertex] j + j+l , 2.2 and 2.3 it follows that an c-approximate solution to this P-Complete Problem may be obtained in linear if j � n then .&2. .!.£ step 2 time. otherwise terminate algorithm • • Theorem 2.2 There exists a P-Complete problem and a linear time Lemma 2.2 f(n)-approximate algorithm with the property that The of algorithm MAXCUT is O(�+n+e) fen) + 0 as n +00, i.e. the approximate solutions get on a random access machine (n is the number of verti­ increasingly accurate as n increases. ces, e the number of edges and � the number of groups into which the vertices are to be partitioned). Proof ---yrom Lemmas 2.1, 2.2 and 2.3 it follows that there Proof is a linear time l/P/� -ap roximate algorithm for � Step Time Per Execution Total Time the P-Complete problem: rn/kl -MaxCut. • 1 O(n+e + �) O(n+e + �) We conclude this section by establishing the exis­ 2 o (d.) o (e) tence of a P-Complete problem for which the approxima­ J tion problem is also P-Complete. 3 O(d + 1) O(e + n) j Theorem 2.3 There is a P-Complete problem that has a polynomial 4 0(1) o (n) time c-approximate (0 < C < 1) algorithm iff P= NP. 5 0 (d.) O(e) J Proof ---yrom any sum of subset problem (r ,r , •••r ,m) 6 0 (1) O(n) construct the following Knapsack typ� ptoblem� Hence total time O(n + e + �) n • max k LO. + 1. 0n+l Lemma 2.3 1 n Algorithm MAXCUT is a l/k - approximate algorithm subject to: L w + w m •••K! for the k-MaxCut problem. ioi n+lon+l 1 Proof l< i k have value k(1-8)< F. By choosing k suitably large, we can make these two In � when vertex j is assigned to set i either ranges disjoint. Hence, form a knowledge of F one WT(i) = 0 (corresponding to d. < �) or J can determine whether or not the sum of subsets WT(i) � L WT(m)/k . problem has a solution. Consequently, the c-approx­ l 1, the Travelling Salesman problem on G has a solution of length n iff G has a cycle) l (iii) Directed Edge Disjoint Cycle Cover: Same as i n CY l Ot s o u t h �:�!�O � � � · (ii) except that G is now a directed graph. � + l. �;r:� �ho:!� � � �i��)n �h:A, ��: (iv) Undirected Vertex Disjoint Cycle Cover: This only solutions approximating a solution with value n (if there was a Hamiltonian cycle in G ) also have problem is the same as (ii) except that now, l the cycles are constrained to be vertex dis­ length n. Consequently, if the £-approximate solution joint. has length �(l+£)n then it must be of length. n. If it (v) Directed Vertex Disjoint Cycle Cover: Same as has length >(1+£) n then G has no Hamiltonian cycle. (iv) except that G is now a directed graph. (ii) - (v) The proofs for (ii) - (v) are similar. We (vi) 0-1 Integer Programming with one constraint. outline the proof for (iv) (vii) Multicommodity Network Flows: We are given a Undirected Hamiltonian Cycle a £-approximate Disjoint transportation network [6J with source s and l Cycle Cover sink s ' The arcs of the network are labeled Given an Undirected graph G(N,A) construct k copies correspondin2 g to the commodities that can be G.� (N �. ,A.) � of this graph. Pick a vertex vEN. Let transported along them. Such a network is said d l 2 ••• to have a flow f if f f units 0 f each commodity u ,u , ,u be the vertices adjacent to v in G (i.e. i < can be transported from source to sink. The (u ,v)£ A 1< i d). Define H.(V.,E.) to be the - k J k J J j problem here is to maximize f. graph with V = � N and E A U {(u v ) j i l i j i�l i l ' i+l I In order to prove some of our results we shall use < 1 � i kJ U {(ua, v )} the following known P-Complete problems: l a) Hamiltonian Cycle: Given an undirected (directed) Clearly, if G has a Hamiltonian Cycle then, for some j, graph G(N,A) does it have a cycle containing each H. has a cycle cover containing exactly one cycle (as vertex exactly once, [4] . J j or some j (v,u b) Multicommodity Flows: Given the transportation f ) are adjacent in the Hamiltonian cycle and using the images of the edges of this cycle in the network of (vii) above does it have a flow of f =1 subgraphs G. (except for the images of the edge [6]. . � . (v,uJ», together with the edges (uJ ,v. )11 < i< k} Before continuing, it is necessary to generalize . i �1 - our definition of approximation algorithm to include {u , v ) one obtains a Hamiltonian cycle for E ). U � l j minimization problems. If G has no Hamiltonian cycle, then the subgraphs G i Definition 3.1 each require at least two disjoint cycles to cover An algorithm will be said to be an £-approximate their nodes. Consequently, the disjoint cycle cover algorithm for a problem P iff either (i) P is a l l for j contains at least k+l cycles, 1 < j < k. For any maximization problem and £, one may choose a suitable k such that from the approximate solutions to H. 1 < j< k one can decide - F* - whether or not G has a Hamflto;ian cycle (i.e. choose <£0<£< 1 k > (HE) . F* Note that the above proof also works for the case of or (ii) I P is ;1a minimization problem and edge disjoint cycle covers. l (vi) Just consider the : F* < £ > 0 Sum of Subsets a £-approximate 0-1 Integer F: � Programming ie min 1 + k(m - w ) where F*I is theFI optimal solution (assumed> 0) and F is l: ioi the approximate solution obtained. subject to w <- m l: ioi ° . Theorem 3.1 � = 0 or 1 The £-approximation problem for (i) - (vii) above is P-Complete. (The minimum = 1 iff there is a subset with sum m otherwise the minimum is � 1 + k) Proof For each of the problems(i) - (vii), it is easy to (vii) Multicommodity flows a £-approximate Multi­ see that if P = NP then the £-approximation problem commodity Flows lA graph G(N,A) is said to be Complete iff for every In [6] it was shown that multicommodity flows pair of vertices u,v£N ufv the edge (u,v)£A. with f = 1 was P-Complete. Given a multi­ commodity network N as in [6J we construct k

31 copies of it and put them in parallel. Another network [5 J Knuth, D. E., "A Terminological Proposal" SI:;ACT with a flow f = 1 is also coupled to the network as in News, Jan. 1974, Vol. 6, No. 1, . 12-18. See figure 3.1. also SIGACT News, April, 1974.

[6] Sahni, S., "Computationally Related Problems", to appear in SICOMP. network with multiconunod­ J ity [7 Sahni, S., "Approximate Algorithms for the 0/1 flow = 1 Kanpsack Problem",to appear in JACM.

Source F-----"'--+--=----l N Sink

N

Figure 3.1

Clearly, the multiconunodity network of figure 3.1 has a flow of k + 1 iff N has a flow of 1. If N does not have a flow of 1 then the maximum flow in the net­ work of figure 3.1 is 1. Hence the approximation problem for multiconunodity flows is P-Complete • •

4. CONCLUSION We have answered some existence problems concern­ ing approximation algorithms for P-Complete problems. Our results show that all P-Complete problems are not equally hard. Some are harder than others in the sense that some P-Complete problems can 'almost' be solved in linear time while for others, the problem of determining even an E-approximate solution is P-Complete. In terms of computational difficulty of the approximation problem, we have exhibited the simplest and the hardest P-Complete problems. We note that some of our results could have been obtained using "padding" techniques. Further, padding tech­ niques also lead to such results as a) there are P­ Complete problems with an O(n) average computing time and b) there are P-Complete problems with a sub­ exponential (e.g. 0(2fn» worst case computing time. However, it remains open whether a) and b) are true for any "natural" P-Co··.plete problem, such as those of [4] and [6].

REFERENCES

[lJ Bodin, L. D. "A Grap\l Theoretic Approach to the Grouping of Ordering Data", Networks, 2, 1972, pp. 307-310.

[2J Cook, S. A., "The Complexity of Theorem-Proving Procedures", Conference Record of Third ACM Symposium on Theory of Computing, pp. 151-158, 1970.

[3J Johnson, D. "Approximation Algorithms for Com­ binatorial Problems", Conference Record of Fifth ACM Symposium on Theory of Computing, 1973.

[4J Karp, R. M.,"Reducibility Among Combinatorial Problems", in Complexity of Computer Computations, R.E. Miller and J.W. Thatcher, eds., Plenum Press, N.Y., 1972, pp. 85-1 04.

32