Thursday, 15 August 2013

Enumerating domains in Prolog's clpfd -


I am searching for dependents of such constraints:

  assign (X, Y): - 1. In Excel, 1..5, ((x mod 2 = 1) # => 2..3 in Y, ((x mod 2 = 0) # = & gt; Y = = 5).  

What I see is a representation of the domain of x and y which is probably in the form of sparse - this In case it would be something in {lines> X} {1,3,5} and Y in {2,3} or X {2,4} and Y = 5 .

One way to do this is by # = & gt; To find all the variables on the left side of , tell all their values ​​and collect them and merge together, code>? - Assign (X, Y), Findal (XD, (Indomman (X), FD_Dom (Y, D)), C), do stuff with C, but maybe there is a more efficient method?

An error has been encountered trying me on the label ([X, Y]) : Arguments have not been done adequately, when I < I add another obstacle to code> y domain

when should I expect this error to happen? I think I have less understanding of the mechanisms and limitations of CLPFD, is there a resource that I can learn? I already know the basics of hindering programming, arc continuity etc.

clpfd calculation prediction (e.g. < ever by throwing instant errors, code> indomman / 1 , label / 1 , labeling / 2 , etc.) Make sure All variables have been performed from any calculated actions before finite domain .

Have you written the code?

  Assign (X, Y): - In x 1/3/5, y 2..3 Allocated in x and y {2,3} in {1,3,5} (x, y): - 2. In x, 5, or y in {2,4} and Y = 5 a simple question ( With SWI-Prolog):  
 ? - Assign (x, y), labeling ([], [x, y]). X = 1, Y = 2; X = 1, Y = 3; X = 3, Y = 2; X = 3, Y = 3; X = 5, Y = 2; X = 5, Y = 3; X = 2, Y = 5; X = 3, Y = 5; X = 4, Y = 5  

No comments:

Post a Comment