Generated on Sat Jun 2 2018 07:17:44 for Gecode by doxygen 1.8.13
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 
34 namespace Gecode {
35 
36  namespace Int { namespace Linear {
37 
42  class NoView : public ConstView<IntView> {
43  public:
45 
46  NoView(void) {}
49 
51 
52  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  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  ModEvent lq(Space& home, int n) {
88  (void) home; (void) n;
89  return ME_INT_NONE;
90  }
92  ModEvent lq(Space& home, long long int n) {
93  (void) home; (void) n;
94  return ME_INT_NONE;
95  }
97  ModEvent le(Space& home, int n) {
98  (void) home; (void) n;
99  return ME_INT_NONE;
100  }
102  ModEvent le(Space& home, long long int n) {
103  (void) home; (void) n;
104  return ME_INT_NONE;
105  }
107  ModEvent gq(Space& home, int n) {
108  (void) home; (void) n;
109  return ME_INT_NONE;
110  }
112  ModEvent gq(Space& home, long long int n) {
113  (void) home; (void) n;
114  return ME_INT_NONE;
115  }
117  ModEvent gr(Space& home, int n) {
118  (void) home; (void) n;
119  return ME_INT_NONE;
120  }
122  ModEvent gr(Space& home, long long int n) {
123  (void) home; (void) n;
124  return ME_INT_NONE;
125  }
127  ModEvent nq(Space& home, int n) {
128  (void) home; (void) n;
129  return ME_INT_NONE;
130  }
132  ModEvent nq(Space& home, long long int n) {
133  (void) home; (void) n;
134  return ME_INT_NONE;
135  }
137  ModEvent eq(Space& home, int n) {
138  (void) home; (void) n;
139  return ME_INT_NONE;
140  }
142  ModEvent eq(Space& home, long long int n) {
143  (void) home; (void) n;
144  return ME_INT_NONE;
145  }
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<>
165  class ViewArray<Int::Linear::NoView> {
166  public:
168 
169  ViewArray(void) {}
172  ViewArray(Space& home, int m) { (void) home; (void) m; }
178  const ViewArray<Int::Linear::NoView>& operator =(const ViewArray<Int::Linear::NoView>&) { return *this; }
180 
182 
183  int size(void) const { return 0; }
186  void size(int n) { (void) n; }
188 
190 
191  Int::Linear::NoView operator [](int i) {
193  (void) i;
195  return n;
196  }
198  const Int::Linear::NoView operator [](int i) const {
199  (void) i;
201  return n;
202  }
204 
206 
207  void subscribe(Space&, Propagator& p, PropCond pc, bool process=true) {
209  (void) p; (void) pc; (void) process;
210  }
212  void cancel(Space& home, Propagator& p, PropCond pc) {
213  (void) home; (void) p; (void) pc;
214  }
216  void reschedule(Space& home, Propagator& p, PropCond pc) {
217  (void) home; (void) p; (void) pc;
218  }
220 
222 
225  (void) home; (void) a;
226  }
228 
230 
231  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 
int max(void) const
Return maximum of domain.
Definition: int-noview.hpp:55
ModEvent le(Space &home, int n)
Restrict domain values to be less than n.
Definition: int-noview.hpp:97
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition: int-noview.hpp:137
bool range(void) const
Test whether domain is a range.
Definition: int-noview.hpp:74
ModEvent eq(Space &home, long long int n)
Restrict domain values to be equal to n.
Definition: int-noview.hpp:142
ViewArray(const ViewArray< Int::Linear::NoView > &)
Initialize.
Definition: int-noview.hpp:174
ModEvent gq(Space &home, long long int n)
Restrict domain values to be greater or equal than n.
Definition: int-noview.hpp:112
void subscribe(Space &home, Propagator &p, PropCond pc, bool schedule=true)
Subscribe propagator p with propagation condition pc to view.
Definition: view.hpp:410
No view serves as filler for empty view arrays.
Definition: int-noview.hpp:42
bool in(int n) const
Test whether n is contained in domain.
Definition: int-noview.hpp:79
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
Definition: int-noview.hpp:127
ModEvent gr(Space &home, int n)
Restrict domain values to be greater than n.
Definition: int-noview.hpp:117
int ModEvent
Type for modification events.
Definition: core.hpp:62
Base-class for propagators.
Definition: core.hpp:1023
bool in(long long int n) const
Test whether n is contained in domain.
Definition: int-noview.hpp:81
NoView(void)
Default constructor.
Definition: int-noview.hpp:47
Base-class for constant views.
Definition: view.hpp:45
Computation spaces.
Definition: core.hpp:1701
ModEvent le(Space &home, long long int n)
Restrict domain values to be less than n.
Definition: int-noview.hpp:102
unsigned int regret_max(void) const
Return regret of domain maximum (distance to next smaller value)
Definition: int-noview.hpp:68
ViewArray(Space &, const ViewArray< Int::Linear::NoView > &)
Initialize.
Definition: int-noview.hpp:176
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition: int-noview.hpp:107
Gecode::IntArgs i(4, 1, 2, 3, 4)
unsigned int width(void) const
Return width of domain (distance between maximum and minimum)
Definition: int-noview.hpp:64
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:234
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition: int-noview.hpp:87
int PropCond
Type for propagation conditions.
Definition: core.hpp:72
ModEvent lq(Space &home, long long int n)
Restrict domain values to be less or equal than n.
Definition: int-noview.hpp:92
View array for no view (empty)
Definition: int-noview.hpp:165
void reschedule(Space &home, Propagator &p, PropCond pc)
Schedule propagator p.
Definition: int-noview.hpp:216
View arrays.
Definition: array.hpp:224
bool assigned(void) const
Test whether view is assigned.
Definition: int-noview.hpp:76
int min(void) const
Return minimum of domain.
Definition: int-noview.hpp:53
ModEvent gr(Space &home, long long int n)
Restrict domain values to be greater than n.
Definition: int-noview.hpp:122
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
unsigned int regret_min(void) const
Return regret of domain minimum (distance to next larger value)
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:132
unsigned int size(void) const
Return size (cardinality) of domain.
Definition: int-noview.hpp:62
ViewArray(Space &home, int m)
Allocate array with m variables.
Definition: int-noview.hpp:172
void update(Space &home, ConstView &y)
Update this view to be a clone of view y.
Definition: view.hpp:455
int med(void) const
Return median of domain (greatest element not greater than the median)
Definition: int-noview.hpp:57
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:212
void move_lst(int i)
Move assigned view from position size()-1 to position i (truncate array by one)
Definition: int-noview.hpp:234
const Gecode::ModEvent ME_INT_NONE
Domain operation has not changed domain.
Definition: var-type.hpp:54
void size(int n)
Decrease size of array (number of elements)
Definition: int-noview.hpp:186
int val(void) const
Return assigned value (only if assigned)
Definition: int-noview.hpp:59