MCPcopy Create free account
hub / github.com/Gecode/gecode / IntSet

Class IntSet

gecode/int.hh:174–285  ·  view source on GitHub ↗

* \brief Integer sets * * Integer sets are the means to specify arbitrary sets * of integers to be used as domains for integer variables. * \ingroup TaskModelIntVars TaskModelSetVars */

Source from the content-addressed store, hash-verified

172 * \ingroup TaskModelIntVars TaskModelSetVars
173 */
174 class IntSet : public SharedHandle {
175 friend class IntSetRanges;
176 template<class I> friend class IntSetInit;
177 private:
178 /// %Range (intervals) of integers
179 class Range {
180 public:
181 int min, max;
182 };
183 class IntSetObject : public SharedHandle::Object {
184 public:
185 /// Size of set
186 unsigned int size;
187 /// Number of ranges
188 int n;
189 /// Array of ranges
190 Range* r;
191 /// Allocate object with \a m elements
192 GECODE_INT_EXPORT static IntSetObject* allocate(int m);
193 /// Check whether \a n is included in the set
194 GECODE_INT_EXPORT bool in(int n) const;
195 /// Perform equality test on ranges
196 GECODE_INT_EXPORT bool equal(const IntSetObject& so) const;
197 /// Delete object
198 GECODE_INT_EXPORT virtual ~IntSetObject(void);
199 };
200 /// Sort ranges according to increasing minimum
201 class MinInc;
202 /// Normalize the first \a n elements of \a r
203 GECODE_INT_EXPORT void normalize(Range* r, int n);
204 /// Initialize as range with minimum \a n and maximum \a m
205 GECODE_INT_EXPORT void init(int n, int m);
206 /// Initialize with \a n integers from array \a r
207 GECODE_INT_EXPORT void init(const int r[], int n);
208 /// Initialize with \a n ranges from array \a r
209 GECODE_INT_EXPORT void init(const int r[][2], int n);
210 public:
211 /// \name Constructors and initialization
212 //@{
213 /// Initialize as empty set
214 IntSet(void);
215 /** \brief Initialize as range with minimum \a n and maximum \a m
216 *
217 * Note that the set is empty if \a n is larger than \a m
218 */
219 explicit IntSet(int n, int m);
220 /// Initialize with \a n integers from array \a r
221 explicit IntSet(const int r[], int n);
222 /** \brief Initialize with \a n ranges from array \a r
223 *
224 * For position \a i in the array \a r, the minimum is \a r[\a i][0]
225 * and the maximum is \a r[\a i][1].
226 */
227 explicit IntSet(const int r[][2], int n);
228 /// Initialize with range iterator \a i
229 template<class I>
230 explicit IntSet(I& i);
231 /// Initialize with range iterator \a i

Callers 15

solutionMethod · 0.85
LatinMethod · 0.85
ISAFunction · 0.85
removeFromLubMethod · 0.85
addToGlbMethod · 0.85
set.cppFile · 0.85
rel-op-const.cppFile · 0.85
WaitMethod · 0.85
MatrixIntSetMethod · 0.85
ConstructMethod · 0.85
postMethod · 0.85
postMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected