1000-9825/2002/13(05)0972-08 2002 Journal of Software Vol13, No5,, (, 230026) E-mail: cheneh@ustceducn http://mailustceducn/~zzychm :, NP,,,, (connected row-convex, CRC) Deville,CRC, CRC CRC, (row-convex, RC), PQ (P Q ),CRC O(n 3 d 2 ),,n,d, CRC : ;RC ;CRC ;PQ ;CRC : TP301 : A (constraint satisfaction problem, CSP) :(1) S,S ;(2) S ;(3) S CSP S, CSP, CSP (constraint satisfaction network, CSN),,,, CSN CSP,CSP NP-, CSP,CSP [2~4],CSP : CSP ; CSP, CSP, [5] :RC, [5,6] RC CRC, CRC [5,6],CRC 1 1 [1] : 2000-06-10; : 2001-03-01 : (60005004 973 (G1998030509) : (1968),,,,,,, ;(1972),,,,, ;(1948),,,,,
: 973 N=(Var,D,C), (1) Var={x 1,x 2,,x n },x i,i =1,2,,n; n D i i=1 (2) D=,xi D i,i=1,2,,n,d i x i ; (3) C={C ij x i,x j Var,C ij D i D j,i,j=1,2,,n}, (v,w) C ij C ij (v,w) N=(Var,D,C), :d= max{ D i i=1,2,,n},arc(n)={(i,j) C ij C,i,j=1,2,,n} N=(Var,D,C), D i, D N, C ij C ij D i D j,c ij C ij D i D j M ij v D i,w D j,m vw =1 C ij (v,w),,m vw =0, C ij 2 N=(Var,D,C),(v 1,v 2,,v n )N (i,j) arc(n),(v i,v j ) C ij 3 (RC) N=(Var,D,C),C ij C,C ij C ij 1, 1 0,C ij 4 / M,M 0 ()M () 5 C * ij N=(Var,D,C),C ij x i,x j,c * ij C ij C * ij C ij C ij, x i D i (C ij ),D i (C ij )={v w D, Cij(v,w)} 6 N=(Var,D,C),C ij C C ij,v D i (C ij ),Image(v)={w <v,w> C ij } v C ij,image(v) D j (C ji ) [w 1,w m ] w 1 =min({w C ij (v,w)} w m =max({w C ij (v,w)}) C ij, w Dj(C ji ),Pred(w,D j (C ji )) w D j (C ji ),Succ(w,D j (C ji )) w D j (C ji ) D j (C ji ),D j (C ji ), Succ(w),Pred(w) w 7 N=(Var,D,C),C ij C C ij,c * ij [a,b][a,b ] b Pred(a) a Succ(b),C ij, (b Pred(a) a Succ(b)),b <Pred(a) a >Succ(b), [a,b][a,b ],[a,b] [a,b ]=, 8 (CRC) N=(Var,D,C),C ij CC ij C * ij,c * ji ;C * ij,c * ji [5] :C * ij,c * ji,c * ij C * ji C * ij,c * ji RC CRC : CRC (),CRC RC, CRC, CRC RC ;, RC,RC CRC 1 RC CRC 1, 1, 0 1 RC CRC,CRC RC
974 Journal of Software 2002,13(5) RC constraints CRC constraints Fig1 Matrix representation of binary RC and CRC constraints 1 RC CRC [6] RC, PQ- [7] U={u 1, u 2,,u m } PQ U,, U, U ; :P Q PQ (reduce), :Bubble ReduceBubble(T,S) S PQ T,Reduce(T,S) Bubble(T,S) PQ M 1 ( 1) 1, M m n (0,1)-,M 0 f, O(m+n+f) 1 M 1 Boolean Procedure Consecutive(M) Let U be the set of column in M; T=T(U,U For j=1 to n //n M Let S be the set of columns which have a one in row j; T:= Bubble(T,S T:=Reduce(T,S if T=T(ϕ,ϕ) then return false Return true N=(Var,D,C), [6] N=(Var,D,C) Findorder(C,n) O(n 3 d 2 ),,n= Var,d,d=max{ Di,i=1,2,,n} 2 CRC 21,,,,,,,, 1:
: 975 1111 1111 A= 1110,A = 1011,A A 24, 1100 1001 1000 1000 RowIndex(A)=<(1,1),((2,2),(3,3),(4,4)>,ColumnIndex(A)=<(1,1),(2,2),(3,3),(4,4)>, RowIndex(A)=<(1,1),((2,2),(3,3),(4,4)>,ColumnIndex(A)=<(1,1),(2,4),(3,3),(4,2)>, RowIndex(A)A, (a,b),a,b ColumnIndex(A)A, (a,b),a,b 2 void Swap_Matrix (M,flag,n1,n2) //M,flag,n1,n2 int temp; list *worklist; // flag if (flag==row) worklist = MRowIndex; else worklist = MColumnIndex; temp = worklist[n1]b; worklist[n1]b = worklist[n2]b; worklist[n2]b = temp 2, n 2 O(1), O(n),, m n, m+n, 3 void indexmatrix(m) //M Mrowindex = (list*)mcalloc(indexnode,mrowsize Mcolumnindex = (list*)mcalloc(indexnode,mcolumnsize For(i=0;i<Mrowsize;i++) Mrowindex[i]a = Mrowindex[i]b = i; For(i=0;i<Mcolumnsize;i++) Mrowindex[i]a = Mcolumnindex[i]b = i 22 CRC M m n (0,1),CRC M i i, i Image(i)min(Image(i)) i 1,max(Image(i)) i : 1 min(image(1))min(image(2)) min(image(m) 2 max(image(i))max(image(i+1)) max(image(i+k)), min(image(i))=min(image(i+1))= =min(image(i+k)), 1i,i+km; M CRC 1, 2 CRC CRC CRC C, C C C, 1, 2, CRC C max(image(i))=max(image(i+1))= =
976 Journal of Software 2002,13(5) max(image(i+k))min(image(i))=min(image(i+1))= =min(image(i+k)),1i,i+km C i,i+1,,i+k 1 CRC CRC :C CRC,row(C) C,C C row (C) (1) row(c)=1,c=c, ; row(c)=2,c,c= C,,,C CRC,C CRC (2) row(c)=k, row(c)=k+1,[a,b],turbo([a,b]) [pred(a),succ(b)]; min(image(k+1))=min({min(image(i)) i=1,2,,k} C k C k,c CRC,C k CRC row(c k ) =k, C k C k,c k CRC C k,k+1 Image(k)Image(k+1),C k k Image(k ),,Image(k)Image(k : Turbo(Image(k)) Image(k+1), Turbo(Image(k )) Image(k+1), C k+1 C k k+1 C k,c k CRC C k,c k C min(image(k+1))min({min(image(i)) i=1,2,,k}, C k C k,c CRC,C k CRC row(c k )=k, C k C k C k CRC C k 1,2,,k, min(image(1 ))min(image(2 ))min(image(k )) C k Image(1),,Image(k)), C k CRC, {min(image(1 )),,min(image(k ))}={min(image(1 )),,min(image(k ))} min(image(k+1)) min({min(image(i)) i=1,2,,k} min(image(k+1)) min({min(image(i )) i=1,2,,k} i{1,2,,k 1},min(Image(i ))min(image(k+1))min(image((i+1) )) Turbo(Image(i )) Image((i+1) ) min(image(i ))min(image(k+1)) turbo(image(k+1)) Image((i+1) ) C k+1 C k i (i+1) C k CRC C k C,,Row(C)=k+1 (1),(2), m,row(c) = m 2 CRC :CRC C 3 RC, CRC, CRC :CRC CRC ;CRC 4 CRC RC :CRC,CRC RC,CRC RC,CRC RC CRC, RC, CRC
: 977 RC 23 CRC CRC, 1 PQ, 4 4 M T, //T PQ PQTree Procedure Consecutive(M,T) For j=1 to n Return T //n M Let S be the set of columns which have a one in row j; T:=Bubble(T,S T:=Reduce(T,S If T=T(, ) then return NULL Findorder 4 CRC, N=(Var,D,C), C CRC 5 CRC CRC_Findorder (C,n) L={1,2,,n} For m = n downto 1 Do //n j L, : i L,C * ij ( j, ) ; D j // 4 C ij, T 4, //1 4,T = T(D j,d j ) For i=1 to n do If C ij C then C ij * RC ; * RC C ij ; * C ij, ; X j m; L=L {j} 5 C, 5, C CRC : 5 ~, RC N=(Var,D,C), C RC ( [6] ) ~ RC 3 RC CRC RC CRC, CRC (),CRC RC, CRC, 4 CRC RC
978 Journal of Software 2002,13(5) 6 5 O(n 3 d 2 ), n= Var,d=max{ D i i=1,2,,n} : ~, 5 O(n 3 d 2 ) [6] ~ C n C, C, C =O(n 2 ), 2 O(d), 2 ), 5 O(n 3 d 2 )+O(n 2 ) [O(d)+O(d)+O(d 2 )]=O(n 3 d 2 ) [5] CRC CRC, [6] O(n 3 d 2 ), 5 3 CRC, CRC [5] CRC, CRC,CRC, CSP CRC References: [1] Mackworth, AK Consistency in networks of relations Artificial Intelligence, 1977,8(1):99~118 [2] Dechter, R, Pearal, J Network-Based heuristics for constraint satisfaction problem Artificial Intelligence, 1988,34(1):1~38 [3] Montanari, U Networks of constraints: fundamental properties and application to picture processing Information Science, 1974, 7(1):95~132 [4] Henterryck, PV, Deville, Y, Teng, CM A generic arc-consistency algorithm and it s specializations Artificial Intelligence, 1992, 57(2):291~321 [5] Beek, PV On the minimality and global consistency of row-convex constrain networks Journal of the Association for Computing Machinery, 1995,42(3):543~561 [6] Deville,Y, Barette, O, Henterryck, PV Constraint satisfaction over connected row-convex constraints Artificial Intelligence, 1999,109(2):243~271 [7] Booth, KS, Lucker, GS Testing for the consecutive ones property, interval graphs and graph planarity using PQ-Tree algorithm Journal of Computer and System Sciences, 1976,13(2):335~379 A Fast Recognition Algorithm of CRC Constraint Networks CHEN En-hong, ZHANG Zhen-ya, WANG Xu-fa (Department of Computer Science and Technology, University of Science and Technology of China, Hefei 230027, China) E-mail: cheh@ustceducn http://mailustceducn/~zzychm Abstract: Constraint networks provide a useful framework for the formulation of many problems in computer science In general, constraint satisfaction problems are NP-Complete Many problems specially restrict the structure of constraints or the form of the constraints, then allow them to be solved efficiently For the identification of such tractable constraints, much work has been devoted to the study of special classes of constraints or constraint networks As pointed out by Deville et al, a class of connected row-convex (CRC) constraints is shown to be tractable This paper intends to find an efficient recognition algorithm for the class of constraint networks In this paper, a standardized form for the CRC constraint matrix is proposed based on the related findings on CRC
: 979 constraint networks The basic characteristics of the standardized form are analyzed, and a fast algorithm is provided for the recognition of CRC constraint networks based on a recognition algorithm of the RC constraint network, properties of PQ tree (a tree composed by P nodes and Q nodes)and an indexed matrix representation of constraints The time complexity of the algorithm is O(n 3 d 2 ), where n is the number of variables in a constraint network and d is the maximum size of the domain for each variable It reaches the optimum time complexity for a CRC constraint network recognition algorithm, and hence provides a feasible solution to practical CRC constraint satisfaction problems Key words: binary constraint network; RC constraint network; CRC constraint network PQ-Tree; the standardized form for CRC constraint matrix Received June 10, 2000; accepted March 1, 2001 Supported by the National Natural Science Foundation of China under Grant No60005004; the National Grand Fundamental Research 973 Program of China under Grant NoG1998030509 2002 2002 2002 10,, 38 38, 5, ; 6 6000, ( ), (1) ( (2) ( (3) ( (4) ( (5) ( (6) ( (7) ( (8) ( ) :2002 6 30 :2002 7 30 :2002 8 15 : (410083) :,0731 8830797 czg@csueducn,0731 8876677(Tel/Fax) x-info@csueducn,0731 8830700 infob@csueducn