users-prolog
[Top][All Lists]

## partial/full AC

 From: fred bapst Subject: partial/full AC Date: Mon, 31 Mar 2003 08:31:16 +0200 (CEST)

```Keywords: constraints, CLP, arc consistency,
propagation

Hello,

I thought that the difference between '#=' and '#=#'
was efficiency, not semantic...

Can anybody explain why the following 2 versions
produces different results on gprolog 1.2.8 ?

%----------------------------
probl(Ls) :-
Ls = [A,B,C],
fd_domain(Ls,5,20),
fd_domain([AA,BB,CC],1,400),
AA#=#A*A, BB#=#B*B, CC#=#C*C,  % full AC
AA + BB #= CC,
fd_labeling(Ls).
%----------------------------
probl2(Ls) :-
Ls = [A,B,C],
fd_domain(Ls,5,20),
fd_domain([AA,BB,CC],1,400),
AA#=A*A, BB#=B*B, CC#=C*C,     % partial AC
AA + BB #= CC,
fd_labeling(Ls).

%----------------------------
| ?- probl1(Ls).
Ls = [6,8,10] Ls = [8,6,10]

| ?- probl2(Ls).
Ls = [5,12,13] Ls = [6,8,10]   Ls = [8,6,10]
Ls = [8,15,17] Ls = [9,12,15]  Ls = [12,5,13]
Ls = [12,9,15] Ls = [12,16,20] Ls = [15,8,17]
Ls = [16,12,20]

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

```