Generated on Tue Feb 11 2025 17:33:26 for Gecode by doxygen 1.12.0
rel-op-const-vcv.cpp
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 *
6 * Contributing authors:
7 * Gabor Szokoli <szokoli@gecode.org>
8 *
9 * Copyright:
10 * Guido Tack, 2004, 2005
11 *
12 * This file is part of Gecode, the generic constraint
13 * development environment:
14 * http://www.gecode.org
15 *
16 * Permission is hereby granted, free of charge, to any person obtaining
17 * a copy of this software and associated documentation files (the
18 * "Software"), to deal in the Software without restriction, including
19 * without limitation the rights to use, copy, modify, merge, publish,
20 * distribute, sublicense, and/or sell copies of the Software, and to
21 * permit persons to whom the Software is furnished to do so, subject to
22 * the following conditions:
23 *
24 * The above copyright notice and this permission notice shall be
25 * included in all copies or substantial portions of the Software.
26 *
27 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
31 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
32 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
33 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 *
35 */
36
37#include <gecode/set.hh>
38#include <gecode/set/rel.hh>
39#include <gecode/set/rel-op.hh>
40
41namespace Gecode {
42 using namespace Gecode::Set;
43 using namespace Gecode::Set::Rel;
44 using namespace Gecode::Set::RelOp;
45
46 void
48 SetVar z) {
49 Set::Limits::check(y, "Set::rel");
50 ConstSetView yv(home, y);
51
52 if (op==SOT_MINUS) {
53 switch (r) {
54 case SRT_EQ:
55 {
58 IntSet yc(yrc);
59 ConstSetView cy(home, yc);
63 ::post(home,cy,x,z)));
64 }
65 break;
66 case SRT_LQ: case SRT_LE: case SRT_GQ: case SRT_GR:
67 {
70 IntSet yc(yrc);
71 ConstSetView cy(home, yc);
76 ::post(home,cy,x,tmp)));
77 rel(home,tmp,r,z);
78 }
79 break;
80 case SRT_NQ:
81 {
82 SetVar tmp(home);
85 ::post(home,z,tmp)));
88 IntSet yc(yrc);
89 ConstSetView cy(home, yc);
93 ::post(home,cy,x,tmp)));
94 }
95 break;
96 case SRT_SUB:
97 {
100 IntSet yc(yrc);
101 ConstSetView cy(home, yc);
104 ::post(home,cy,x,z)));
105
106 }
107 break;
108 case SRT_SUP:
109 {
110 SetVar tmp(home);
112 (Subset<SetView,SetView>::post(home,z,tmp)));
113
116 IntSet yc(yrc);
117 ConstSetView cy(home, yc);
118
119 SetView xv(x);
123 ::post(home,cy,xv,tmp)));
124 }
125 break;
126 case SRT_DISJ:
127 {
128 SetVar tmp(home);
129 EmptyView emptyset;
131 ::post(home, z, tmp, emptyset)));
132
135 IntSet yc(yrc);
136 ConstSetView cy(home, yc);
140 ::post(home,cy,x,tmp)));
141 }
142 break;
143 case SRT_CMPL:
144 {
145 SetView xv(x);
150 SetView>::post(home, yv, cx, z)));
151 }
152 break;
153 default:
154 throw UnknownRelation("Set::rel");
155 }
156 } else {
157 rel(home, y, op, x, r, z);
158 }
159 }
160}
161
162// STATISTICS: set-post
Home class for posting propagators
Definition core.hpp:856
Integer sets.
Definition int.hh:174
static const IntSet empty
Empty set.
Definition int.hh:283
Exception: Unknown relation passed as argument
Definition exception.hpp:87
Set variables
Definition set.hh:127
Complement set view.
Definition view.hpp:769
Constant view.
Definition view.hpp:186
Constant view for the empty set.
Definition view.hpp:336
Range iterator for the greatest lower bound.
Definition var-imp.hpp:359
A complement iterator spezialized for the BndSet limits.
Definition var-imp.hpp:293
Propagator for ternary intersection
Definition rel-op.hh:124
Propagator for the superset of intersection
Definition rel-op.hh:63
Propagator for ternary union
Definition rel-op.hh:154
Propagator for negated equality
Definition rel.hh:268
Propagator for the subset constraint
Definition rel.hh:65
Set view for set variables
Definition view.hpp:56
#define GECODE_ES_FAIL(es)
Check whether execution status es is failed, and fail space home.
Definition macros.hpp:103
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
Definition rel.cpp:68
SetOpType
Common operations for sets.
Definition set.hh:660
SetRelType
Common relation types for sets.
Definition set.hh:643
@ SOT_MINUS
Difference.
Definition set.hh:664
@ SRT_GQ
Greater or equal ( )
Definition set.hh:652
@ SRT_CMPL
Complement.
Definition set.hh:649
@ SRT_GR
Greater ( )
Definition set.hh:653
@ SRT_LQ
Less or equal ( )
Definition set.hh:650
@ SRT_NQ
Disequality ( )
Definition set.hh:645
@ SRT_LE
Less ( )
Definition set.hh:651
@ SRT_EQ
Equality ( )
Definition set.hh:644
@ SRT_SUP
Superset ( )
Definition set.hh:647
@ SRT_DISJ
Disjoint ( )
Definition set.hh:648
@ SRT_SUB
Subset ( )
Definition set.hh:646
void check(int n, const char *l)
Check whether integer n is in range, otherwise throw overflow exception with information l.
Definition limits.hpp:37
const int min
Smallest allowed integer in integer set.
Definition set.hh:99
const int max
Largest allowed integer in integer set.
Definition set.hh:97
Standard set operation propagators.
Definition rel-op.hh:46
Standard set relation propagators.
Definition rel.hh:45
Finite integer sets.
Definition var-imp.hpp:137
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition set.hh:767
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Definition set.hh:767
Post propagator for SetVar SetOpType SetVar y
Definition set.hh:767
TFE post(PropagatorGroup g)
Only post functions (but not propagators) from g are considered.
Definition filter.cpp:138
Post propagator for SetVar x
Definition set.hh:767
Post propagator for SetVar SetOpType op
Definition set.hh:767