users-prolog
[Top][All Lists]
Advanced

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

Unexpected result with FD solver


From: Xiao-Hua Kong
Subject: Unexpected result with FD solver
Date: Mon, 17 Feb 2003 12:28:47 -0500 (EST)

Hello,

I'm a beginer in Prolog, I want to use GNU Prolog for constraint sovling
in FD. I have tried the solver with a set of in-equations. But for some of
them, I did not get the result expected.

Here is an example:

I wrote a rule:

ieq(LD1,LD2,Va):-
LD1 = [X1,X2,X3,X4],
LD2 = [D1,D2],
fd_domain(LD1,0,20),
fd_domain(LD2,1,12),
Va #=<5,
Va #>=0,
X1 #= 0,
X2 #=< X1+4,
X2 #>= X1+2,
X3 #= X1+D1,
X4 #= X2+D2,
D1 #=< D2+Va,
D1 #>= D2-Va,
X4 #=< X3.
 
And asked for the possible assignment for these in-equations
(constraints).
However I got the follwing result:

        | ?- ieq(LD1,LD2,Va).

        LD1 = [0,_#25(2..4),_#47(3..12),_#69(3..12)]
        LD2 = [_#91(3..12),_#113(1..10)]
        Va = _#134(0..5)

In which the resulting domain of Va is larger than it should be. For
example, ask 
        | ?- ieq(LD1,LD2,0).
or      | ?- ieq(LD1,LD2,1).

will have an answer "no".

Is there any problem with the code? Or I should not use more than three
variables in a constraint? How can I solve this problem.

BTW, what does _#integer mean in the result?

Thanks in advance.
Xiaohua Kong





reply via email to

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