Generated on Tue Jul 18 2017 18:41:42 for Gecode by doxygen 1.8.13
gcc.hh
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Patrick Pekczynski <pekczynski@ps.uni-sb.de>
5  *
6  * Contributing authors:
7  * Christian Schulte <schulte@gecode.org>
8  * Guido Tack <tack@gecode.org>
9  *
10  * Copyright:
11  * Patrick Pekczynski, 2004/2005
12  * Christian Schulte, 2009
13  * Guido Tack, 2009
14  *
15  * Last modified:
16  * $Date: 2016-06-29 17:28:17 +0200 (Wed, 29 Jun 2016) $ by $Author: schulte $
17  * $Revision: 15137 $
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_GCC_HH__
45 #define __GECODE_INT_GCC_HH__
46 
47 #include <gecode/int.hh>
48 
54 #include <gecode/int/gcc/view.hpp>
57 
58 namespace Gecode { namespace Int { namespace GCC {
59 
66  template<class Card>
67  class Val : public Propagator {
68  protected:
76  Val(Space& home, bool share, Val<Card>& p);
77  public:
79  virtual Actor* copy(Space& home, bool share);
81  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
83  virtual void reschedule(Space& home);
85  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
87  virtual size_t dispose(Space& home);
89  static ExecStatus post(Home home,
91  };
92 
116  template<class Card>
117  class Bnd : public Propagator {
118  protected:
145  bool skip_lbc;
147  Bnd(Space& home, bool share, Bnd<Card>& p);
148 
150  ExecStatus pruneCards(Space& home);
151 
170  ExecStatus lbc(Space& home, int& nb, HallInfo hall[], Rank rank[],
171  int mu[], int nu[]);
172 
191  ExecStatus ubc(Space& home, int& nb, HallInfo hall[], Rank rank[],
192  int mu[], int nu[]);
194  Bnd(Home home, ViewArray<IntView>&, ViewArray<Card>&, bool, bool);
195  public:
197  virtual Actor* copy(Space& home, bool share);
199  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
201  virtual void reschedule(Space& home);
203  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
205  virtual size_t dispose(Space& home);
207  static ExecStatus post(Home home,
209  };
210 
222  template<class Card>
223  class Dom : public Propagator {
224  protected:
244  Dom(Space& home, bool share, Dom<Card>& p);
246  Dom(Home home, ViewArray<IntView>&, ViewArray<Card>&, bool);
247  public:
249  virtual Actor* copy(Space& home, bool share);
251  virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
253  virtual void reschedule(Space& home);
255  virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
257  virtual size_t dispose(Space& home);
259  static ExecStatus post(Home home,
261  };
262 
263 }}}
264 
265 #include <gecode/int/gcc/post.hpp>
266 #include <gecode/int/gcc/val.hpp>
267 #include <gecode/int/gcc/bnd.hpp>
268 #include <gecode/int/gcc/dom.hpp>
269 
270 #endif
271 
272 
273 // STATISTICS: int-prop
274 
ViewArray< Card > k
Array containing either fixed cardinalities or CardViews.
Definition: gcc.hh:72
Value consistent global cardinality propagator.
Definition: gcc.hh:67
Container class provding information about the Hall structure of the problem variables.
Definition: bnd-sup.hpp:460
static ExecStatus post(Home home, ViewArray< IntView > &x, ViewArray< Card > &k)
Post propagator for views x and cardinalities k.
Definition: val.hpp:291
bool card_fixed
Stores whether cardinalities are all assigned.
Definition: gcc.hh:242
ViewArray< Card > k
Array containing either fixed cardinalities or CardViews.
Definition: gcc.hh:124
Val(Home home, ViewArray< IntView > &x, ViewArray< Card > &k)
Constructor for posting.
Definition: val.hpp:47
Base-class for propagators.
Definition: core.hpp:1092
PartialSum< Card > lps
Data structure storing the sum of the views lower bounds Necessary for reasoning about the interval c...
Definition: gcc.hh:130
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost funtion returning high linear.
Definition: val.hpp:79
ViewArray< Card > k
Array containing either fixed cardinalities or CardViews.
Definition: gcc.hh:233
Computation spaces.
Definition: core.hpp:1748
Base-class for both propagators and branchers.
Definition: core.hpp:696
ViewArray< IntView > x
Views on which to perform value-propagation.
Definition: gcc.hh:70
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
virtual size_t dispose(Space &home)
Destructor.
Definition: val.hpp:64
PartialSum< Card > ups
Data structure storing the sum of the views upper bounds.
Definition: gcc.hh:132
Domain consistent global cardinality propagator.
Definition: gcc.hh:223
ModEventDelta med
A set of modification events (used during propagation)
Definition: core.hpp:1103
virtual void reschedule(Space &home)
Schedule function.
Definition: val.hpp:89
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: val.hpp:285
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Definition: val.hpp:73
Maps domain bounds to their position in hall[].bounds.
Definition: bnd-sup.hpp:158
Propagation cost.
Definition: core.hpp:554
ExecStatus
Definition: core.hpp:540
ViewArray< IntView > y
Views used to channel information between x and k ( ).
Definition: gcc.hh:231
Partial sum structure for constant time computation of the maximal capacity of an interval...
Definition: bnd-sup.hpp:241
Variable-value-graph used during propagation.
Definition: dom-sup.hpp:391
ViewArray< IntView > y
Views on which to perform value-propagation (subset of x)
Definition: gcc.hh:122
Gecode toplevel namespace
ViewArray< IntView > x
Views on which to perform bounds-propagation.
Definition: gcc.hh:120
bool skip_lbc
Stores whether the minium required occurences of the cardinalities are all zero. If so...
Definition: gcc.hh:145
int ModEventDelta
Modification event deltas.
Definition: core.hpp:169
Home class for posting propagators
Definition: core.hpp:922
Bounds consistent global cardinality propagator.
Definition: gcc.hh:117
VarValGraph< Card > * vvg
Propagation is performed on a variable-value graph (used as cache)
Definition: gcc.hh:235
bool card_fixed
Stores whether cardinalities are all assigned.
Definition: gcc.hh:139
ViewArray< IntView > x
Views on which to perform domain-propagation.
Definition: gcc.hh:226