# Re: 'and' reification in IC

From: Warwick Harvey <wh_at_icparc.ic.ac.uk>
Date: Tue 22 Jun 2004 02:10:42 PM GMT
Message-ID: <20040622151038.G1244@tempest.icparc.ic.ac.uk>
```Hi Chris,

On Tue, Jun 22, 2004 at 12:26:54PM +0100, Chris Meudec wrote:
> I am using Eclipse 5.7#45 on Windows XP and I am having trouble
> understanding the use of the 'and' reified constraint in IC.
>
> For example, once ic is loaded:
> ?- ic : (R #= (X #> 5 and X #< 2)).
> R = R{[0, 1]}
> X = X{-1.0Inf .. 1.0Inf}
> There are 3 delayed goals.
> Yes (0.00s cpu)
>
> I would have expected R to be bound to 0 here as the constraint is
> disentailed.

Reified constraints like this are handled by decomposing them into primitive
constraints.  For your example, this would be (more or less):

#>(X, 5, B1), #<(X, 2, B2), #=(B1 + B2, 2, R)

or, to make it easier for a human to understand (but less clear what's a
primitive constraint):

B1 #= (X #> 5), B2 #= (X #< 2), R #= (B1 + B2 #= 2)

Each of these constraints has bounds consistency applied to it locally -
there is no global consistency enforced.  And taken on their own, each of
these constraints is bounds consistent, so nothing can be inferred.

> Am I missing something? Is this part of the ic library not yet fully
> implemented (if not how can the above de done).

It is fully implemented, you're just wanting it to do a kind of reasoning
that falls outside its remit.

Some options:

1.  Use a different solver that does global consistency, such as eplex: but
then you're limited to linear constraints, so you'll have to model your
problem appropriately.  Actually, the global consistency is only for
real variables, so since you have integer variables you may find you're
just pushing the problem somewhere else.

2.  Use a solver such as propia on top of IC, to achieve stronger
propagation for certain constraints.  Propia can be quite effective in
some situations, though it can also be a bit heavy (and has the
potential to be wildly inefficient if used inappropriately :).  There's
also a bug in IC that may lead to poor performance with propia - if you
choose this route let me know and I'll give you a patch.

3.  Remodel your problem or add some redundant constraints in order to
achieve the level of consistency you desire with the constraints
available.

4.  Write your own constraint(s).  This is obviously more work, but it means
you get to choose what algorithms to use for the level of consistency
you desire.

Cheers,
Warwick
```
Received on Tue Jun 22 15:12:53 2004

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:29 PM GMT GMT