Generated on Sun Aug 9 2020 05:34:08 for Gecode by doxygen 1.8.18
aliases.hpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main author:
4  * Christian Schulte <schulte@gecode.org>
5  * Guido Tack <tack@gecode.org>
6  *
7  * Copyright:
8  * Christian Schulte, 2018
9  * Guido Tack, 2018
10  *
11  * This file is part of Gecode, the generic constraint
12  * development environment:
13  * http://www.gecode.org
14  *
15  * Permission is hereby granted, free of charge, to any person obtaining
16  * a copy of this software and associated documentation files (the
17  * "Software"), to deal in the Software without restriction, including
18  * without limitation the rights to use, copy, modify, merge, publish,
19  * distribute, sublicense, and/or sell copies of the Software, and to
20  * permit persons to whom the Software is furnished to do so, subject to
21  * the following conditions:
22  *
23  * The above copyright notice and this permission notice shall be
24  * included in all copies or substantial portions of the Software.
25  *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33  *
34  */
35 
36 namespace Gecode {
37 
38  inline void
39  atmost(Home home, const IntVarArgs& x, int n, int m,
40  IntPropLevel ipl) {
41  count(home,x,n,IRT_LQ,m,ipl);
42  }
43  inline void
44  atmost(Home home, const IntVarArgs& x, IntVar y, int m,
45  IntPropLevel ipl) {
46  count(home,x,y,IRT_LQ,m,ipl);
47  }
48  inline void
49  atmost(Home home, const IntVarArgs& x, const IntArgs& y, int m,
50  IntPropLevel ipl) {
51  count(home,x,y,IRT_LQ,m,ipl);
52  }
53  inline void
54  atmost(Home home, const IntVarArgs& x, int n, IntVar z,
55  IntPropLevel ipl) {
56  count(home,x,n,IRT_LQ,z,ipl);
57  }
58  inline void
59  atmost(Home home, const IntVarArgs& x, IntVar y, IntVar z,
60  IntPropLevel ipl) {
61  count(home,x,y,IRT_LQ,z,ipl);
62  }
63  inline void
64  atmost(Home home, const IntVarArgs& x, const IntArgs& y, IntVar z,
65  IntPropLevel ipl) {
66  count(home,x,y,IRT_LQ,z,ipl);
67  }
68 
69  inline void
70  atleast(Home home, const IntVarArgs& x, int n, int m,
71  IntPropLevel ipl) {
72  count(home,x,n,IRT_GQ,m,ipl);
73  }
74  inline void
75  atleast(Home home, const IntVarArgs& x, IntVar y, int m,
76  IntPropLevel ipl) {
77  count(home,x,y,IRT_GQ,m,ipl);
78  }
79  inline void
80  atleast(Home home, const IntVarArgs& x, const IntArgs& y, int m,
81  IntPropLevel ipl) {
82  count(home,x,y,IRT_GQ,m,ipl);
83  }
84  inline void
85  atleast(Home home, const IntVarArgs& x, int n, IntVar z,
86  IntPropLevel ipl) {
87  count(home,x,n,IRT_GQ,z,ipl);
88  }
89  inline void
90  atleast(Home home, const IntVarArgs& x, IntVar y, IntVar z,
91  IntPropLevel ipl) {
92  count(home,x,y,IRT_GQ,z,ipl);
93  }
94  inline void
95  atleast(Home home, const IntVarArgs& x, const IntArgs& y, IntVar z,
96  IntPropLevel ipl) {
97  count(home,x,y,IRT_GQ,z,ipl);
98  }
99 
100  inline void
101  exactly(Home home, const IntVarArgs& x, int n, int m,
102  IntPropLevel ipl) {
103  count(home,x,n,IRT_EQ,m,ipl);
104  }
105  inline void
106  exactly(Home home, const IntVarArgs& x, IntVar y, int m,
107  IntPropLevel ipl) {
108  count(home,x,y,IRT_EQ,m,ipl);
109  }
110  inline void
111  exactly(Home home, const IntVarArgs& x, const IntArgs& y, int m,
112  IntPropLevel ipl) {
113  count(home,x,y,IRT_EQ,m,ipl);
114  }
115  inline void
116  exactly(Home home, const IntVarArgs& x, int n, IntVar z,
117  IntPropLevel ipl) {
118  count(home,x,n,IRT_EQ,z,ipl);
119  }
120  inline void
122  IntPropLevel ipl) {
123  count(home,x,y,IRT_EQ,z,ipl);
124  }
125  inline void
126  exactly(Home home, const IntVarArgs& x, const IntArgs& y, IntVar z,
127  IntPropLevel ipl) {
128  count(home,x,y,IRT_EQ,z,ipl);
129  }
130 
131  inline void
132  lex(Home home, const IntVarArgs& x, IntRelType r, const IntVarArgs& y,
133  IntPropLevel ipl) {
134  rel(home,x,r,y,ipl);
135  }
136  inline void
137  lex(Home home, const BoolVarArgs& x, IntRelType r, const BoolVarArgs& y,
138  IntPropLevel ipl) {
139  rel(home,x,r,y,ipl);
140  }
141 
142  inline void
143  values(Home home, const IntVarArgs& x, IntSet y,
144  IntPropLevel ipl) {
145  dom(home,x,y,ipl);
146  nvalues(home,x,IRT_EQ,static_cast<int>(y.size()),ipl);
147  }
148 
149 #ifdef GECODE_HAS_SET_VARS
150 
151  inline void
152  channel(Home home, const IntVarArgs& x, SetVar y) {
153  rel(home,SOT_UNION,x,y);
154  nvalues(home,x,IRT_EQ,expr(home,cardinality(y)));
155  }
156 
157  inline void
158  range(Home home, const IntVarArgs& x, SetVar y, SetVar z) {
159  element(home,SOT_UNION,x,y,z);
160  }
161 
162  inline void
163  roots(Home home, const IntVarArgs& x, SetVar y, SetVar z) {
164  SetVarArgs xiv(home,z.lubMax()+1,IntSet::empty,0,x.size()-1);
165  channel(home,x,xiv);
166  element(home,SOT_UNION,xiv,z,y);
167  }
168 
169 #endif
170 
171 }
172 
173 // STATISTICS: minimodel-any
174 
void values(Home home, const IntVarArgs &x, IntSet y, IntPropLevel ipl)
Post constraint .
Definition: aliases.hpp:143
Post propagator for SetVar x
Definition: set.hh:767
IntRelType
Relation types for integers.
Definition: int.hh:925
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:767
int lubMax(void) const
Return maximum element of least upper bound.
Definition: set.hpp:87
@ IRT_GQ
Greater or equal ( )
Definition: int.hh:930
Passing integer variables.
Definition: int.hh:656
void element(Home home, IntSharedArray c, IntVar x0, IntVar x1, IntPropLevel)
Post domain consistent propagator for .
Definition: element.cpp:39
static const IntSet empty
Empty set.
Definition: int.hh:283
void atleast(Home home, const IntVarArgs &x, int n, int m, IntPropLevel ipl)
Post constraint .
Definition: aliases.hpp:70
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Definition: set.hh:767
Passing set variables.
Definition: set.hh:488
void exactly(Home home, const IntVarArgs &x, int n, int m, IntPropLevel ipl)
Post constraint .
Definition: aliases.hpp:101
void range(Home home, const IntVarArgs &x, SetVar y, SetVar z)
Post constraint .
Definition: aliases.hpp:158
IntPropLevel
Propagation levels for integer propagators.
Definition: int.hh:974
void atmost(Home home, const IntVarArgs &x, int n, int m, IntPropLevel ipl)
Post constraint .
Definition: aliases.hpp:39
void nvalues(Home home, const IntVarArgs &x, IntRelType irt, int y, IntPropLevel)
Post propagator for .
Definition: nvalues.cpp:40
Gecode toplevel namespace
Integer sets.
Definition: int.hh:174
BoolVar expr(Home home, const BoolExpr &e, const IntPropLevels &ipls)
Post Boolean expression and return its value.
Definition: bool-expr.cpp:629
Passing Boolean variables.
Definition: int.hh:712
Home class for posting propagators
Definition: core.hpp:856
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
Definition: dom.cpp:40
@ SOT_UNION
Union.
Definition: set.hh:661
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:767
Set variables
Definition: set.hh:127
LinIntExpr cardinality(const SetExpr &e)
Cardinality of set expression.
Definition: set-expr.cpp:817
Integer variables.
Definition: int.hh:371
void lex(Home home, const IntVarArgs &x, IntRelType r, const IntVarArgs &y, IntPropLevel ipl)
Post lexical order between x and y.
Definition: aliases.hpp:132
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Definition: rel.cpp:43
void count(Home home, const IntVarArgs &x, int n, IntRelType irt, int m, IntPropLevel)
Post propagator for .
Definition: count.cpp:40
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
Definition: channel.cpp:41
@ IRT_EQ
Equality ( )
Definition: int.hh:926
void roots(Home home, const IntVarArgs &x, SetVar y, SetVar z)
Post constraint .
Definition: aliases.hpp:163
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
Passing integer arguments.
Definition: int.hh:628
@ IRT_LQ
Less or equal ( )
Definition: int.hh:928