44 namespace Gecode {
namespace Int {
namespace GCC {
74 k(k0), vvg(NULL), card_fixed(cf){
84 :
Propagator(home, share, p), vvg(NULL), card_fixed(p.card_fixed) {
102 return new (home)
Dom<Card>(home, share, *
this);
117 for (
int i = k.
size();
i--; )
122 for (
int i = y.
size();
i--; )
129 if (Card::propagate && (k[idx].
max() == 0))
133 if (noa == y.size()) {
135 for (
int i = k.
size();
i--; ) {
136 if ((k[
i].
min() > count[
i]) || (count[
i] > k[
i].max()))
146 if (Card::propagate) {
148 for (
int i = k.
size();
i--; )
155 if (!card_consistent<Card>(y,k))
160 for (
int j = k.size(); j--; )
161 if ((k[j].
min() > k[j].counter()) || (k[j].max() < k[j].counter()))
164 }
else if ((
x.size() == 1) && (
x[0].
assigned())) {
169 for (
int j = k.size(); j--; )
170 if ((k[j].
min() > k[j].counter()) || (k[j].max() < k[j].counter()))
178 for (
int i=k.
size();
i--; )
179 if (k[
i].counter() > k[
i].max() ) {
182 smax += (k[
i].max() - k[
i].counter());
183 if (k[
i].counter() < k[
i].min())
184 smin += (k[
i].
min() - k[
i].counter());
187 if ((
x.size() < smin) || (smax <
x.size()))
199 vvg->template free_alternating_paths<UBC>(home);
200 vvg->template strongly_connected_components<UBC>(home);
208 vvg->template free_alternating_paths<LBC>(home);
209 vvg->template strongly_connected_components<LBC>(home);
215 bool card_assigned =
true;
216 if (Card::propagate) {
218 card_assigned = k.assigned();
223 for (
int j=k.size(); j--; )
224 if ((k[j].
min() > k[j].counter()) ||
225 (k[j].max() < k[j].counter()))
228 }
else if ((
x.size() == 1) &&
x[0].
assigned()) {
234 for (
int j = k.size(); j--; )
235 if ((k[j].
min() > k[j].counter()) ||
236 (k[j].max() < k[j].counter()))
243 for (
int i = k.
size();
i--; )
246 bool all_assigned =
true;
248 for (
int i = y.
size();
i--; )
254 if (Card::propagate && (k[idx].
max() == 0))
257 all_assigned =
false;
264 for (
int i = k.
size();
i--; ) {
265 if ((k[
i].
min() > count[
i]) || (count[
i] > k[
i].max()))
274 if (Card::propagate) {
275 int ysmax = y.size();
276 for (
int i=k.
size();
i--; )
279 bool card_ass =
true;
280 for (
int i = k.
size();
i--; ) {
287 if (card_ass && (smax != y.size()))
300 if (isDistinct<Card>(home, x, k))
304 for (
int i = k.
size();
i--; )
306 cardfix =
false;
break;
309 (void)
new (home)
Dom<Card>(home,
x,k,cardfix);
void update(Space &, bool share, ViewArray< View > &a)
Update array to be a clone of array a.
ExecStatus ES_SUBSUMED(Propagator &p)
int size(void) const
Return size of array (number of elements)
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
bool lookupValue(T &a, int v, int &i)
Return index of v in array a.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Base-class for propagators.
static ExecStatus post(Home home, ViewArray< View > &x)
Post propagator for views x.
ViewArray< Card > k
Array containing either fixed cardinalities or CardViews.
Propagation has computed fixpoint.
Base-class for both propagators and branchers.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
int p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
static ExecStatus post(Home home, ViewArray< IntView > &x, ViewArray< Card > &k)
Post propagator for views x and cardinalities k.
Domain consistent global cardinality propagator.
Execution has resulted in failure.
Dom(Space &home, bool share, Dom< Card > &p)
Constructor for cloning p.
void subscribe(Space &home, Propagator &p, PropCond pc, bool process=true)
Subscribe propagator p with propagation condition pc to variable.
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
virtual size_t dispose(Space &home)
Destructor.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
static PropCost cubic(PropCost::Mod m, unsigned int n)
Cubic complexity for modifier m and size measure n.
Node * x
Pointer to corresponding Boolean expression node.
void count(Home home, const IntVarArgs &x, int n, IntRelType irt, int m, IntConLevel)
Post propagator for .
virtual size_t dispose(Space &home)
Delete actor and return its size.
bool assigned(View x, int v)
Whether x is assigned to value v.
ViewArray< IntView > y
Views used to channel information between x and k ( ).
Propagation has not computed fixpoint.
Variable-value-graph used during propagation.
int size(void) const
Return size of array (number of elements)
Gecode toplevel namespace
int ModEventDelta
Modification event deltas.
Home class for posting propagators
ViewArray< IntView > x
Views on which to perform domain-propagation.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.