Generated on Sat Feb 7 2015 02:01:24 for Gecode by doxygen 1.8.9.1
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  * Last modified:
10  * $Date: 2013-02-14 16:29:11 +0100 (Thu, 14 Feb 2013) $ by $Author: schulte $
11  * $Revision: 13292 $
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 namespace Gecode {
39 
40  namespace Int { namespace Linear {
41 
46  class NoView : public ConstView<IntView> {
47  public:
49 
50  NoView(void) {}
53 
55 
56  int min(void) const { return 0; }
59  int max(void) const { return 0; }
61  int med(void) const { return 0; }
63  int val(void) const { return 0; }
64 
66  unsigned int size(void) const { return 1; }
68  unsigned int width(void) const { return 1; }
70  unsigned int regret_min(void) const { return 0; }
72  unsigned int regret_max(void) const { return 0; }
74 
76 
77  bool range(void) const { return true; }
80  bool assigned(void) const { return true; }
81 
83  bool in(int n) const { (void) n; return false; }
85  bool in(long long int n) const { (void) n; return false; }
87 
89 
90  ModEvent lq(Space& home, int n) {
92  (void) home; (void) n;
93  return ME_INT_NONE;
94  }
96  ModEvent lq(Space& home, long long int n) {
97  (void) home; (void) n;
98  return ME_INT_NONE;
99  }
101  ModEvent le(Space& home, int n) {
102  (void) home; (void) n;
103  return ME_INT_NONE;
104  }
106  ModEvent le(Space& home, long long int n) {
107  (void) home; (void) n;
108  return ME_INT_NONE;
109  }
111  ModEvent gq(Space& home, int n) {
112  (void) home; (void) n;
113  return ME_INT_NONE;
114  }
116  ModEvent gq(Space& home, long long int n) {
117  (void) home; (void) n;
118  return ME_INT_NONE;
119  }
121  ModEvent gr(Space& home, int n) {
122  (void) home; (void) n;
123  return ME_INT_NONE;
124  }
126  ModEvent gr(Space& home, long long int n) {
127  (void) home; (void) n;
128  return ME_INT_NONE;
129  }
131  ModEvent nq(Space& home, int n) {
132  (void) home; (void) n;
133  return ME_INT_NONE;
134  }
136  ModEvent nq(Space& home, long long int n) {
137  (void) home; (void) n;
138  return ME_INT_NONE;
139  }
141  ModEvent eq(Space& home, int n) {
142  (void) home; (void) n;
143  return ME_INT_NONE;
144  }
146  ModEvent eq(Space& home, long long int n) {
147  (void) home; (void) n;
148  return ME_INT_NONE;
149  }
151  };
152 
157  template<class Char, class Traits>
158  std::basic_ostream<Char,Traits>&
159  operator <<(std::basic_ostream<Char,Traits>& os, const NoView&) { return os; }
160 
161  }}
162 
163 
168  template<>
169  class ViewArray<Int::Linear::NoView> {
170  public:
172 
173  ViewArray(void) {}
176  ViewArray(Space& home, int m) { (void) home; (void) m; }
184 
186 
187  int size(void) const { return 0; }
190  void size(int n) { (void) n; }
192 
194 
197  (void) i;
199  return n;
200  }
202  const Int::Linear::NoView operator [](int i) const {
203  (void) i;
205  return n;
206  }
208 
210 
211  void subscribe(Space&, Propagator& p, PropCond pc, bool process=true) {
213  (void) p; (void) pc; (void) process;
214  }
216  void cancel(Space& home, Propagator& p, PropCond pc) {
217  (void) home; (void) p; (void) pc;
218  }
220 
222 
223 
231  (void) share; (void) a;
232  }
234 
236 
237  void move_fst(int i) { (void) i; }
240  void move_lst(int i) { (void) i; }
242  private:
243  static void* operator new(size_t);
244  static void operator delete(void*,size_t);
245  };
246 
247 }
248 
249 
250 // STATISTICS: int-prop
251 
ModEvent le(Space &home, int n)
Restrict domain values to be less than n.
Definition: int-noview.hpp:101
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition: int-noview.hpp:141
ModEvent eq(Space &home, long long int n)
Restrict domain values to be equal to n.
Definition: int-noview.hpp:146
ViewArray(const ViewArray< Int::Linear::NoView > &)
Initialize.
Definition: int-noview.hpp:178
ModEvent gq(Space &home, long long int n)
Restrict domain values to be greater or equal than n.
Definition: int-noview.hpp:116
No view serves as filler for empty view arrays.
Definition: int-noview.hpp:46
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
Definition: int-noview.hpp:131
ModEvent gr(Space &home, int n)
Restrict domain values to be greater than n.
Definition: int-noview.hpp:121
unsigned int width(void) const
Return width of domain (distance between maximum and minimum)
Definition: int-noview.hpp:68
bool in(int n) const
Test whether n is contained in domain.
Definition: int-noview.hpp:83
int val(void) const
Return assigned value (only if assigned)
Definition: int-noview.hpp:63
int ModEvent
Type for modification events.
Definition: core.hpp:146
Base-class for propagators.
Definition: core.hpp:755
View & operator[](int i)
Return view at position i.
Definition: array.hpp:1227
NoView(void)
Default constructor.
Definition: int-noview.hpp:51
bool in(long long int n) const
Test whether n is contained in domain.
Definition: int-noview.hpp:85
Base-class for constant views.
Definition: view.hpp:45
Computation spaces.
Definition: core.hpp:1362
const ViewArray< View > & operator=(const ViewArray< View > &a)
Initialize from view array a (share elements)
Definition: array.hpp:1208
ModEvent le(Space &home, long long int n)
Restrict domain values to be less than n.
Definition: int-noview.hpp:106
ViewArray(Space &, const ViewArray< Int::Linear::NoView > &)
Initialize.
Definition: int-noview.hpp:180
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition: int-noview.hpp:111
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
void subscribe(Space &home, Propagator &p, PropCond pc, bool process=true)
Subscribe propagator p with propagation condition pc to variable.
Definition: array.hpp:1400
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition: int-noview.hpp:91
int PropCond
Type for propagation conditions.
Definition: core.hpp:156
ModEvent lq(Space &home, long long int n)
Restrict domain values to be less or equal than n.
Definition: int-noview.hpp:96
View array for no view (empty)
Definition: int-noview.hpp:169
unsigned int regret_min(void) const
Return regret of domain minimum (distance to next larger value)
Definition: int-noview.hpp:70
View arrays.
Definition: array.hpp:234
int min(void) const
Return minimum of domain.
Definition: int-noview.hpp:57
int med(void) const
Return median of domain (greatest element not greater than the median)
Definition: int-noview.hpp:61
ModEvent gr(Space &home, long long int n)
Restrict domain values to be greater than n.
Definition: int-noview.hpp:126
unsigned int size(void) const
Return size (cardinality) of domain.
Definition: int-noview.hpp:66
ModEvent nq(Space &home, long long int n)
Restrict domain values to be different from n.
Definition: int-noview.hpp:136
ViewArray(Space &home, int m)
Allocate array with m variables.
Definition: int-noview.hpp:176
unsigned int regret_max(void) const
Return regret of domain maximum (distance to next smaller value)
Definition: int-noview.hpp:72
void update(Space &, bool share, ViewArray< Int::Linear::NoView > &a)
Update array to be a clone of array a.
Definition: int-noview.hpp:230
bool assigned(void) const
Test whether view is assigned.
Definition: int-noview.hpp:80
int size(void) const
Return size of array (number of elements)
Definition: array.hpp:1215
void move_fst(int i)
Move view from position 0 to position i (shift elements to the left)
Definition: array.hpp:1289
Gecode toplevel namespace
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p with propagation condition pc to all views.
Definition: int-noview.hpp:216
void move_lst(int i)
Move assigned view from position size()-1 to position i (truncate array by one)
Definition: int-noview.hpp:240
const Gecode::ModEvent ME_INT_NONE
Domain operation has not changed domain.
Definition: var-type.hpp:54
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
void size(int n)
Decrease size of array (number of elements)
Definition: int-noview.hpp:190
int max(void) const
Return maximum of domain.
Definition: int-noview.hpp:59
ViewArray(void)
Default constructor (array of size 0)
Definition: array.hpp:1163
bool range(void) const
Test whether domain is a range.
Definition: int-noview.hpp:78