Re: disjunctive constraints, use of ~= ?

From: Joachim Schimpf <j.schimpf_at_icparc.ic.ac.uk>
Date: Fri 25 Apr 2003 05:45:28 PM GMT
Message-ID: <3EA97438.F11A788D@icparc.ic.ac.uk>
Ulrich Scholz wrote:
> 
> Sorry.
> 
> Of course you are right in that set-disequality and set-disjointness are not
> the same.
> 
> I forgot to say that in my case, I solely consider interger sets with
> cardinality one, thus all variables are variables of integer sets with
> cardinality one, ie
> 
> Y subset [1,2,3], #(Y,1).
> 
> In this special case, set-disequality and set-disjointness are the same.  But
> of course you can generalize my question on general disjunctive constraints.

Why do you use set variables if the cardinality is always 1?
Can't you use a normal finite domain variable for the (single) set element?
Then you can use fd's reified constraints to formulate the disjunction.


> :- lib(fd_sets), (import (subset)/2 from fd_sets).
> :- lib(notinstance), (import (~=)/2 from notinstance).
> 
> test :-
>     X1 subset [1,2], #(X1,1),
>     Y1 subset [1,2], #(Y1,1),
>     X2 subset [1,2], #(X2,1),
>     Y2 subset [1,2], #(Y2,1),
>     [X1, Y1] ~= [X2, Y2],
>     X1 = X2.

:- lib(fd).

test :-
	[X1,X2,Y1,Y2]::1..2,
	#\=(X1,X2,Bool),
	#=(Y1,Y2,Bool),
	X1 = X2.

The sets library unfortunately doesn't have a full set of
reified constraints...

-- 
 Joachim Schimpf              /             phone: +44 20 7594 8187
 IC-Parc                     /      mailto:J.Schimpf@imperial.ac.uk
 Imperial College London    /    http://www.icparc.ic.ac.uk/eclipse
Received on Fri Apr 25 18:45:51 2003

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