48 vs.update(home, p.
vs);
71 if (
x[i].assigned()) {
72 vs.add(home,
x[i].val());
83 dis =
r.alloc<
int>(n); n_dis = 0;
87 switch (
vs.compare(
x[i])) {
110 if (
vs.subset(
x[i])) {
121 for (
int i=
x.size(); i--; ) {
139 if (
y.max() ==
vs.size() + 1) {
142 for (
int i=n_dis; i--; )
151 for (
int i=
x.size(); i--; ) {
162 int* deg =
r.alloc<
int>(
x.size());
164 int** ovl_i =
r.alloc<
int*>(
x.size());
166 int* n_ovl_i =
r.alloc<
int>(
x.size());
170 for (
int i=
x.size(); i--; )
174 int* m =
r.alloc<
int>(n_dis*(n_dis-1));
175 for (
int i=n_dis; i--; ) {
177 ovl_i[dis[i]] = m; m += n_dis-1;
187 for (
int i=n_dis; i--; )
195 for (
int i=n_dis; i--; )
212 for (
int i=0;
true; i++)
218 int di = re[i].
view, dj = j.val();
219 if (!ovl.
get(di,dj)) {
221 ovl_i[di][deg[di]++] = dj;
222 ovl_i[dj][deg[dj]++] = di;
225 cur.
set(
static_cast<unsigned int>(re[i].view));
228 cur.
clear(
static_cast<unsigned int>(re[i].view));
240 for (
int i=n_dis; i--; ) {
241 assert(deg[dis[i]] < n_dis);
242 n_ovl_i[dis[i]] = deg[dis[i]];
246 int* ind =
r.alloc<
int>(n_dis);
251 int d_min = deg[dis[i_min]];
252 unsigned int s_min =
x[dis[i_min]].size();
255 for (
int i=n_dis-1; i--; )
256 if ((d_min > deg[dis[i]]) ||
257 ((d_min == deg[dis[i]]) && (s_min >
x[dis[i]].
size()))) {
260 s_min =
x[dis[i]].size();
264 ind[n_ind++] = dis[i_min]; dis[i_min] = dis[--n_dis];
267 for (
int i=n_dis; i--; )
268 if (ovl.
get(dis[i],ind[n_ind-1])) {
270 for (
int j=n_ovl_i[dis[i]]; j--; )
271 deg[ovl_i[dis[i]][j]]--;
273 dis[i] = dis[--n_dis];
280 if (
vs.size() + n_ind ==
y.max()) {
283 for (
int i=n_ind; i--; )
288 for (
int i=
x.size(); i--; ) {
306 if (
y.min() == g.
size()) {
308 if (
vs.size() +
x.size() == g.
size()) {
310 for (
int i=
x.size(); i--; ) {
Home class for posting propagators
static ExecStatus post(Home home, ViewArray< View > &x)
Post propagator for views x.
Integer view for integer variables.
View-value graph for propagation of upper bound.
void init(Space &home, const ValSet &vs, const ViewArray< IntView > &x)
Initialize graph including values in vs.
void sync(void)
Synchronize graph with new view domains.
ExecStatus prune(Space &home)
Prune all values corresponding to unused edges.
int size(void) const
Return size of maximal matching (excluding assigned views)
virtual size_t dispose(Space &home)
Delete propagator and return its size.
ValSet vs
Value set storing the values of already assigned views.
ExecStatus prune_lower(Space &home, int *dis, int n_dis)
void disjoint(Space &home, Region &r, int *&dis, int &n_dis)
virtual PropCost cost(const Space &, const ModEventDelta &) const
Cost function.
void add(Space &home)
Add values of assigned views to value set.
void eliminate(Space &home)
Eliminate subsumed views (all values included in the value set vs)
ExecStatus all_in_valset(Space &home)
Propagate that all views must take values from value set.
ExecStatus prune_upper(Space &home, Graph &g)
IntBase(Home home, ValSet &vs, ViewArray< IntView > &x, VY y)
Constructor for posting.
Event for range-based overlap analysis.
RangeEventType ret
The event type.
int view
Which view does this range belong to.
int val
The value for the range (first or last value, depending on type)
Symmetric diagonal bit matrix.
bool get(int x, int y) const
Is bit at position x, y set?
void set(int x, int y)
Set bit at position x, y.
Class for storing values of already assigned views.
Range iterator for integer views.
void purge(void)
Purge graph if necessary (reset information to avoid overflow)
Range iterator for intersection of iterators.
Range iterator for union of iterators.
void reset(void)
Reset iterator to start.
Value iterator for values in a bitset.
MixNaryOnePropagator(Space &home, MixNaryOnePropagator &p)
static PropCost quadratic(PropCost::Mod m, unsigned int n)
Quadratic complexity for modifier m and size measure n.
size_t size
The size of the propagator (used during subsumption)
void clear(unsigned int i)
Clear bit i.
void set(unsigned int i)
Set bit i.
ExecStatus ES_SUBSUMED(Propagator &p)
Propagator p is subsumed
int ModEventDelta
Modification event deltas.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
const int infinity
Infinity for integers.
Number of values propagators.
@ RET_END
No further events.
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
@ CS_NONE
Neither of the above.
@ CS_SUBSET
First is subset of second iterator.
@ CS_DISJOINT
Intersection is empty.
void quicksort(Type *l, Type *r, Less &less)
Standard quick sort.
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar SetRelType r
@ ES_OK
Execution is okay.
@ ES_FAILED
Execution has resulted in failure.
#define GECODE_NEVER
Assert that this command is never executed.