Re: [eclipse-clp-users] Propagation question for IC

From: Joachim Schimpf <jschimpf_at_...311...>
Date: Wed, 1 Apr 2020 09:20:32 +0100
On 31/03/2020 19:22, Panagiotis Stamatopoulos wrote:
> Hello All,
> 
> I hope you are healthy and safe. May I ask a (maybe trivial) question
> in the context of the IC library? Why the query
> 
> ?- X #:: [1, 3], B #= (X #= 2).
> X = X{[1, 3]}
> B = B{[0, 1]}
> There is 1 delayed goal.
> 
> does not enforce Β to be equal to 0?


IC's arithmetic equality and inequality constraints generally
enforce bounds-consistency, that's why the hole in the domain
of X is not taken into account.

On could argue that for simple cases like X #= Y+Const stronger
domain-consistency should be enforced, this is the reason for
having http://eclipseclp.org/doc/bips/lib/ic/ac_eq-3.html .
Unfortunately, a reified version of ac_eq/3 is missing!

If, as in your example, the equation contains only one variable,
you could use the reified form of #::, i.e.

?- X #:: [1, 3], #::(X, 2, B).
X = X{[1, 3]}
B = 0


By the way, lib(gfd) also does what you expect:

?- lib(gfd).

?- X #:: [1, 3], B #= (X #= 2).
X = X{[1, 3]}
B = 0


Cheers,
Joachim
Received on Wed Apr 01 2020 - 08:20:46 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:21 CEST