>Hello,
>
>take the following two clpfd - constraints:
>
>1) A #>= 2, A #=< 3, B #>= 1, B #=< 3, C #>= 1, C #=< 2.
>
>2) A #>= 2, A #=< 4, B #>= A, B #=< 3, C #= A + 1, C #= B + 1.
>
>In 2) you have corelations between the domains, i.e. B #>= A
>
>In 1) there are no correlations between each other. Every domain has a
>number as inf and sup.
>
>Now can I find out in a statement when a domain has correlations to other
>domains and when not?
>
>I.e. in 1) correlated(A) -> false
>
>in 2) correlated(A) -> true because of B references to A
You mean probably that X and Y are correlated in
?- X #= K*Y.
Except for K = 0. Sometimes clpfd is clever enough to realize this.
Sometimes not.
?- X #= (A-B)*Y, A #>= B, B #>= A.
_G2745*Y#=X,
_G2745+B#=A,
B#>=A,
A#>=B.
?- X #= (A-B)*Y, A #>= B, B #>= A, A = B.
X = 0,
A = B,
B in inf..sup,
Y in inf..sup.
The general problem behind is undecidable, so you have to go for some
kind of approximation. The simplest one would be start investigating
the neighbor variables that are attached to the same constraints.
copy_term/3 should suffice. Finding a better form of approximation
seems to be the most difficult task here.
_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog