Re: Q: Sets

From: Warwick Harvey <wh_at_icparc.ic.ac.uk>
Date: Tue 17 Sep 2002 01:53:47 PM GMT
Message-ID: <20020917145346.F29134@tempest.icparc.ic.ac.uk>
Hi Marc,

On Tue, Sep 17, 2002 at 02:24:52PM +0100, Marc van Dongen wrote:
> Hi there,
> 
> 
> I'm trying to model something with sets but there's something
> that I don't know how to do. I've read the library manual but
> I haven't found anything yet.
> 
> Given set S1, I want to create set S2 using a bijection which
> reverses order. E.g. assuming that X1 < X2 < X3 I want to map
> the set {X1,X2,X3} to { C - X3, C - X2, C - X1 }.
> 
> Is there a way to do this?

If you're using the fd_sets library (the integer sets library using the FD
library for integer variables such as cardinalities) or the ic_sets library
(uses the IC library for integer variables such as cardinalities, but is
otherwise identical to fd_sets), you can use the membership_booleans/2
predicate to obtain booleans corresponding to the elements of each set, and
then unify the corresponding ones to enforce the desired relationship.

If you're using the old conjunto library (allows set elements other than
integers), you will probably need to write your own constraint: see the
"User-defined constraints" section of the "The Set Domain Library" chapter
of the Constraint Library Manual.  You can use the del_glb and del_lub
suspensions to get notified when upper and lower bounds change; you can then
impose corresponding bounds on the other set.

Cheers,
Warwick
Received on Tue Sep 17 14:53:52 2002

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