From k-SAT to k-CSP: Two Generalized Algorithms

Constraint satisfaction problems (CSPs) models many important intractable NP-hard problems such as propositional satisfiability problem (SAT). Algorithms with non-trivial upper bounds on running time for restricted SAT with bounded clause length k (k…

Authors: Liang Li, Xin Li, Tian Liu

F rom k -SA T to k -CSP: Tw o Generalized Algorith ms 1 Liang Li, Xi n Li, Tian Liu, Key L ab or atory of High Confidenc e Softwar e T e chnolo gie s (Pek ing University), Ministry of Educ ation, CHINA Institute of So ftwar e, Scho ol of Ele ctr onics Engine ering and Computer Scienc e, Peking University, Beijing, 100 871, CHINA Ke Xu National L ab of Softwar e Development Envir onment, Scho ol of Computers, Beihang University, Beijing 1000 83, China. Key wor ds: Constrain t Satisfaction, An alysis of Algorithms 1 In tro duction Constrain t satisfaction problems (CSPs) mo dels man y imp ortant intractable N P -hard pro blems suc h as prop ositional satisfiability problem (SA T) [1]. Al- gorithms with non-trivial upp er b ounds on running time for r estricted SA T Email addr esses: l t@pku.ed u.cn ( Tian Liu), k exu@nlsde .buaa.ed u.cn (Ke Xu). 1 P artially sup p orted b y the National 973 Program of China (Gran t No. 2005CB3 21901 ). Preprint submitted to Elsevier 22 No vem b er 2021 with b ounded clause length k ( k - SA T) can be classified in to three st yles: DPLL-lik e, PPSZ-like and Lo cal Searc h [2 ], with lo cal searc h algorithms ha v- ing already b een generalized to CSP with b ounded constrain t arity k ( k -CSP) [5]. W e generalize a DPLL- lik e algo rithm in its simplest for m a nd a PPSZ- lik e alg orithm [4 ] from k -SA T to k - CSP . As far as w e know, this is t he first attempt to use PPSZ-lik e strategy to solv e k -CSP , and b efore little w ork has b een fo cused on the D PLL-lik e or PPSZ-lik e strategies for k -CSP . F or the DPLL- lik e deterministic k -CSP alg o rithm, a recurren t ineq ualit y is tigh tly solv ed to get a non-trivial upp er b ound O ∗ (( d − d − 1 d k ) n ) on running time, where n is the n um b er of v ariables and d is the domain size of v ariables in input. F or the PPSZ-lik e randomized k -CSP algorithm, the Satisfiability Co d- ing Lemma [4 ] is extended to non-Bo o lean case to show that with probabilit y approac hing 1, a satisfying assignmen t can b e fo und in time O ∗ (( d k q d − 1 d ) n ). O ∗ indicates that some po lynomial factor in n is ignored in big- O natation. CSP generalizes SA T in tw o asp ects: eac h v ariable can hav e more than t w o a v ailable v alues, and eac h constraint can hav e more than one falsifying partia l assignmen ts. These falsifying pa r tial assignmen ts t o some constraint are called no go o ds . F or example, in graph 3- coloring pro blem a constrain t of tw o v ariables x and y with domain { 0 , 1 , 2 } has tuples of v alues suc h as ( x : 0 , y : 0), ( x : 1 , y : 1) and ( x : 2 , y : 2) as its nogo o ds. If the first k − 1 v ariables in a constrain t with arity k hav e v alues in agreemen t with a nogo o d, then the last v ariable cannot ha v e the v alue sp ecified b y the nogo o d, so a s not to falsify this constrain t . Suc h a v aria ble is th us called narr ow ly chosen . Our g eneralizations ro oted from the k ey observ atio n that no go o ds (inste ad of c onstr aints) in CSP c an b e tr e ate d as clauses in SA T to pr o duc e narr ow ly chosen va riables whic h can b e exploited b y algorithms to reduce their searc h efforts. 2 The remainder of the pap er is or g anized a s follo ws. Section 2 describ es a nd analyzes the generalized D PLL-lik e determinis tic k -CSP algorithm. Section 3 extends the original satisfiabilit y co ding lemma [4] to non-Bo olean case. Section 4 presen ts the PPSZ-like ra ndomized k - CSP algorithm and its analysis. 2 The DPLL-lik e Det erministic k -CSP Algorithm Our DPLL- lik e algorithm for k -CSP with v ariables domain size d w orks as follo w: for any nogo o d ( u 1 : a 1 , ..., u k : a k ), branch on u 1 to d − 1 branches , on each branc h a v alue o ther than a 1 and also differen t from v alue assigned on other sister branc hes is a ssigned to u 1 and then recursiv ely g o do wn the branc h. If all these branc h fails to find a satisfying assignmen t, then fix u 1 to v alue a 1 and branc h on u 2 in exactly the same w ay as on u 1 except that this time the num b er of remaining v ariables decreased by one. Denote the running time of this algorithm by T ( n ), then clearly for d ≥ 2 and k ≥ 2: T ( n ) ≤ ( d − 1)( T ( n − 1) + ... + T ( n − k )) + p oly( n ) . (1) Note t ha t as usual w e can safely ignore the additiv e p oly( n ) term a t righ t hand side and treat the inequalit y as an equation. When d is a fixed constant, linear recursion (1) has solution T ( n ) = O ∗ ( λ n ) with λ the maximum ro ot in c haracteristic equation f ( λ ) = λ k − ( d − 1)( λ k − 1 + ... + 1) = 0. Since λ > 1, our tric k is to find t he maxim um ro o t in equation g ( λ ) = ( λ − 1 ) f ( λ ) = λ k +1 − dλ k + ( d − 1 ) = 0. g ( λ ) is strictly increasing when λ > d (1 − 1 k +1 ). W e can find that when λ ≥ d − d − 1 d k , g ( λ ) > 0; when λ = d − 1 d k − 1 , g ( λ ) < 0. Hence the tigh t solution of (1 ) is T ( n ) = O ∗ (( d − d − 1 d k ) n ). 3 When d is not fixed and v aries with n , sp ecifically d = n α with α a constan t , this case mo dels some pra ctical problems (e.g. the Latin square problem and the N -queen problem) and a random CSP mo del (called Mo del RB ), whic h con t ains man y hard instances seemingly quite challenging for v arious kinds of algorithms, b oth theoretically [7] and exp erimen tally [6], and a trivial upp er b ound is O ∗ ( n αn ). Rewrite the recursion (1 ) as T ( n ) = ( n α − 1)( T ( n − 1) + ... + T ( n − k )) . (2) When α ≤ 1, for an y fixed ǫ > 0, for larg e n with n α − 1 > 1 ǫ , w e hav e P n − 1 i = n − k T ( i ) < ǫT ( n ), so f o r large enough n (actually n + 1 will b e fine for ab ov e n ): T ( n ) ≤ ( n α − 1)( T ( n − 1) + P n − 2 i = n − k T ( i )) < ( n α − 1)( T ( n − 1) + P n − 2 i = n − k − 1 T ( i )) < ( n α − 1)( T ( n − 1) + ǫT ( n − 1)) < n α (1 + ǫ ) T ( n − 1). Substitute n by smaller n um b ers and com bine t hese inequalities , we ha v e for any fix n um b er ǫ > 0: T ( n ) = O ∗ (( n !) α (1 + ǫ ) n ) = O ∗ (( n e ) αn (1 + ǫ ) n ). When α > 1, there is some n um b er β with 1 < β < α , suc h that fo r sufficie n tly large n , ( n − 1) α − 1 > n β , so T ( n ) ≤ ( n α − 1)( T ( n − 1) + P n − 2 i = n − k T ( i )) < ( n α − 1)( T ( n − 1) + P n − 2 i = n − k − 1 T ( i )) = ( n α − 1)( T ( n − 1) + 1 ( n − 1) α − 1 T ( n − 1)) < n α (1 + 1 n β ) T ( n − 1) . Since Q ∞ n =1 (1 + 1 n β ) con v erges to a finite n um b er, b y applying the same a na lysis as in a b o v e paragra ph, we hav e T ( n ) = O ∗ (( n e ) αn ). 3 A Generalized Satisfiabilit y Co ding Lemma Abbreviation w.r.t. means with r esp e ct to . Our k ey generalization to a defini- tion in [4 ] ab out isolate d p oin ts , critic al p oi nt and critic al va riables is: Definition 1 . F o r a k -CSP instance F with domain D f o r its n v ariables, 4 call X = ( a 1 , ..., a i , ..., a n ) an isolate d p oi nt w.r.t. a set S ⊆ D n if there exists a dimension i ∈ { 1 , 2 ..., n } and a n a ′ i ∈ D − { a i } suc h that X ∈ S but X ′ = ( a 1 , ..., a ′ i , ..., a n ) 6∈ S . Call suc h a dimension i a critic al p oint of X w.r.t. S and the v ariable u i at dimension i a critic a l variable . W e only require tha t ther e exist a ′ i ∈ D − { a i } suc h that X ∈ S but X ′ = ( a 1 , ..., a ′ i , ..., a n ) 6∈ S , rather than that for al l a ′ i ∈ D − { a i } (whic h can only w or k fo r SA T but not for CSP). This righ t c hoice (whic h w orks for b oth SA T and CSP) mak es t he follow ing tw o generalized lemmas and the g eneralized algorithm with analysis in next section straigh tforw ard to follow the routine in [4], a s follo ws. Denote the n umber of critical p oin ts of X w.r.t. S by J S ( X ). Call X j-isolate d w.r.t. S if X is an isolated p oin t in exactly j dimensions w.r.t. S . Call an n -isolated solution X a n isolate d so lution . When S is the set of all solutions of F , w e can omit the w ords w.r.t. S . When solution X = ( a 1 , ..., a i , ..., a n ) has a critical p oin t i , there m ust b e a constraint with a nogo o d in agreemen t with X except only in flipping a i to some a ′ i ∈ D − { a i } . Call suc h a constrain t critic al . In any v alue assigning sequence of v ariables, if a critical v ariable u i is assigned v alue last among all the v ariables in its critical constraint, and all o t her v ariables than u i are assigned v alues in agreemen t with X , then the v alue a ′ i should not b e assigned to u i (otherwise t he critical constraint will b e f a lsified), thus the domain of u i is na r r o w ed. Call suc h a v ariable u i narr ow ly chose n , otherwise ful ly chosen . F or any giv en pa rtial assignmen t and any constraint, we can efficien tly c hec k if a v aria ble in this constrain is narro wly chos en: it is narro wly c hosen iff o ther v ariables in this constrain has assigned v alues in agreemen t with a no go o d for this constrain t, and eve ry constrain t with arit y k can ha v e at most d k nogo o ds. 5 Lemma 1 Let F be a k -CSP instance with a j -isolated solution X . Then o v er all v alue assigning sequences of v ariables with the final v alue assignmen t X , t he av erage n umber of narro wly c hosen v aria bles is at least j /k , th us t he a v erage n umber of fully c ho sen o nes is at most n − j / k . Pro of: (As in [4]) F or a r andom v alue assigning sequ ence σ , since no constrain t in v olve s more than k v ar ia bles in a k -CSP instance, the probabilit y that a critical v ariable is assigned last among all the v a riables in its critical constrain t is at least 1 /k . F or eac h critical constrain t, if the corresponding critical v ar ia ble is last assigned, then this v ariable will b e narrow ly c ho sen. The j - isolated solution X has exactly j critical p oin ts a nd these j critical v a r ia bles eac h has a critical constraint. Th us, t he a v erage n um b er of na r ro wly c hosen v ariables is at least j / k when X is the final assignmen t. With a total num b er of v ariables n , the a v erage n um b er of fully c hosen v ariables is no mor e than n − j /k . Q.E.D. Lemma 2 If a nonempt y set S ⊆ D n with | D | = d , then P x ∈ S ( 1 d ) n − J s ( x ) ≥ 1. Pro of: ( By induction on n as in [4].) Case n = 0 is trivially true. F or n > 0, consider a fixed dimens ion, sa y n . Assume D = { a 1 , ..., a d } and divide the set S in to d subsets S 1 , ..., S d , suc h that S i = S ′ i × { a i } with S ′ i the pro jection of S i to the first n − 1 dimensions. F o r a n y X in nonempt y S i , denote the image of X in S ′ i b y X ′ , then induction hypothesis say s P x ∈ S ′ i ( 1 d ) n − J S ′ i ( x ) − 1 ≥ 1 . Since S is nonempt y , some S j is nonempt y . F or any X ∈ S j , dimension n is surely a critical p oin t o f X w.r.t. S j , so J S j ( X ) = J S ′ j ( X ′ ) + 1. On the other hand, dimension n is a critical p oint of X w.r.t. S iff some S i is empt y . Sa y S i is empt y , then dimension n is a critical p oin t of X w.r.t. S , so J S ( X ) = J S j ( X ). In this case P x ∈ S ( 1 d ) n − J S ( x ) ≥ P x ∈ S j ( 1 d ) n − J S ( x ) = P x ∈ S j ( 1 d ) n − J S j ( x ) = P x ∈ S ′ j ( 1 d ) n − J S ′ j ( x ) − 1 ≥ 1. If no S i is empt y , t hen dimension n is not a critical 6 p oin t of X w.r.t. S , so J S ( X ) = J S i ( X ) − 1. In this case P x ∈ S ( 1 d ) n − J S ( x ) = P d i =1 P x ∈ S i ( 1 d ) n − J S ( x ) = P d i =1 P x ∈ S i ( 1 d ) n − J S i ( x )+1 = P d i =1 P x ∈ S ′ i ( 1 d ) n − J S ′ i ( x ) = 1 d P d i =1 P x ∈ S ′ i ( 1 d ) n − J S ′ i ( x ) − 1 ≥ 1 d P d i =1 1 = 1. Q.E.D. 4 PPSZ-lik e Randomized k -CSP Algorit hm Our PPSZ-like algorithm for k -CSP and its analysis generalize from one for k -SA T [4] with the k ey observ ation that w e can use a pa r tial assignmen t a nd nogo o ds to efficien tly pro duce narrowly chosen v ariables w.r.t. some v alue assigning sequenc e of v a riables, as explained in intro duction and last sections. Algorithm A rep eat n ( n + 1)( d k q ( d − 1) /d ) n times while there exists an unassigned v ariable select an unassigned v ariable y at random if y is narrowly c hosen then set y to a random v alue in the nar r o w ed domain else set y to a random v alue in its full domain if the CSP instance is satisfied, then output the assignmen t No w w e pro v e that Algor it hm A can find a solution to a satisfiable k -CSP instance F in time O ∗ (( d k q d − 1 d ) n ) with probabilit y approaching 1. Supp ose that X is an j -isolated solution of F with j critical p oints (1 ≤ j ≤ n , since j = 0 is a trivial case of tautology input without any nogo o d). In o ne iteration of the rep eat lo op, b y lemma 1, the a v erag e num b er of critical v ar ia bles a s- signed last among all the v ariables in its critical constrain t is at least j /k , ov er the random v alue assigning sequenc es of v ariables in the while lo op. Then b y 7 Mark ov inequalit y (on complemen t ev en t), the probability of the ev ent t hat for at least j /k critical constrain ts, the critical v ariables o ccur la st among the v ariables in the critical constraint, is at least 1 n − j /k +1 . When t his ev en t o ccurs, the num b er of fully (narro wly) c hosen v ariables is at most n − j /k (at least j /k ) , and eac h fully (narrowly) c hosen v ariable’s v alue has probability exact 1 d (at least 1 d − 1 ) to agree with the corresp onding v alue of X , so the pro ba bilit y of the ev ent that the v alues assigned to the v ariables in while lo op agree with the assignmen t X is a t least ( 1 d ) n − j /k ( 1 d − 1 ) j /k conditioned on the ab o v e ev ent. Th us, the pro ba bilit y that a j -isolated solution X of F is output by algorithm A is a t least 1 n − j /k +1 ( 1 d ) n − j /k ( 1 d − 1 ) j /k . By summing up this probabilit y ov er set S of all solutions of F and b y lemma 2, the probabilit y that a lgorithm A outputs some solution is at least P x ∈ S 1 n − J S ( X ) /k +1 ( 1 d ) n − J S ( x ) /k ( 1 d − 1 ) J S ( X ) /k ≥ 1 n +1 ( 1 d ) n − n/k ( P x ∈ S ( 1 d ) n − J S ( X ) ) 1 /k ( 1 d − 1 ) J S ( X ) /k ≥ 1 n +1 ( 1 d ) n − n/k · 1 · ( 1 d − 1 ) n/k = 1 n +1 ( d k q d − 1 d ) − n . So by rep eating the w hile lo op n ( n +1)( d k q d − 1 d ) n = O ∗ (( d k q d − 1 d ) n ) times, w e can find a satisfying assignmen t with probability approac hing 1. When d = n α , this upper b o und b ecomes O ∗ ( n αn (1 − 1 kn α ln n ) ). 5 Conclusion and F uture W ork W e hav e generalized t w o alg orithms fr o m k -SA T to k - CSP , with running time b etter than the trivial b o und O ∗ ( d n ) when v ariable domain size d is fixed. When d is unfixed, say d = n α , the result is o nly slightly b etter than the trivial b ound O ∗ ( n αn ), whether w e can reac h O ∗ ( n β n ) (where β < α is a constan t) in this case is still op en. Our solutions to the recursion (1 ) and (2) might find other application in the analysis of D PLL- lik e algor it hms. Our randomized algorithm is the first application of PPSZ-like strat egy b eyond SA T to CSP . 8 In summary , this pap er can b e view ed as the first step to ward establishing upp er b ounds for solving k -CSP using DPLL-lik e or PPSZ-lik e strat egies, whic h leav es mcuh ro om for further study and improv emen t, for example, by com bining PPSZ-lik e a nd lo cal searc h algorithms as in [3]. References [1] Dec hter, R., C onstrain t Satisfaction, in the M IT Encyclop e dia of the Co gnitive Scienc es (MITECS). January , 1998 [2] Dan tsin , E., Hirsc h, E. A., Iv anov, S. and Vsemir n o v , M., Algorithms for SA T and Upp er Bounds on Th eir Complexit y . Ele ctr onic Col lo quium on Computation al Complexity , Rep ort No.12(20 01). [3] Iw ama, K., T amaki, S., Impr o ved Upp er Bound s for 3-SA T, Pr o c e e dings of the fifte e nth annual ACM-SIAM symp osium on D iscr ete algorithms (2004), 328-3 29. [4] P aturi, R., Pudlak, P ., Zane, F., Satisfiabilit y Co din g Lemma, Pr o c e e dings 38th Annual Symp osium on F oundations of Computer Scienc e (1997) , 566- 574. [5] Sc honing, U., A Probabilistic Algorithm for k -SA T and Constrain t Satisfaction Problem, P r o c e e dings 40th Annual Symp osium on F oundations of Computer Scienc e (1999), 410-414. [6] Xu, K. , Bo ussemart, F. , Hemery , F. and Lecoutre, C . , Random Constrain t Satisfaction: Easy Generation of Hard (Satisfiable) I nstances. Artificial Intel ligenc e , 171(2007) :514-53 4. [7] Xu, K. and Li, W., Man y h ard examples in exact p h ase tr ansitions. The or e tic al Computer Scienc e , 35 5(2006 ):291-3 02. 9

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment