users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 ?

Thanks in advance.

%----------------------------
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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]