Re: [eclipse-users] X = A or B

From: Marco Gavanelli <marco.gavanelli_at_unife.it>
Date: Thu, 06 Sep 2007 09:44:32 +0200
Malcolm Ryan wrote:
> I have a constraint system with many constraints of the form:
> 
> X #= A1 or X #= A2 or ... or X #= An
> 
> On its own, this statement doesn't restrict the domain of X. Is there  
> any we to re-express it so that the domain of X is maintained as the  
> union of the domains of A1 ... An?
> 
> I don't suppose it would be too hard to program this directly (with a  
> demon which is triggered by [A1,...An]->const) but if there's an  
> existing solution I'd like to hear about it. Or if there is a  
> compelling reason why maintaining this kind of relation is too  
> expensive to be worthwhile.

You can use the library Propia:

[eclipse 1]: lib(fd).
fd_domain.eco loaded traceable 0 bytes in 0.02 seconds
fd_arith.eco loaded traceable 0 bytes in 0.07 seconds
fd_util.eco loaded traceable 0 bytes in 0.01 seconds
fd_chip.eco loaded traceable 0 bytes in 0.02 seconds
fd_elipsys.eco loaded traceable 0 bytes in 0.01 seconds
fd.eco     loaded traceable 0 bytes in 0.12 seconds

Yes (0.12s cpu)
[eclipse 2]: lib(propia).
propia.eco loaded traceable 0 bytes in 0.02 seconds

Yes (0.02s cpu)
[eclipse 3]: A::0..5, B::3..10, C :: 20..30, member(X,[A,B,C]) infers most.

X = X{[0..10, 20..30]}
A = A{[0..5]}
B = B{[3..10]}
C = C{[20..30]}


Delayed goals:
         member(X{[0..10, 20..30]}, [A{[0..5]}, B{[3..10]}, 
C{[20..30]}]) infers
most
Yes (0.00s cpu)

Cheers,
Marco

-- 
Marco Gavanelli, Ph.D.
Computer Science Division
Dipartimento di Ingegneria
University of Ferrara
Via Saragat 1 - 44100 Ferrara (Italy)
Tel  +39-0532-97-4833
Fax  +39-0532-97-4870
http://www.ing.unife.it/docenti/MarcoGavanelli/
Received on Thu Sep 06 2007 - 08:44:39 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET