Generated on Mon Aug 27 2012 17:15:40 for Gecode by doxygen 1.8.1.2
distinct.hh
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  * Guido Tack <tack@gecode.org>
6  *
7  * Contributing authors:
8  * Gabor Szokoli <szokoli@gecode.org>
9  *
10  * Copyright:
11  * Christian Schulte, 2002
12  * Guido Tack, 2004
13  * Gabor Szokoli, 2003
14  *
15  * Last modified:
16  * $Date: 2011-10-07 02:27:42 +1100 (Fri, 07 Oct 2011) $ by $Author: schulte $
17  * $Revision: 12423 $
18  *
19  * This file is part of Gecode, the generic constraint
20  * development environment:
21  * http://www.gecode.org
22  *
23  * Permission is hereby granted, free of charge, to any person obtaining
24  * a copy of this software and associated documentation files (the
25  * "Software"), to deal in the Software without restriction, including
26  * without limitation the rights to use, copy, modify, merge, publish,
27  * distribute, sublicense, and/or sell copies of the Software, and to
28  * permit persons to whom the Software is furnished to do so, subject to
29  * the following conditions:
30  *
31  * The above copyright notice and this permission notice shall be
32  * included in all copies or substantial portions of the Software.
33  *
34  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
35  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
36  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
37  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
38  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
39  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
40  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41  *
42  */
43 
44 #ifndef __GECODE_INT_DISTINCT_HH__
45 #define __GECODE_INT_DISTINCT_HH__
46 
47 #include <gecode/int.hh>
48 
50 #include <gecode/int/rel.hh>
51 
57 namespace Gecode { namespace Int { namespace Distinct {
58 
67  template<class View>
68  class Val : public NaryPropagator<View,PC_INT_VAL> {
69  protected:
71 
73  Val(Home home, ViewArray<View>& x);
75  Val(Space& home, bool share, Val<View>& p);
76  public:
78  virtual Actor* copy(Space& home, bool share);
80  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
82  static ExecStatus post(Home home, ViewArray<View>& x);
83  };
84 
98  template<class View, bool complete>
100 
101 
102 
128  template<class View>
129  class Bnd : public Propagator {
130  protected:
136  int min_x;
138  int max_x;
140  Bnd(Home home, ViewArray<View>& x);
142  Bnd(Space& home, bool share, Bnd<View>& p);
143  public:
145  static ExecStatus post(Home home, ViewArray<View>& x);
147  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
154  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
156  virtual Actor* copy(Space& home, bool share);
158  virtual size_t dispose(Space& home);
159  };
160 
169  template<class View>
170  ExecStatus prop_bnd(Space& home, ViewArray<View>& x, int& min_x, int& max_x);
171 
180  template<class View>
182 
183 
185  template<class View>
186  class Graph : public ViewValGraph::Graph<View> {
187  public:
196  Graph(void);
200  bool mark(Space& home);
202  ExecStatus prune(Space& home, bool& assigned);
204  bool sync(Space& home);
205  };
206 
217  template<class View>
218  class DomCtrl {
219  protected:
222  public:
224  DomCtrl(void);
226  bool available(void);
230  ExecStatus sync(Space& home);
232  ExecStatus propagate(Space& home, bool& assigned);
233  };
234 
250  template<class View>
251  class Dom : public NaryPropagator<View,PC_INT_DOM> {
252  protected:
257  Dom(Space& home, bool share, Dom<View>& p);
259  Dom(Home home, ViewArray<View>& x);
260  public:
262  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
269  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
271  virtual Actor* copy(Space& home, bool share);
273  static ExecStatus post(Home home, ViewArray<View>& x);
274  };
275 
282  template<class View>
283  class TerDom : public TernaryPropagator<View,PC_INT_DOM> {
284  protected:
288 
290  TerDom(Space& home, bool share, TerDom<View>& p);
292  TerDom(Home home, View x0, View x1, View x2);
293  public:
295  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
297  virtual Actor* copy(Space& home, bool share);
299  static ExecStatus post(Home home, View x0, View x1, View x2);
300  };
301 
302 }}}
303 
310 
311 #endif
312 
313 // STATISTICS: int-prop
314