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 * Christian Schulte <schulte@gecode.org>
5 * Guido Tack <tack@gecode.org>
6 * Vincent Barichard <Vincent.Barichard@univ-angers.fr>
7 *
8 * Contributing authors:
9 * Gabor Szokoli <szokoli@gecode.org>
10 *
11 * Copyright:
12 * Christian Schulte, 2002
13 * Guido Tack, 2004
14 * Gabor Szokoli, 2003
15 * Vincent Barichard, 2012
16 *
17 * This file is part of Gecode, the generic constraint
18 * development environment:
19 * http://www.gecode.org
20 *
21 * Permission is hereby granted, free of charge, to any person obtaining
22 * a copy of this software and associated documentation files (the
23 * "Software"), to deal in the Software without restriction, including
24 * without limitation the rights to use, copy, modify, merge, publish,
25 * distribute, sublicense, and/or sell copies of the Software, and to
26 * permit persons to whom the Software is furnished to do so, subject to
27 * the following conditions:
28 *
29 * The above copyright notice and this permission notice shall be
30 * included in all copies or substantial portions of the Software.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
37 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39 *
40 */
41
42#ifndef __GECODE_FLOAT_REL_HH__
43#define __GECODE_FLOAT_REL_HH__
44
45#include <gecode/int.hh>
46#include <gecode/float.hh>
47
52namespace Gecode { namespace Float { namespace Rel {
53
54 /*
55 * Equality propagators
56 *
57 */
58
65 template<class View0, class View1>
66 class Eq :
67 public MixBinaryPropagator<View0,PC_FLOAT_BND,View1,PC_FLOAT_BND> {
68 protected:
71
73 Eq(Space& home, Eq<View0,View1>& p);
74 public:
76 Eq(Home home, View0 x0, View1 x1);
78 Eq(Space& home, Propagator& p, View0 x0, View1 x1);
80 virtual Actor* copy(Space& home);
82 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
84 static ExecStatus post(Home home, View0 x0, View1 x1);
85 };
86
93 template<class View>
94 class NaryEq : public NaryPropagator<View,PC_FLOAT_BND> {
95 protected:
97
99 NaryEq(Space& home, NaryEq<View>& p);
102 public:
104 virtual Actor* copy(Space& home);
111 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
113 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
115 static ExecStatus post(Home home, ViewArray<View>& x);
116 };
117
124 template<class View, class CtrlView, ReifyMode rm>
125 class ReEq : public Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView> {
126 protected:
130
132 ReEq(Space& home, ReEq& p);
134 ReEq(Home home, View x0, View x1, CtrlView b);
135 public:
137 virtual Actor* copy(Space& home);
139 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
141 static ExecStatus post(Home home, View x0, View x1, CtrlView b);
142 };
143
150 template<class View, class CtrlView, ReifyMode rm>
151 class ReEqFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
152 protected:
155
159 ReEqFloat(Space& home, ReEqFloat& p);
161 ReEqFloat(Home home, View x, FloatVal c, CtrlView b);
162 public:
164 virtual Actor* copy(Space& home);
166 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
168 static ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
169 };
170
171
178 template<class View0, class View1>
179 class Nq :
180 public MixBinaryPropagator<View0,PC_FLOAT_VAL,View1,PC_FLOAT_VAL> {
181 protected:
184
186 Nq(Space& home, Nq<View0,View1>& p);
187 public:
189 Nq(Home home, View0 x0, View1 x1);
191 Nq(Space& home, Propagator& p, View0 x0, View1 x1);
193 virtual Actor* copy(Space& home);
195 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
197 static ExecStatus post(Home home, View0 x0, View1 x1);
198 };
199
206 template<class View>
207 class NqFloat :
208 public UnaryPropagator<View,PC_FLOAT_VAL> {
209 protected:
211
215 NqFloat(Space& home, NqFloat<View>& p);
216 public:
218 NqFloat(Home home, View x, FloatVal c);
220 virtual Actor* copy(Space& home);
222 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
224 static ExecStatus post(Home home, View x0, FloatVal c);
225 };
226
227
228 /*
229 * Order propagators
230 *
231 */
232
239
240 template<class View>
241 class Lq : public BinaryPropagator<View,PC_FLOAT_BND> {
242 protected:
245
247 Lq(Space& home, Lq& p);
249 Lq(Home home, View x0, View x1);
250 public:
252 virtual Actor* copy(Space& home);
254 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
256 static ExecStatus post(Home home, View x0, View x1);
257 };
258
265
266 template<class View>
267 class Le : public BinaryPropagator<View,PC_FLOAT_BND> {
268 protected:
271
273 Le(Space& home, Le& p);
275 Le(Home home, View x0, View x1);
276 public:
278 virtual Actor* copy(Space& home);
280 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
282 static ExecStatus post(Home home, View x0, View x1);
283 };
284
285 /*
286 * Reified order propagators
287 *
288 */
289
296
297 template<class View, class CtrlView, ReifyMode rm>
298 class ReLqFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
299 protected:
302
306 ReLqFloat(Space& home, ReLqFloat& p);
308 ReLqFloat(Home home, View x, FloatVal c, CtrlView b);
309 public:
311 virtual Actor* copy(Space& home);
313 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
315 static ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
316 };
317
324
325 template<class View, class CtrlView, ReifyMode rm>
326 class ReLeFloat : public Int::ReUnaryPropagator<View,PC_FLOAT_BND,CtrlView> {
327 protected:
330
334 ReLeFloat(Space& home, ReLeFloat& p);
336 ReLeFloat(Home home, View x, FloatVal c, CtrlView b);
337 public:
339 virtual Actor* copy(Space& home);
341 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
343 static ExecStatus post(Home home, View x, FloatVal c, CtrlView b);
344 };
345
352
353 template<class View, class CtrlView, ReifyMode rm>
354 class ReLq : public Int::ReBinaryPropagator<View,PC_FLOAT_BND,CtrlView> {
355 protected:
359
361 ReLq(Space& home, ReLq& p);
363 ReLq(Home home, View x0, View x1, CtrlView b);
364 public:
366 virtual Actor* copy(Space& home);
368 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
370 static ExecStatus post(Home home, View x0, View x1, CtrlView b);
371 };
372
373}}}
374
378
379#endif
380
381
382// STATISTICS: float-prop
383
BinaryPropagator(Space &home, BinaryPropagator &p)
Float value type.
Definition float.hh:334
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition eq.hpp:85
Eq(Space &home, Eq< View0, View1 > &p)
Constructor for cloning p.
Definition eq.hpp:67
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition eq.hpp:79
static ExecStatus post(Home home, View0 x0, View1 x1)
Post bounds consistent propagator .
Definition eq.hpp:50
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition lq-le.hpp:117
static ExecStatus post(Home home, View x0, View x1)
Post propagator .
Definition lq-le.hpp:91
Le(Space &home, Le &p)
Constructor for cloning p.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition lq-le.hpp:111
Lq(Space &home, Lq &p)
Constructor for cloning p.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition lq-le.hpp:67
static ExecStatus post(Home home, View x0, View x1)
Post propagator .
Definition lq-le.hpp:52
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition lq-le.hpp:73
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition eq.hpp:161
NaryEq(Space &home, NaryEq< View > &p)
Constructor for cloning p.
Definition eq.hpp:141
static ExecStatus post(Home home, ViewArray< View > &x)
Post bounds consistent propagator .
Definition eq.hpp:119
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition eq.hpp:146
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition eq.hpp:152
NqFloat(Space &home, NqFloat< View > &p)
Constructor for cloning p.
Definition nq.hpp:104
FloatVal c
Float constant to check.
Definition rel.hh:213
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition nq.hpp:115
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition nq.hpp:109
static ExecStatus post(Home home, View x0, FloatVal c)
Post bounds consistent propagator .
Definition nq.hpp:92
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition nq.hpp:74
static ExecStatus post(Home home, View0 x0, View1 x1)
Post bounds consistent propagator .
Definition nq.hpp:49
Nq(Space &home, Nq< View0, View1 > &p)
Constructor for cloning p.
Definition nq.hpp:63
Nq(Space &home, Propagator &p, View0 x0, View1 x1)
Constructor for rewriting p during cloning.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition nq.hpp:68
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition eq.hpp:317
FloatVal c
Float constant to check.
Definition rel.hh:157
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition eq.hpp:311
static ExecStatus post(Home home, View x, FloatVal c, CtrlView b)
Post bounds consistent propagator .
Definition eq.hpp:285
ReEqFloat(Space &home, ReEqFloat &p)
Constructor for cloning p.
Definition eq.hpp:306
ReEq(Space &home, ReEq &p)
Constructor for cloning p.
Definition eq.hpp:233
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition eq.hpp:238
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition eq.hpp:244
static ExecStatus post(Home home, View x0, View x1, CtrlView b)
Post bounds consistent propagator .
Definition eq.hpp:211
static ExecStatus post(Home home, View x, FloatVal c, CtrlView b)
Post propagator for .
Definition lq-le.hpp:321
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition lq-le.hpp:366
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition lq-le.hpp:360
ReLeFloat(Space &home, ReLeFloat &p)
Constructor for cloning p.
Definition lq-le.hpp:355
FloatVal c
Float constant to check.
Definition rel.hh:332
FloatVal c
Float constant to check.
Definition rel.hh:304
static ExecStatus post(Home home, View x, FloatVal c, CtrlView b)
Post propagator for .
Definition lq-le.hpp:234
ReLqFloat(Space &home, ReLqFloat &p)
Constructor for cloning p.
Definition lq-le.hpp:267
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition lq-le.hpp:278
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition lq-le.hpp:272
ReLq(Space &home, ReLq &p)
Constructor for cloning p.
Definition lq-le.hpp:180
static ExecStatus post(Home home, View x0, View x1, CtrlView b)
Post propagator for .
Definition lq-le.hpp:141
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition lq-le.hpp:191
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition lq-le.hpp:185
Home class for posting propagators
Definition core.hpp:856
Reified binary propagator.
Reified unary propagator.
NaryPropagator(Space &home, NaryPropagator &p)
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
UnaryPropagator(Space &home, UnaryPropagator &p)
View arrays.
Definition array.hpp:253
int ModEventDelta
Modification event deltas.
Definition core.hpp:89
Simple relation propagators.
Floating point numbers.
const Gecode::PropCond PC_FLOAT_VAL
Propagate when a view becomes assigned (single value)
Definition var-type.hpp:283
const Gecode::PropCond PC_FLOAT_BND
Propagate when minimum or maximum of a view changes.
Definition var-type.hpp:292
Gecode toplevel namespace
ExecStatus
Definition core.hpp:472
Post propagator for SetVar x
Definition set.hh:773