Generated on Thu Mar 13 2014 04:39:28 for Gecode by doxygen 1.8.1.2
int.hh
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Guido Tack <tack@gecode.org>
5  * Christian Schulte <schulte@gecode.org>
6  *
7  * Copyright:
8  * Guido Tack, 2004
9  * Christian Schulte, 2004
10  *
11  * Last modified:
12  * $Date: 2011-05-02 08:24:42 +1000 (Mon, 02 May 2011) $ by $Author: tack $
13  * $Revision: 11973 $
14  *
15  * This file is part of Gecode, the generic constraint
16  * development environment:
17  * http://www.gecode.org
18  *
19  * Permission is hereby granted, free of charge, to any person obtaining
20  * a copy of this software and associated documentation files (the
21  * "Software"), to deal in the Software without restriction, including
22  * without limitation the rights to use, copy, modify, merge, publish,
23  * distribute, sublicense, and/or sell copies of the Software, and to
24  * permit persons to whom the Software is furnished to do so, subject to
25  * the following conditions:
26  *
27  * The above copyright notice and this permission notice shall be
28  * included in all copies or substantial portions of the Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37  *
38  */
39 
40 #ifndef __GECODE_SET_INT_HH__
41 #define __GECODE_SET_INT_HH__
42 
43 #include <gecode/set.hh>
44 
45 namespace Gecode { namespace Set { namespace Int {
46 
58  template<class View>
59  class MinElement :
60  public MixBinaryPropagator<View,PC_SET_ANY,
61  Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
62  protected:
68  MinElement(Space& home, bool share,MinElement& p);
71  public:
73  virtual Actor* copy(Space& home,bool);
75  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
77  static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
78  };
79 
86  template<class View>
87  class NotMinElement :
88  public MixBinaryPropagator<View,PC_SET_ANY,
89  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> {
90  protected:
96  NotMinElement(Space& home, bool share,NotMinElement& p);
99  public:
101  virtual Actor* copy(Space& home,bool);
103  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
105  static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
106  };
107 
114  template<class View>
115  class ReMinElement :
116  public Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
117  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView> {
118  protected:
126  ReMinElement(Space& home, bool share,ReMinElement& p);
130  public:
132  virtual Actor* copy(Space& home,bool);
134  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
136  static ExecStatus post(Home home, View s, Gecode::Int::IntView x,
138  };
139 
146  template<class View>
147  class MaxElement :
148  public MixBinaryPropagator<View,PC_SET_ANY,Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
149  protected:
150  using MixBinaryPropagator<View,PC_SET_ANY,
152  using MixBinaryPropagator<View,PC_SET_ANY,
155  MaxElement(Space& home, bool share,MaxElement& p);
157  MaxElement(Home home, View, Gecode::Int::IntView);
158  public:
160  virtual Actor* copy(Space& home,bool);
162  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
164  static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
165  };
166 
173  template<class View>
175  public MixBinaryPropagator<View,PC_SET_ANY,
176  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> {
177  protected:
178  using MixBinaryPropagator<View,PC_SET_ANY,
180  using MixBinaryPropagator<View,PC_SET_ANY,
183  NotMaxElement(Space& home, bool share,NotMaxElement& p);
186  public:
188  virtual Actor* copy(Space& home,bool);
190  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
192  static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
193  };
194 
201  template<class View>
202  class ReMaxElement :
203  public Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
204  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView> {
205  protected:
213  ReMaxElement(Space& home, bool share,ReMaxElement& p);
216  public:
218  virtual Actor* copy(Space& home,bool);
220  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
222  static ExecStatus post(Home home, View s, Gecode::Int::IntView x,
224  };
225 
232  template<class View>
233  class Card :
234  public MixBinaryPropagator<View,PC_SET_CARD,
235  Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
236  protected:
237  using MixBinaryPropagator<View,PC_SET_CARD,
239  using MixBinaryPropagator<View,PC_SET_CARD,
242  Card(Space& home, bool share,Card& p);
244  Card(Home home, View, Gecode::Int::IntView);
245  public:
247  virtual Actor* copy(Space& home,bool);
249  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
251  static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
252  };
253 
254 
261  template<class View>
262  class Match : public Propagator {
263  protected:
265  View x0;
268 
270  Match(Space& home, bool share,Match& p);
273  public:
275  virtual Actor* copy(Space& home,bool);
277  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
279  virtual size_t dispose(Space& home);
281  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
283  static ExecStatus post(Home home, View s,
285  };
286 
304  template<class View>
305  class ChannelInt : public Propagator {
306  protected:
311 
313  ChannelInt(Space& home, bool share,ChannelInt& p);
315  ChannelInt(Home home,
318  public:
320  virtual Actor* copy(Space& home,bool);
322  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
324  virtual size_t dispose(Space& home);
326  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
328  static ExecStatus post(Home home,
330  Gecode::Int::IntView> >& x,
332  };
333 
345  template<class View>
347  : public MixNaryOnePropagator<Gecode::Int::BoolView,
348  Gecode::Int::PC_BOOL_VAL,
349  View,PC_GEN_NONE> {
350  protected:
354  using Super::x;
355  using Super::y;
356 
358  ChannelBool(Space& home, bool share,ChannelBool& p);
361  View);
362 
364  class IndexAdvisor : public Advisor {
365  protected:
367  int idx;
368  public:
370  template<class A>
372  int index);
374  IndexAdvisor(Space& home, bool share, IndexAdvisor& a);
376  int index(void) const;
378  template<class A>
379  void dispose(Space& home, Council<A>& c);
380  };
381 
391  bool running;
392  public:
394  virtual Actor* copy(Space& home,bool);
396  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
398  virtual size_t dispose(Space& home);
400  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
402  virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
405  View y);
406  };
407 
414  template<class View>
415  class Weights : public Propagator {
416  protected:
421 
423  View x;
426 
428  Weights(Space& home, bool share,Weights& p);
430  Weights(Home home, const SharedArray<int>&, const SharedArray<int>&,
431  View, Gecode::Int::IntView);
432  public:
434  virtual Actor* copy(Space& home,bool);
436  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
438  virtual size_t dispose(Space& home);
440  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
442  static ExecStatus post(Home home,
443  const SharedArray<int>& elements,
444  const SharedArray<int>& weights,
445  View x, Gecode::Int::IntView y);
446  };
447 
448 }}}
449 
450 #include <gecode/set/int/minmax.hpp>
451 #include <gecode/set/int/card.hpp>
452 #include <gecode/set/int/match.hpp>
456 
457 #endif
458 
459 // STATISTICS: set-prop