Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0
int-noview.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, 2002
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 {
35
36 namespace Int { namespace Linear {
37
42 class NoView : public ConstView<IntView> {
43 public:
45
46
47 NoView(void) {}
49
51
52
53 int min(void) const { return 0; }
55 int max(void) const { return 0; }
57 int med(void) const { return 0; }
59 int val(void) const { return 0; }
60
62 unsigned int size(void) const { return 1; }
64 unsigned int width(void) const { return 1; }
66 unsigned int regret_min(void) const { return 0; }
68 unsigned int regret_max(void) const { return 0; }
70
72
73
74 bool range(void) const { return true; }
76 bool assigned(void) const { return true; }
77
79 bool in(int n) const { (void) n; return false; }
81 bool in(long long int n) const { (void) n; return false; }
83
85
86
87 ModEvent lq(Space& home, int n) {
88 (void) home; (void) n;
89 return ME_INT_NONE;
90 }
91
92 ModEvent lq(Space& home, long long int n) {
93 (void) home; (void) n;
94 return ME_INT_NONE;
95 }
96
97 ModEvent le(Space& home, int n) {
98 (void) home; (void) n;
99 return ME_INT_NONE;
100 }
101
102 ModEvent le(Space& home, long long int n) {
103 (void) home; (void) n;
104 return ME_INT_NONE;
105 }
106
107 ModEvent gq(Space& home, int n) {
108 (void) home; (void) n;
109 return ME_INT_NONE;
110 }
111
112 ModEvent gq(Space& home, long long int n) {
113 (void) home; (void) n;
114 return ME_INT_NONE;
115 }
116
117 ModEvent gr(Space& home, int n) {
118 (void) home; (void) n;
119 return ME_INT_NONE;
120 }
121
122 ModEvent gr(Space& home, long long int n) {
123 (void) home; (void) n;
124 return ME_INT_NONE;
125 }
126
127 ModEvent nq(Space& home, int n) {
128 (void) home; (void) n;
129 return ME_INT_NONE;
130 }
131
132 ModEvent nq(Space& home, long long int n) {
133 (void) home; (void) n;
134 return ME_INT_NONE;
135 }
136
137 ModEvent eq(Space& home, int n) {
138 (void) home; (void) n;
139 return ME_INT_NONE;
140 }
141
142 ModEvent eq(Space& home, long long int n) {
143 (void) home; (void) n;
144 return ME_INT_NONE;
145 }
146
147 };
148
153 template<class Char, class Traits>
154 std::basic_ostream<Char,Traits>&
155 operator <<(std::basic_ostream<Char,Traits>& os, const NoView&) { return os; }
156
157 }}
158
159
164 template<>
166 public:
168
169
170 ViewArray(void) {}
172 ViewArray(Space& home, int m) { (void) home; (void) m; }
180
182
183
184 int size(void) const { return 0; }
186 void size(int n) { (void) n; }
188
190
191
193 (void) i;
195 return n;
196 }
197
198 const Int::Linear::NoView operator [](int i) const {
199 (void) i;
201 return n;
202 }
203
204
206
207
208 void subscribe(Space&, Propagator& p, PropCond pc, bool process=true) {
209 (void) p; (void) pc; (void) process;
210 }
211
212 void cancel(Space& home, Propagator& p, PropCond pc) {
213 (void) home; (void) p; (void) pc;
214 }
215
216 void reschedule(Space& home, Propagator& p, PropCond pc) {
217 (void) home; (void) p; (void) pc;
218 }
219
220
222
223
225 (void) home; (void) a;
226 }
227
228
230
231
232 void move_fst(int i) { (void) i; }
234 void move_lst(int i) { (void) i; }
236 private:
237 static void* operator new(size_t);
238 static void operator delete(void*,size_t);
239 };
240
241}
242
243
244// STATISTICS: int-prop
245
Base-class for constant views.
Definition view.hpp:45
No view serves as filler for empty view arrays.
unsigned int regret_min(void) const
Return regret of domain minimum (distance to next larger value)
int med(void) const
Return median of domain (greatest element not greater than the median)
ModEvent le(Space &home, long long int n)
Restrict domain values to be less than n.
ModEvent lq(Space &home, long long int n)
Restrict domain values to be less or equal than n.
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
NoView(void)
Default constructor.
int max(void) const
Return maximum of domain.
int min(void) const
Return minimum of domain.
unsigned int size(void) const
Return size (cardinality) of domain.
int val(void) const
Return assigned value (only if assigned)
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
ModEvent eq(Space &home, long long int n)
Restrict domain values to be equal to n.
ModEvent gr(Space &home, int n)
Restrict domain values to be greater than n.
unsigned int width(void) const
Return width of domain (distance between maximum and minimum)
bool range(void) const
Test whether domain is a range.
ModEvent gq(Space &home, long long int n)
Restrict domain values to be greater or equal than n.
bool assigned(void) const
Test whether view is assigned.
bool in(long long int n) const
Test whether n is contained in domain.
ModEvent nq(Space &home, long long int n)
Restrict domain values to be different from n.
ModEvent gr(Space &home, long long int n)
Restrict domain values to be greater than n.
unsigned int regret_max(void) const
Return regret of domain maximum (distance to next smaller value)
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
ModEvent le(Space &home, int n)
Restrict domain values to be less than n.
bool in(int n) const
Test whether n is contained in domain.
std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &os, const NoView &)
Print integer variable view.
Base-class for propagators.
Definition core.hpp:1066
Computation spaces.
Definition core.hpp:1744
void size(int n)
Decrease size of array (number of elements)
ViewArray(void)
Default constructor (array of size 0)
ViewArray(const ViewArray< Int::Linear::NoView > &)
Initialize.
void subscribe(Space &, Propagator &p, PropCond pc, bool process=true)
Subscribe propagator p with propagation condition pc to all views.
void move_fst(int i)
Move assigned view from position 0 to position i (shift elements to the left)
void update(Space &home, ViewArray< Int::Linear::NoView > &a)
Update array to be a clone of array a.
ViewArray(Space &, const ViewArray< Int::Linear::NoView > &)
Initialize.
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p with propagation condition pc to all views.
int size(void) const
Return size of array (number of elements)
ViewArray(Space &home, int m)
Allocate array with m variables.
void move_lst(int i)
Move assigned view from position size()-1 to position i (truncate array by one)
void reschedule(Space &home, Propagator &p, PropCond pc)
Schedule propagator p.
View & operator[](int i)
Return view at position i.
Definition array.hpp:1174
const ViewArray< View > & operator=(const ViewArray< View > &a)
Initialize from view array a (share elements)
Definition array.hpp:1155
Linear propagators
Finite domain integers.
const Gecode::ModEvent ME_INT_NONE
Domain operation has not changed domain.
Definition var-type.hpp:54
Gecode toplevel namespace
int PropCond
Type for propagation conditions.
Definition core.hpp:72
int ModEvent
Type for modification events.
Definition core.hpp:62