Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0
rel.hh
Go to the documentation of this file.
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Guido Tack <tack@gecode.org>
5 * Christian Schulte <schulte@gecode.org>
6 *
7 * Contributing authors:
8 * Gabor Szokoli <szokoli@gecode.org>
9 *
10 * Copyright:
11 * Guido Tack, 2004
12 * Christian Schulte, 2004
13 * Gabor Szokoli, 2004
14 *
15 * This file is part of Gecode, the generic constraint
16 * development environment:
17 * http://www.gecode.org
18 *
19 * Permission is hereby granted, free of charge, to any person obtaining
20 * a copy of this software and associated documentation files (the
21 * "Software"), to deal in the Software without restriction, including
22 * without limitation the rights to use, copy, modify, merge, publish,
23 * distribute, sublicense, and/or sell copies of the Software, and to
24 * permit persons to whom the Software is furnished to do so, subject to
25 * the following conditions:
26 *
27 * The above copyright notice and this permission notice shall be
28 * included in all copies or substantial portions of the Software.
29 *
30 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 *
38 */
39
40#ifndef __GECODE_SET_REL_HH__
41#define __GECODE_SET_REL_HH__
42
43#include <gecode/set.hh>
44
45namespace Gecode { namespace Set { namespace Rel {
46
51
53 template<class VX, class VY>
54 bool same(VX c, VY y);
55
62
63 template<class View0, class View1>
64 class Subset :
65 public MixBinaryPropagator<View0,PC_SET_CGLB,View1,PC_SET_CLUB> {
66 protected:
70 Subset(Space& home, Subset& p);
72 Subset(Home home, View0 x0, View1 x1);
73 public:
75 virtual Actor* copy(Space& home);
77 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
79 static ExecStatus post(Home home, View0 x, View1 y);
80 };
81
88
89 template<class View0, class View1>
90 class NoSubset :
91 public MixBinaryPropagator<View0,PC_SET_CLUB,View1,PC_SET_CGLB> {
92 protected:
96 NoSubset(Space& home, NoSubset& p);
98 NoSubset(Home home, View0 x0, View1 x1);
99 public:
101 virtual Actor* copy(Space& home);
103 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
105 static ExecStatus post(Home home,View0 x,View1 y);
106 };
107
114 template<class View0, class View1, class CtrlView, ReifyMode rm>
115 class ReSubset : public Propagator {
116 protected:
118 View0 x0;
120 View1 x1;
122 CtrlView b;
124 ReSubset(Space& home, ReSubset& p);
126 ReSubset(Home home, View0 x0, View1 x1, CtrlView b);
127 public:
129 virtual Actor* copy(Space& home);
131 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
133 virtual void reschedule(Space& home);
135 virtual size_t dispose(Space& home);
137 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
139 static ExecStatus post(Home home, View0 x, View1 y,
140 CtrlView b);
141 };
142
149 template<class View0, class View1>
150 class Eq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
151 protected:
155 Eq(Space& home, Eq& p);
157 Eq(Home home, View0 x0, View1 x1);
158 public:
160 virtual Actor* copy(Space& home);
162 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
164 static ExecStatus post(Home home, View0 x, View1 y);
165 };
166
173 template<class View0, class View1, class CtrlView, ReifyMode rm>
174 class ReEq : public Propagator {
175 protected:
176 View0 x0;
177 View1 x1;
178 CtrlView b;
180 ReEq(Space& home, ReEq&);
182 ReEq(Home home, View0 x0, View1 x1, CtrlView b);
183 public:
185 virtual Actor* copy(Space& home);
187 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
189 virtual void reschedule(Space& home);
191 virtual size_t dispose(Space& home);
193 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
195 static ExecStatus post(Home home, View0 x, View1 y,
196 CtrlView b);
197 };
198
207 template<class View0, class View1, bool strict=false>
208 class Lq : public MixBinaryPropagator<View0,PC_SET_ANY,View1,PC_SET_ANY> {
209 protected:
213 Lq(Space& home, Lq& p);
215 Lq(Home home, View0 x0, View1 x1);
216 public:
218 virtual Actor* copy(Space& home);
220 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
222 static ExecStatus post(Home home, View0 x, View1 y);
223 };
224
233 template<class View0, class View1, ReifyMode rm, bool strict=false>
234 class ReLq : public Propagator {
235 protected:
236 View0 x0;
237 View1 x1;
240 ReLq(Space& home, ReLq& p);
242 ReLq(Home home, View0 x0, View1 x1, Gecode::Int::BoolView b);
243 public:
245 virtual Actor* copy(Space& home);
247 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
249 virtual void reschedule(Space& home);
251 virtual size_t dispose(Space& home);
253 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
255 static ExecStatus post(Home home, View0 x, View1 y,
257 };
258
265
266 template<class View0, class View1>
267 class Distinct :
268 public MixBinaryPropagator<View0,PC_SET_VAL,View1,PC_SET_VAL> {
269 protected:
273 Distinct(Space& home, Distinct& p);
275 Distinct(Home home, View0 x0, View1 x1);
276 public:
278 virtual Actor* copy(Space& home);
280 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
282 static ExecStatus post(Home home, View0 x, View1 y);
283 };
284
295 template<class View0>
296 class DistinctDoit : public UnaryPropagator<View0,PC_SET_ANY> {
297 protected:
298 using UnaryPropagator<View0,PC_SET_ANY>::x0;
304 DistinctDoit(Home home, View0 x0, ConstSetView y);
305 public:
307 virtual Actor* copy(Space& home);
309 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
311 static ExecStatus post(Home home, View0 x, ConstSetView y);
312 };
313
314}}}
315
320#include <gecode/set/rel/eq.hpp>
322#include <gecode/set/rel/nq.hpp>
323#include <gecode/set/rel/lq.hpp>
325
326#endif
327
328// STATISTICS: set-prop
Home class for posting propagators
Definition core.hpp:856
Boolean view for Boolean variables.
Definition view.hpp:1380
Propagation cost.
Definition core.hpp:486
friend class Space
Definition core.hpp:1068
ModEventDelta med
A set of modification events (used during propagation)
Definition core.hpp:1077
Propagator(Home home)
Constructor for posting.
Definition core.hpp:3505
Constant view.
Definition view.hpp:186
DistinctDoit(Space &home, DistinctDoit &)
Constructor for cloning p.
Definition nq.hpp:150
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition nq.hpp:106
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition nq.hpp:112
static ExecStatus post(Home home, View0 x, ConstSetView y)
Post propagator .
Definition nq.hpp:99
ConstSetView y
The view that is already assigned.
Definition rel.hh:300
Distinct(Space &home, Distinct &p)
Constructor for cloning p.
Definition nq.hpp:49
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition nq.hpp:76
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition nq.hpp:55
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition nq.hpp:82
Eq(Space &home, Eq &p)
Constructor for cloning p.
Definition eq.hpp:49
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition eq.hpp:68
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition eq.hpp:62
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition eq.hpp:54
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition lq.hpp:336
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition lq.hpp:342
Lq(Space &home, Lq &p)
Constructor for cloning p.
Definition lq.hpp:320
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition lq.hpp:325
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition nosubset.hpp:59
NoSubset(Space &home, NoSubset &p)
Constructor for cloning p.
Definition nosubset.hpp:53
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition nosubset.hpp:76
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition nosubset.hpp:70
static ExecStatus post(Home home, View0 x, View1 y, CtrlView b)
Post propagator for .
Definition re-eq.hpp:86
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_TERNARY_LO)
Definition re-eq.hpp:62
ReEq(Space &home, ReEq &)
Constructor for cloning p.
Definition re-eq.hpp:53
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition re-eq.hpp:76
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition re-eq.hpp:104
virtual void reschedule(Space &home)
Schedule function.
Definition re-eq.hpp:68
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition re-eq.hpp:98
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition re-lq.hpp:108
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition re-lq.hpp:102
Gecode::Int::BoolView b
Definition rel.hh:238
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition re-lq.hpp:72
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as PC_TERNARY_LO)
Definition re-lq.hpp:57
static ExecStatus post(Home home, View0 x, View1 y, Gecode::Int::BoolView b)
Post propagator for .
Definition re-lq.hpp:82
virtual void reschedule(Space &home)
Schedule function.
Definition re-lq.hpp:64
ReLq(Space &home, ReLq &p)
Constructor for cloning p.
Definition re-lq.hpp:48
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition re-subset.hpp:75
CtrlView b
Boolean control view.
Definition rel.hh:122
View0 x0
Variable view.
Definition rel.hh:118
ReSubset(Space &home, ReSubset &p)
Constructor for cloning p.
Definition re-subset.hpp:50
virtual void reschedule(Space &home)
Schedule function.
Definition re-subset.hpp:67
View1 x1
Variable view.
Definition rel.hh:120
static ExecStatus post(Home home, View0 x, View1 y, CtrlView b)
Post propagator for .
Definition re-subset.hpp:85
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition re-subset.hpp:97
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as ternary low)
Definition re-subset.hpp:60
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Subset(Space &home, Subset &p)
Constructor for cloning p.
Definition subset.hpp:50
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition subset.hpp:63
static ExecStatus post(Home home, View0 x, View1 y)
Post propagator .
Definition subset.hpp:55
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition subset.hpp:69
UnaryPropagator(Space &home, UnaryPropagator &p)
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
Simple relation propagators.
Finite integer sets.
Definition var-imp.hpp:137
const Gecode::PropCond PC_SET_CLUB
Propagate when the cardinality or the least upper bound of a view changes.
Definition var-type.hpp:227
const Gecode::PropCond PC_SET_VAL
Propagate when a view becomes assigned (single value)
Definition var-type.hpp:207
const Gecode::PropCond PC_SET_ANY
Propagate when any bound or the cardinality of a view changes.
Definition var-type.hpp:248
const Gecode::PropCond PC_SET_CGLB
Propagate when the cardinality or the greatest lower bound of a view changes.
Definition var-type.hpp:238
Gecode toplevel namespace
bool same(VarArgArray< Var > x, VarArgArray< Var > y)
Definition array.hpp:1943
Post propagator for SetVar SetOpType SetVar y
Definition set.hh:773
ExecStatus
Definition core.hpp:472
Post propagator for SetVar x
Definition set.hh:773