3
* Guido Tack <tack@gecode.org>
4
* Christian Schulte <schulte@gecode.org>
5
* Gabor Szokoli <szokoli@gecode.org>
9
* Christian Schulte, 2004
13
* $Date: 2005-08-01 08:20:10 +0200 (Mon, 01 Aug 2005) $ by $Author: tack $
16
* This file is part of Gecode, the generic constraint
17
* development environment:
18
* http://www.gecode.org
20
* See the file "LICENSE" for information on usage and
21
* redistribution of this file, and for a
22
* DISCLAIMER OF ALL WARRANTIES.
26
namespace Gecode { namespace Set { namespace Rel {
29
* "No Subset" propagator
33
template <class View0, class View1>
35
NoSubSet<View0,View1>::NoSubSet(Space* home, View0 y0, View1 y1)
36
: InhomBinaryPropagator<View0,PC_SET_CLUB,
37
View1,PC_SET_CGLB>(home,y0,y1) {}
39
template <class View0, class View1>
41
NoSubSet<View0,View1>::NoSubSet(Space* home, bool share,
42
NoSubSet<View0,View1>& p)
43
: InhomBinaryPropagator<View0,PC_SET_CLUB,
44
View1,PC_SET_CGLB>(home,share,p) {}
46
template <class View0, class View1>
48
NoSubSet<View0,View1>::post(Space* home, View0 x, View1 y) {
49
if (me_failed(x.cardMin(home,1)))
51
(void) new (home) NoSubSet<View0,View1>(home,x,y);
55
template <class View0, class View1>
57
NoSubSet<View0,View1>::copy(Space* home, bool share) {
58
return new (home) NoSubSet<View0,View1>(home,share,*this);
61
template <class View0, class View1>
63
NoSubSet<View0,View1>::propagate(Space* home) {
64
GlbRanges<View0> x0lb(x0);
65
LubRanges<View1> x1ub(x1);
66
if (!Iter::Ranges::subset(x0lb, x1ub))
68
if (x0.cardMin()>x1.cardMax()) { return ES_SUBSUMED; }
69
LubRanges<View0> x0ub(x0);
70
GlbRanges<View1> x1lb(x1);
71
Iter::Ranges::Diff<LubRanges<View0>,GlbRanges<View1> >
73
if (!breakers()) { return ES_FAILED; }
74
if (breakers.min() == breakers.max()) {
75
int b1 = breakers.min();
77
if (breakers()) { return ES_FIX; }
78
//Only one subsetness-breaker element left:
79
GECODE_ME_CHECK( x0.include(home,b1) );
80
GECODE_ME_CHECK( x1.exclude(home,b1) );
88
// STATISTICS: set-prop