Generated on Sat Jun 2 2018 07:17:44 for Gecode by doxygen 1.8.13
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  * This file is part of Gecode, the generic constraint
12  * development environment:
13  * http://www.gecode.org
14  *
15  * Permission is hereby granted, free of charge, to any person obtaining
16  * a copy of this software and associated documentation files (the
17  * "Software"), to deal in the Software without restriction, including
18  * without limitation the rights to use, copy, modify, merge, publish,
19  * distribute, sublicense, and/or sell copies of the Software, and to
20  * permit persons to whom the Software is furnished to do so, subject to
21  * the following conditions:
22  *
23  * The above copyright notice and this permission notice shall be
24  * included in all copies or substantial portions of the Software.
25  *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33  *
34  */
35 
36 #ifndef __GECODE_SET_INT_HH__
37 #define __GECODE_SET_INT_HH__
38 
39 #include <gecode/set.hh>
40 
41 namespace Gecode { namespace Set { namespace Int {
42 
54  template<class View>
55  class MinElement :
56  public MixBinaryPropagator<View,PC_SET_ANY,
57  Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
58  protected:
62  Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
64  MinElement(Space& home, MinElement& p);
66  MinElement(Home home, View, Gecode::Int::IntView);
67  public:
69  virtual Actor* copy(Space& home);
71  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
73  static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
74  };
75 
82  template<class View>
83  class NotMinElement :
84  public MixBinaryPropagator<View,PC_SET_ANY,
85  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> {
86  protected:
90  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x1;
94  NotMinElement(Home home, View, Gecode::Int::IntView);
95  public:
97  virtual Actor* copy(Space& home);
99  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
101  static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
102  };
103 
110  template<class View, ReifyMode rm>
111  class ReMinElement :
112  public Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
113  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView> {
114  protected:
122  ReMinElement(Space& home, ReMinElement& p);
124  ReMinElement(Home home, View, Gecode::Int::IntView,
126  public:
128  virtual Actor* copy(Space& home);
130  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
132  static ExecStatus post(Home home, View s, Gecode::Int::IntView x,
134  };
135 
142  template<class View>
143  class MaxElement :
144  public MixBinaryPropagator<View,PC_SET_ANY,Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
145  protected:
146  using MixBinaryPropagator<View,PC_SET_ANY,
148  using MixBinaryPropagator<View,PC_SET_ANY,
149  Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
151  MaxElement(Space& home, MaxElement& p);
153  MaxElement(Home home, View, Gecode::Int::IntView);
154  public:
156  virtual Actor* copy(Space& home);
158  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
160  static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
161  };
162 
169  template<class View>
171  public MixBinaryPropagator<View,PC_SET_ANY,
172  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> {
173  protected:
174  using MixBinaryPropagator<View,PC_SET_ANY,
176  using MixBinaryPropagator<View,PC_SET_ANY,
177  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM>::x1;
181  NotMaxElement(Home home, View, Gecode::Int::IntView);
182  public:
184  virtual Actor* copy(Space& home);
186  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
188  static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
189  };
190 
197  template<class View, ReifyMode rm>
198  class ReMaxElement :
199  public Gecode::Int::ReMixBinaryPropagator<View,PC_SET_ANY,
200  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,Gecode::Int::BoolView> {
201  protected:
209  ReMaxElement(Space& home, ReMaxElement& p);
211  ReMaxElement(Home home, View, Gecode::Int::IntView, Gecode::Int::BoolView);
212  public:
214  virtual Actor* copy(Space& home);
216  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
218  static ExecStatus post(Home home, View s, Gecode::Int::IntView x,
220  };
221 
228  template<class View>
229  class Card :
230  public MixBinaryPropagator<View,PC_SET_CARD,
231  Gecode::Int::IntView,Gecode::Int::PC_INT_BND> {
232  protected:
233  using MixBinaryPropagator<View,PC_SET_CARD,
235  using MixBinaryPropagator<View,PC_SET_CARD,
236  Gecode::Int::IntView,Gecode::Int::PC_INT_BND>::x1;
238  Card(Space& home, Card& p);
240  Card(Home home, View, Gecode::Int::IntView);
241  public:
243  virtual Actor* copy(Space& home);
245  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
247  static ExecStatus post(Home home, View s, Gecode::Int::IntView x);
248  };
249 
256  template<class View>
257  class Weights : public Propagator {
258  protected:
263 
265  View x;
268 
270  Weights(Space& home, Weights& p);
272  Weights(Home home, const SharedArray<int>&, const SharedArray<int>&,
273  View, Gecode::Int::IntView);
274  public:
276  virtual Actor* copy(Space& home);
278  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
280  virtual void reschedule(Space& home);
282  virtual size_t dispose(Space& home);
284  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
286  static ExecStatus post(Home home,
287  const SharedArray<int>& elements,
288  const SharedArray<int>& weights,
289  View x, Gecode::Int::IntView y);
290  };
291 
292 }}}
293 
294 #include <gecode/set/int/minmax.hpp>
295 #include <gecode/set/int/card.hpp>
297 
298 #endif
299 
300 // STATISTICS: set-prop
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: minmax.hpp:66
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is the minimal element of s.
Definition: minmax.hpp:53
MinElement(Space &home, MinElement &p)
Constructor for cloning p.
Definition: minmax.hpp:61
const Gecode::PropCond PC_SET_CARD
Propagate when the cardinality of a view changes.
Definition: var-type.hpp:216
SharedArray< int > weights
Weights for the elements in the upper bound.
Definition: int.hh:262
Propagator for not maximum element
Definition: int.hh:170
Reified mixed binary propagator.
Definition: propagator.hpp:124
Base-class for propagators.
Definition: core.hpp:1023
Computation spaces.
Definition: core.hpp:1701
Base-class for both propagators and branchers.
Definition: core.hpp:627
Propagator for reified minimum element
Definition: int.hh:111
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:232
Propagator for not minimum element
Definition: int.hh:83
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
Definition: var-type.hpp:91
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:1034
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
Definition: var-type.hpp:100
Gecode::Int::IntView y
The integer view.
Definition: int.hh:267
View x
The set view.
Definition: int.hh:265
const Gecode::PropCond PC_SET_ANY
Propagate when any bound or the cardinality of a view changes.
Definition: var-type.hpp:248
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: minmax.hpp:72
struct Gecode::@585::NNF::@62::@63 b
For binary nodes (and, or, eqv)
Propagator for maximum element
Definition: int.hh:143
Integer view for integer variables.
Definition: view.hpp:129
Mixed binary propagator.
Definition: pattern.hpp:204
Propagation cost.
Definition: core.hpp:485
ExecStatus
Definition: core.hpp:471
Reified propagator for maximum element
Definition: int.hh:198
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low binary)
Definition: pattern.hpp:614
Post propagator for SetVar x
Definition: set.hh:765
Propagator for weight of a set
Definition: int.hh:257
Gecode toplevel namespace
SharedArray< int > elements
List of elements in the upper bound.
Definition: int.hh:260
int ModEventDelta
Modification event deltas.
Definition: core.hpp:89
Home class for posting propagators
Definition: core.hpp:853
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition: pattern.hpp:630
Propagator for cardinality
Definition: int.hh:229
Propagator for minimum element
Definition: int.hh:55
Boolean view for Boolean variables.
Definition: view.hpp:1349