clp problem w/ gnu prolog



I wanted to collect a subset of variables from a list and establish an
'all_different' constraint. test1 works correctly, but I won't know the
size of the list in my real program. test2 does the same thing as test1
but the constraints don't work. Why is that?


% This runs correctly
test1(L) :-
fd_domain(L,1,4),
L = [A,B,C,D],
fd_all_different([A,B]),
fd_all_different([C,D]),
fd_labeling(L).

| ?- length(L,4),test1(L).
L = [1,2,1,2] ?

% This doesn't work the same.
test2(L) :-
fd_domain(L,1,4),
findall(V1,(for(C1,1,2),nth(C1,L,V1)),As),
findall(V2,(for(C2,3,4),nth(C2,L,V2)),Bs),
fd_all_different(As),
fd_all_different(Bs),
fd_labeling(L).

| ?- length(L,4),test2(L).
L = [1,1,1,1] ?

.



Relevant Pages

  • Re: ALAP scheduling
    ... ALAP is a possible constraint in Project too. ... you definitely didn't phrase it like that) then test1 goes on the ... We have a task Fab1 that has to be done before Test1 can begin. ...
    (microsoft.public.project)
  • Re: Junit newbie
    ... > time in junit versus my actual class. ... > iteratively test de/compressing a single byte array with the values ranging ... As to what if test2 requires test1 to pass? ...
    (comp.lang.java.help)
  • Re: semBCreate, SEM_Q_FIFO
    ... The problem is definitely one of context switching and scheduling. ... The two tasks (test1 and test2) were at the same priority. ... next iterations of task1 will be so fast that task1 will finish ...
    (comp.os.vxworks)
  • Re: Changing the local admin password base on the computers OU
    ... You can put the common code of the two IF-bodies in front of them, ... 'Change the local admin pwd for OU TEST1 ... 'Change the local admin pwd for OU TEST2 ... I do not know what it means to test for a computers membership in ...
    (microsoft.public.scripting.vbscript)
  • Re: Validation Options with option List
    ... If you are talking about actual tests (e.g. test1 has several questions, ... test2 has several questions and so on) you can do this. ... > Could you not just add a simple IF test in an adjoining cell ... >> i have set up an validation list option in Excel so i can choose what ...
    (microsoft.public.excel.misc)