Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0
ter-dom.hpp
Go to the documentation of this file.
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Christian Schulte <schulte@gecode.org>
5 *
6 * Copyright:
7 * Christian Schulte, 2003
8 *
9 * This file is part of Gecode, the generic constraint
10 * development environment:
11 * http://www.gecode.org
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining
14 * a copy of this software and associated documentation files (the
15 * "Software"), to deal in the Software without restriction, including
16 * without limitation the rights to use, copy, modify, merge, publish,
17 * distribute, sublicense, and/or sell copies of the Software, and to
18 * permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be
22 * included in all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 *
32 */
33
34namespace Gecode { namespace Int { namespace Distinct {
35
36
37 /*
38 * Ternary domain consistent distinct
39 *
40 */
41
42 template<class View>
46
47 template<class View>
50 (void) new (home) TerDom<View>(home,x0,x1,x2);
51 return ES_OK;
52 }
53
54 template<class View>
58
59 template<class View>
60 Actor*
62 return new (home) TerDom<View>(home,*this);
63 }
64
66#define GECODE_INT_HALL_ONE(x0,x1,x2) \
67 if (x0.assigned()) { \
68 GECODE_ME_CHECK(x1.nq(home,x0.val())); \
69 GECODE_ME_CHECK(x2.nq(home,x0.val())); \
70 if (x1.assigned()) { \
71 GECODE_ME_CHECK(x2.nq(home,x1.val())); \
72 return home.ES_SUBSUMED(*this); \
73 } \
74 if (x2.assigned()) { \
75 GECODE_ME_CHECK(x1.nq(home,x2.val())); \
76 return home.ES_SUBSUMED(*this); \
77 } \
78 return ES_FIX; \
79 }
80
81
83#define GECODE_INT_HALL_TWO(x0,x1,x2) \
84 if ((x0.size() == 2) && (x1.size() == 2) && \
85 (x0.min() == x1.min()) && (x0.max() == x1.max())) { \
86 GECODE_ME_CHECK(x2.nq(home,x0.min())); \
87 GECODE_ME_CHECK(x2.nq(home,x0.max())); \
88 return ES_FIX; \
89 }
90
91 template<class View>
102
103#undef GECODE_INT_HALL_ONE
104#undef GECODE_INT_HALL_TWO
105
106}}}
107
108// STATISTICS: int-prop
109
Base-class for both propagators and branchers.
Definition core.hpp:628
Home class for posting propagators
Definition core.hpp:856
TerDom(Space &home, TerDom< View > &p)
Constructor for cloning p.
Definition ter-dom.hpp:56
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition ter-dom.hpp:93
static ExecStatus post(Home home, View x0, View x1, View x2)
Post propagator for views x.
Definition ter-dom.hpp:49
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition ter-dom.hpp:61
friend class Space
Definition core.hpp:1068
TernaryPropagator(Space &home, TernaryPropagator &p)
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
Distinct propagators
Finite domain integers.
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
Definition var-type.hpp:100
Gecode toplevel namespace
ExecStatus
Definition core.hpp:472
@ ES_OK
Execution is okay.
Definition core.hpp:476
@ ES_FIX
Propagation has computed fixpoint.
Definition core.hpp:477
#define forceinline
Definition config.hpp:194
#define GECODE_INT_HALL_ONE(x0, x1, x2)
Check whether x0 forms a Hall set of cardinality one.
Definition ter-dom.hpp:66
#define GECODE_INT_HALL_TWO(x0, x1, x2)
Check whether x0 and x1 form a Hall set of cardinality two.
Definition ter-dom.hpp:83