40 namespace Gecode {
namespace Int {
namespace GCC {
70 k(k0), vvg(NULL), card_fixed(cf){
132 if (Card::propagate && (
k[idx].
max() == 0))
136 if (noa ==
y.
size()) {
138 for (
int i =
k.
size();
i--; ) {
139 if ((
k[
i].
min() > count[
i]) || (count[
i] >
k[
i].max()))
149 if (Card::propagate) {
158 if (!card_consistent<Card>(
y,
k))
163 for (
int j =
k.
size(); j--; )
164 if ((
k[j].
min() >
k[j].counter()) || (
k[j].max() <
k[j].counter()))
172 for (
int j =
k.
size(); j--; )
173 if ((
k[j].
min() >
k[j].counter()) || (
k[j].max() <
k[j].counter()))
182 if (
k[
i].counter() >
k[
i].max() ) {
185 smax += (
k[
i].max() -
k[
i].counter());
186 if (
k[
i].counter() <
k[
i].min())
187 smin += (
k[
i].
min() -
k[
i].counter());
202 vvg->template free_alternating_paths<UBC>();
203 vvg->template strongly_connected_components<UBC>();
211 vvg->template free_alternating_paths<LBC>();
212 vvg->template strongly_connected_components<LBC>();
218 bool card_assigned =
true;
219 if (Card::propagate) {
226 for (
int j=
k.
size(); j--; )
227 if ((
k[j].
min() >
k[j].counter()) ||
228 (
k[j].max() <
k[j].counter()))
237 for (
int j =
k.
size(); j--; )
238 if ((
k[j].
min() >
k[j].counter()) ||
239 (
k[j].max() <
k[j].counter()))
249 bool all_assigned =
true;
257 if (Card::propagate && (
k[idx].
max() == 0))
260 all_assigned =
false;
267 for (
int i =
k.
size();
i--; ) {
268 if ((
k[
i].
min() > count[
i]) || (count[
i] >
k[
i].max()))
277 if (Card::propagate) {
278 int ysmax =
y.
size();
282 bool card_ass =
true;
283 for (
int i =
k.
size();
i--; ) {
290 if (card_ass && (smax !=
y.
size()))
303 if (isDistinct<Card>(x,k))
307 for (
int i = k.
size();
i--; )
309 cardfix =
false;
break;
virtual Actor * copy(Space &home)
Copy propagator during cloning.
virtual void reschedule(Space &home)
Schedule function.
void reschedule(Space &home, Propagator &p, PropCond pc)
Re-schedule propagator p with propagation condition pc.
void update(Space &home, ViewArray< View > &a)
Update array to be a clone of array a.
ExecStatus ES_SUBSUMED(Propagator &p)
void count(Home home, const IntVarArgs &x, int n, IntRelType irt, int m, IntPropLevel)
Post propagator for .
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
bool card_fixed
Stores whether cardinalities are all assigned.
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.
void subscribe(Space &home, Propagator &p, PropCond pc, bool schedule=true)
Subscribe propagator p with propagation condition pc to variable.
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.
int p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
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.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
virtual size_t dispose(Space &home)
Destructor.
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p with propagation condition pc to all views.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Post propagator for SetVar SetOpType SetVar SetRelType r
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Post propagator for SetVar SetOpType SetVar y
static PropCost cubic(PropCost::Mod m, unsigned int n)
Cubic complexity for modifier m and size measure n.
Dom(Space &home, Dom< Card > &p)
Constructor for cloning p.
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.
bool assigned(void) const
Test if all variables are assigned.
ViewArray< IntView > y
Views used to channel information between x and k ( ).
Post propagator for SetVar x
Propagation has not computed fixpoint.
Variable-value-graph used during propagation.
Gecode toplevel namespace
int size(void) const
Return size of array (number of elements)
int ModEventDelta
Modification event deltas.
Home class for posting propagators
VarValGraph< Card > * vvg
Propagation is performed on a variable-value graph (used as cache)
ViewArray< IntView > x
Views on which to perform domain-propagation.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.