Re: [eclipse-clp-users] fd_sets sameset negation

From: Joachim Schimpf <joachim.schimpf_at_monash.edu>
Date: Thu, 13 Jan 2011 15:44:39 +1100
Matthew Skala wrote:
> 
> When I ran into a similar situation, where I wanted a "neither of these
> sets is a subset of the other" constraint in ic_sets, I ended up
> adding a customized constraint like this:

This can also be expressed by combining other constraints, e.g.
set-difference and cardinality:

not_subsets(X, Y) :-
	#(X\Y) #>= 1,
	#(Y\X) #>= 1.


The overhead would be higher than with Matthew's passive checking,
but it produces propagation (which may or may not be worthwhile):

?- X in_set_range [1, 2] .. [1, 2, 3, 4],
   Y in_set_range [1, 2, 3] .. [1, 2, 3, 4],
   not_subsets(X, Y).
X = [1, 2, 4]
Y = [1, 2, 3]
Yes (0.00s cpu)


-- Joachim
Received on Thu Jan 13 2011 - 04:44:51 CET

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