43 namespace Gecode {
namespace Int {
namespace GCC {
74 return new (home)
Val<Card>(home,share,*
this);
107 for (
int i = k.
size();
i--; ) {
108 removed += k[
i].counter();
109 sum_min += k[
i].min();
115 for (
int i = k.
size();
i--; )
121 for (
int i = x.
size();
i--; )
133 for (
int i = k.
size();
i--; )
147 for (
int i = k.
size();
i--; ) {
148 int ci = count[
i] + k[
i].counter();
164 if ((req == non) && (n_r == 1)) {
166 for (
int i = x.
size();
i--; ) {
170 assert((single >= 0) && (single < k.
size()));
174 assert((single >= 0) && (single < k.
size()));
176 for (
int i = k.
size();
i--; )
184 for (
int i = k.
size();
i--; ) {
185 int ci = count[
i] + k[
i].counter();
186 if (ci == k[
i].
max()) {
188 rem.
set(static_cast<unsigned int>(
i));
193 if (ci > k[
i].
max()) {
198 if (Card::propagate) {
200 int occupied = t_noa -
ci;
211 for (
int i = n_x;
i--; ) {
217 if (rem.
get(static_cast<unsigned int>(idx)))
227 int* pr = r.alloc<
int>(k.
size());
231 pr[n_pr++] = k[
i.val()].card();
233 for (
int i = x.
size();
i--;) {
240 bool all_assigned =
true;
242 for (
int i = x.
size();
i--; ) {
250 all_assigned =
false;
255 for (
int i = k.
size();
i--; )
261 if (Card::propagate) {
265 for (
int i = k.
size();
i--; ) {
266 if (k[
i].counter() > k[
i].max()) {
269 allmax += k[
i].max() - k[
i].counter();
270 if (k[
i].counter() < k[
i].
min())
271 reqmin += k[
i].min() - k[
i].counter();
275 if ((x.
size() < reqmin) || (allmax < x.
size())) {
286 return prop_val<Card>(home, *
this,
x,
k);
295 if (isDistinct<Card>(home,x,k))
bool get(unsigned int i) const
Access value at bit i.
ViewArray< Card > k
Array containing either fixed cardinalities or CardViews.
Value consistent global cardinality propagator.
void update(Space &, bool share, ViewArray< View > &a)
Update array to be a clone of array a.
void reschedule(Space &home, Propagator &p, PropCond pc)
Re-schedule propagator p with propagation condition pc.
static ExecStatus post(Home home, ViewArray< IntView > &x, ViewArray< Card > &k)
Post propagator for views x and cardinalities k.
static PropCost linear(PropCost::Mod m, unsigned int n)
Linear complexity for modifier pcm and size measure n.
ExecStatus ES_SUBSUMED(Propagator &p)
void count(Home home, const IntVarArgs &x, int n, IntRelType irt, int m, IntPropLevel)
Post propagator for .
Value iterator for array of integers
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 .
Val(Home home, ViewArray< IntView > &x, ViewArray< Card > &k)
Constructor for posting.
Base-class for propagators.
void subscribe(Space &home, Propagator &p, PropCond pc, bool schedule=true)
Subscribe propagator p with propagation condition pc to variable.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost funtion returning high linear.
const unsigned int card
Maximum cardinality of an integer set.
Base-class for both propagators and branchers.
Value iterator for values in a bitset.
ViewArray< IntView > x
Views on which to perform value-propagation.
#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.
virtual size_t dispose(Space &home)
Destructor.
Gecode::IntArgs i(4, 1, 2, 3, 4)
void quicksort(Type *l, Type *r, Less &less)
Standard quick sort.
Execution has resulted in failure.
ExecStatus prop_val(Space &home, Propagator &p, ViewArray< IntView > &x, ViewArray< Card > &k)
virtual void reschedule(Space &home)
Schedule function.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
void set(unsigned int i)
Set bit i.
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.
static ExecStatus post(Home home, ViewArray< View > &x)
Post propagator for view array x.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Node * x
Pointer to corresponding Boolean expression node.
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.
Propagation has not computed fixpoint.
Gecode toplevel namespace
int size(void) const
Return size of array (number of elements)
int ModEventDelta
Modification event deltas.
Home class for posting propagators
const Gecode::PropCond PC_INT_VAL
Propagate when a view becomes assigned (single value)