users-prolog
[Top][All Lists]
Advanced

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

Re: prolog: CLP-problem


From: bartek
Subject: Re: prolog: CLP-problem
Date: Sun, 18 Apr 2004 23:13:17 +0200
User-agent: Internet Messaging Program (IMP) 3.2.3

Hi,
I'm not much of a CLP hacker, but I've tried to translate your program into GNU
FD solver and I came up with something like this:


test(Elements):-
        domein(Elements),
        control(Elements),
        findall(Elements,fd_labeling(Elements),List),
        write(List),
        nl.

control([Elem1,Elem2]):-
        (Elem1 #<3 #/\ Elem1 #>0) #\/ (Elem2 #<3 #/\ Elem2 #>0).

domein(Elements):-
        domein2(Low,High),
        fd_domain(Elements,Low,High).

domein2(Low,High) :-
        Low #= 1,
        High #= 4. 
It seems to do the job, however, I'd personally like to know how to do this
better.
--
regards 
   Bartek Wilczynski

Cytowanie Wim Vleugels <address@hidden>:

> Hello,
> 
> I'm having some troubles writing the next program.
> There 's a problem with the predicate "control".
> I just want to have that at least one of the two elements Elem1, Elem2 is a
> consonant, but the solver returns all possibilities (i.e. 1 to 4) for Elem1
> and Elem2 instead of only the possibilities 1 of 2.
> 
> Is there somebody who knows what I'm doing wrong or can someone give me a
> working solution without a backtracking mechanism (such like the use of
> ";")?
> 
> Thx,





reply via email to

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