1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2004
*
* Last modified:
* $Date: 2005-10-27 21:01:30 +0200 (Thu, 27 Oct 2005) $ by $Author: schulte $
* $Revision: 2420 $
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* See the file "LICENSE" for information on usage and
* redistribution of this file, and for a
* DISCLAIMER OF ALL WARRANTIES.
*
*/
namespace Gecode { namespace Int { namespace Rel {
/*
* Disequality
*
*/
template <class View>
forceinline
Nq<View>::Nq(Space* home, View x0, View x1)
: BinaryPropagator<View,PC_INT_VAL>(home,x0,x1) {}
template <class View>
ExecStatus
Nq<View>::post(Space* home, View x0, View x1){
if (x0.assigned()) {
GECODE_ME_CHECK(x1.nq(home,x0.val()));
} else if (x1.assigned()) {
GECODE_ME_CHECK(x0.nq(home,x1.val()));
} else if (same(x0,x1)) {
return ES_FAILED;
} else {
(void) new (home) Nq<View>(home,x0,x1);
}
return ES_OK;
}
template <class View>
forceinline
Nq<View>::Nq(Space* home, bool share, Nq<View>& p)
: BinaryPropagator<View,PC_INT_VAL>(home,share,p) {}
template <class View>
Actor*
Nq<View>::copy(Space* home, bool share) {
return new (home) Nq<View>(home,share,*this);
}
template <class View>
PropCost
Nq<View>::cost(void) const {
return PC_UNARY_LO;
}
template <class View>
ExecStatus
Nq<View>::propagate(Space* home) {
if (x0.assigned()) {
GECODE_ME_CHECK(x1.nq(home,x0.val()));
} else {
GECODE_ME_CHECK(x0.nq(home,x1.val()));
}
return ES_SUBSUMED;
}
}}}
// STATISTICS: int-prop
|