Go to the documentation of this file.
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);
123 int*
count =
r.alloc<
int>(k.size());
124 for (
int i = k.size();
i--; )
129 for (
int i =
y.size();
i--; )
136 if (Card::propagate && (k[idx].
max() == 0))
140 if (noa ==
y.size()) {
142 for (
int i = k.size();
i--; ) {
153 if (Card::propagate) {
155 for (
int i = k.size();
i--; )
162 if (!card_consistent<Card>(
y,k))
167 for (
int j = k.size(); j--; )
168 if ((k[j].
min() > k[j].counter()) || (k[j].
max() < k[j].counter()))
171 }
else if ((
x.size() == 1) && (
x[0].
assigned())) {
176 for (
int j = k.size(); j--; )
177 if ((k[j].
min() > k[j].counter()) || (k[j].
max() < k[j].counter()))
185 for (
int i=k.size();
i--; )
186 if (k[
i].counter() > k[
i].
max() ) {
189 smax += (k[
i].max() - k[
i].counter());
190 if (k[
i].counter() < k[
i].min())
191 smin += (k[
i].
min() - k[
i].counter());
194 if ((
x.size() < smin) || (smax <
x.size()))
206 vvg->template free_alternating_paths<UBC>(home);
207 vvg->template strongly_connected_components<UBC>(home);
215 vvg->template free_alternating_paths<LBC>(home);
216 vvg->template strongly_connected_components<LBC>(home);
222 bool card_assigned =
true;
223 if (Card::propagate) {
225 card_assigned = k.assigned();
230 for (
int j=k.size(); j--; )
231 if ((k[j].
min() > k[j].counter()) ||
232 (k[j].
max() < k[j].counter()))
235 }
else if ((
x.size() == 1) &&
x[0].
assigned()) {
241 for (
int j = k.size(); j--; )
242 if ((k[j].
min() > k[j].counter()) ||
243 (k[j].
max() < k[j].counter()))
250 for (
int i = k.size();
i--; )
253 bool all_assigned =
true;
255 for (
int i =
y.size();
i--; )
261 if (Card::propagate && (k[idx].
max() == 0))
264 all_assigned =
false;
271 for (
int i = k.size();
i--; ) {
281 if (Card::propagate) {
282 int ysmax =
y.size();
283 for (
int i=k.size();
i--; )
286 bool card_ass =
true;
287 for (
int i = k.size();
i--; ) {
294 if (card_ass && (smax !=
y.size()))
307 if (isDistinct<Card>(home,
x, k))
311 for (
int i = k.
size();
i--; )
313 cardfix =
false;
break;
316 (void)
new (home)
Dom<Card>(home,
x,k,cardfix);
Post propagator for SetVar x
ViewArray< IntView > y
Views used to channel information between x and k ( ).
Post propagator for SetVar SetOpType SetVar y
Dom(Space &home, bool share, Dom< Card > &p)
Constructor for cloning p.
Domain consistent global cardinality propagator.
void update(Space &, bool share, ViewArray< View > &a)
Update array to be a clone of array a.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void subscribe(Space &home, Propagator &p, PropCond pc, bool schedule=true)
Subscribe propagator p with propagation condition pc to variable.
ExecStatus ES_SUBSUMED(Propagator &p)
virtual void reschedule(Space &home)
Schedule function.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
static ExecStatus post(Home home, ViewArray< View > &x)
Post propagator for views x.
bool assigned(View x, int v)
Whether x is assigned to value v.
Gecode::IntArgs i(4, 1, 2, 3, 4)
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Base-class for both propagators and branchers.
bool lookupValue(T &a, int v, int &i)
Return index of v in array a.
bool assigned(void) const
Test whether view is assigned.
Gecode toplevel namespace
Base-class for propagators.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
static ExecStatus post(Home home, ViewArray< IntView > &x, ViewArray< Card > &k)
Post propagator for views x and cardinalities k.
Home class for posting propagators
static PropCost cubic(PropCost::Mod m, unsigned int n)
Cubic complexity for modifier m and size measure n.
Variable-value-graph used during propagation.
Post propagator for SetVar SetOpType SetVar SetRelType r
virtual size_t dispose(Space &home)
Destructor.
ViewArray< IntView > x
Views on which to perform domain-propagation.
void count(Home home, const IntVarArgs &x, int n, IntRelType irt, int m, IntPropLevel)
Post propagator for .
ViewArray< Card > k
Array containing either fixed cardinalities or CardViews.
@ ES_FIX
Propagation has computed fixpoint.
int size(void) const
Return size of array (number of elements)
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
virtual size_t dispose(Space &home)
Delete actor and return its size.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
@ ES_FAILED
Execution has resulted in failure.
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
int ModEventDelta
Modification event deltas.
@ ES_NOFIX
Propagation has not computed fixpoint.
@ ES_OK
Execution is okay.
int p
Number of positive literals for node type.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.