Generated on for Gecode by doxygen 1.18.0
prop.hpp
Go to the documentation of this file.
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Mikael Zayenz Lagerkvist <lagerkvist@gecode.dev>
5 *
6 * Copyright:
7 * Mikael Zayenz Lagerkvist, 2026
8 *
9 * This file is part of Gecode, the generic constraint
10 * development environment:
11 * http://www.gecode.dev
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining
14 * a copy of this software and associated documentation files (the
15 * "Software"), to deal in the Software without restriction, including
16 * without limitation the rights to use, copy, modify, merge, publish,
17 * distribute, sublicense, and/or sell copies of the Software, and to
18 * permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be
22 * included in all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 *
32 */
33
34namespace Gecode { namespace Int { namespace MinDistance {
35
36
38 forceinline int
39 requirement(const IntSharedArray& r, int n, int i, int j) {
40 return !r ? 0 : r[i*n+j];
41 }
42
44 inline ExecStatus
45 forward(Space& home, IntView a, IntView b, int threshold,
46 const IntDistance& d, bool& changed) {
47 Region region;
48 int* remove = region.alloc<int>(b.size());
49 int nr = 0;
50 for (ViewValues<IntView> v(b); v(); ++v)
51 if (d(a.val(),v.val()) < threshold)
52 remove[nr++] = v.val();
53 if (nr != 0) {
54 Iter::Values::Array values(remove,static_cast<unsigned int>(nr));
55 ModEvent me = b.minus_v(home,values,false);
57 changed |= me_modified(me);
58 }
59 return ES_OK;
60 }
61
63 inline void
65 c.upper = -1;
66 for (ViewValues<IntView> a(x); a(); ++a)
67 for (ViewValues<IntView> b(y); b(); ++b) {
68 int v = d(a.val(),b.val());
69 if (v > c.upper) {
70 c.a = a.val(); c.b = b.val(); c.upper = v;
71 }
72 }
73 }
74
76 inline ExecStatus
78 const IntDistance& d, const IntSharedArray& r) {
79 int minimum = Limits::max;
80 for (int i=0; i<x.size(); i++)
81 for (int j=i+1; j<x.size(); j++) {
82 int v = d(x[i].val(),x[j].val());
83 if (v < requirement(r,x.size(),i,j))
84 return ES_FAILED;
85 minimum = std::min(minimum,v);
86 }
87 GECODE_ME_CHECK(z.eq(home,minimum));
88 return ES_OK;
89 }
90
92 inline ExecStatus
93 zero(Space& home, const ViewArray<IntView>& x, const IntDistance& d,
94 const IntSharedArray& r, bool& changed, bool& realized) {
95 int count = 0;
96 int first = -1;
97 int second = -1;
98 for (int i=0; i<x.size(); i++)
99 for (int j=i+1; j<x.size(); j++) {
100 if (requirement(r,x.size(),i,j) != 0)
101 continue;
102 if (x[i].assigned() && x[j].assigned() &&
103 (d(x[i].val(),x[j].val()) == 0)) {
104 realized = true;
105 return ES_OK;
106 }
107 bool supported = false;
108 for (ViewValues<IntView> a(x[i]); a() && !supported; ++a)
109 for (ViewValues<IntView> b(x[j]); b(); ++b)
110 if (d(a.val(),b.val()) == 0) {
111 supported = true;
112 break;
113 }
114 if (supported) {
115 first = i; second = j; count++;
116 }
117 }
118 if (count == 0)
119 return ES_FAILED;
120 if (count == 1) {
121 // Only this pair can attain zero, so both endpoints need zero support.
122 Region region;
123 for (int pass=0; pass<2; pass++) {
124 IntView a = x[pass == 0 ? first : second];
125 IntView b = x[pass == 0 ? second : first];
126 int* remove = region.alloc<int>(a.size());
127 int nr = 0;
128 for (ViewValues<IntView> v(a); v(); ++v) {
129 bool supported = false;
130 for (ViewValues<IntView> w(b); w(); ++w)
131 if (d(v.val(),w.val()) == 0) {
132 supported = true;
133 break;
134 }
135 if (!supported)
136 remove[nr++] = v.val();
137 }
138 if (nr != 0) {
139 Iter::Values::Array values(remove,static_cast<unsigned int>(nr));
140 ModEvent me = a.minus_v(home,values,false);
141 GECODE_ME_CHECK(me);
142 changed |= me_modified(me);
143 }
144 }
145 }
146 return ES_OK;
147 }
148
149 forceinline
151 const IntDistance& d0, int r0)
153 IntView,PC_INT_BND>(home,x0,y0,z0),
154 d(d0), r(r0) {
155 home.notice(*this,AP_DISPOSE);
156 }
157
158 forceinline
163
164 inline ExecStatus
166 const IntDistance& d, int r) {
167 if (x0.assigned() && x1.assigned()) {
168 int v = d(x0.val(),x1.val());
169 if (v < r)
170 return ES_FAILED;
171 GECODE_ME_CHECK(x2.lq(home,v));
172 } else {
173 (void) new (home) Pair(home,x0,x1,x2,d,r);
174 }
175 return ES_OK;
176 }
177
178 inline Actor*
180 return new (home) Pair(home,*this);
181 }
182
183 inline PropCost
184 Pair::cost(const Space&, const ModEventDelta&) const {
186 }
187
188 inline ExecStatus
190 int threshold = std::max(r,x2.min());
191 if (x0.assigned() && x1.assigned()) {
192 int v = d(x0.val(),x1.val());
193 if (v < threshold)
194 return ES_FAILED;
195 GECODE_ME_CHECK(x2.lq(home,v));
196 return home.ES_SUBSUMED(*this);
197 }
198 bool changed = false;
199 if (x0.assigned()) {
200 GECODE_ES_CHECK(forward(home,x0,x1,threshold,d,changed));
201 } else if (x1.assigned()) {
202 GECODE_ES_CHECK(forward(home,x1,x0,threshold,d,changed));
203 }
204 PairCache c;
205 pair_max(x0,x1,d,c);
206 if (c.upper < threshold)
207 return ES_FAILED;
208 ModEvent me = x2.lq(home,c.upper);
209 GECODE_ME_CHECK(me);
210 return (changed || me_modified(me) || (x2.min() > threshold)) ? ES_NOFIX : ES_FIX;
211 }
212
213 inline size_t
215 home.ignore(*this,AP_DISPOSE);
216 d.~IntDistance();
219 return sizeof(*this);
220 }
221
222 forceinline
224 const IntDistance& d0, const IntSharedArray& r0)
226 d(d0), r(r0) {
227 home.notice(*this,AP_DISPOSE);
228 }
229
230 forceinline
234
235 inline ExecStatus
237 const IntDistance& d, const IntSharedArray& r) {
238 (void) new (home) Finalize(home,x,z,d,r);
239 return ES_OK;
240 }
241
242 inline Actor*
244 return new (home) Finalize(home,*this);
245 }
246
247 inline PropCost
248 Finalize::cost(const Space&, const ModEventDelta&) const {
250 }
251
252 inline ExecStatus
254 if (x.assigned()) {
255 GECODE_ES_CHECK(assigned(home,x,y,d,r));
256 return home.ES_SUBSUMED(*this);
257 }
258 if (y.max() != 0)
259 return ES_FIX;
260 bool changed = false;
261 bool realized = false;
262 GECODE_ES_CHECK(zero(home,x,d,r,changed,realized));
263 if (realized)
264 return home.ES_SUBSUMED(*this);
265 return changed ? ES_NOFIX : ES_FIX;
266 }
267
268 inline size_t
270 home.ignore(*this,AP_DISPOSE);
271 d.~IntDistance(); r.~IntSharedArray();
273 return sizeof(*this);
274 }
275
276 forceinline
278 Council<XAdvisor>& c, int i)
279 : Advisor(home,p,c), index(i) {}
280
281 forceinline
284
285 forceinline
287 const IntDistance& d0, const IntSharedArray& r0)
288 : Propagator(home), x(x0), z(z0), d(d0), r(r0), council(home),
289 dirty(static_cast<Space&>(home),static_cast<unsigned int>(x.size()),true),
290 last_min(-1), z_shared(false) {
291 home.notice(*this,AP_DISPOSE);
292 Space& s = home;
293 int np = static_cast<int>(static_cast<long long int>(x.size())*(x.size()-1)/2);
294 cache = s.alloc<PairCache>(np);
295 for (int i=0; i<np; i++)
296 cache[i] = {-1,-1,-1};
297 for (int i=0; i<x.size(); i++) {
298 z_shared |= shared(x[i],z);
299 x[i].subscribe(home,*new (home) XAdvisor(home,*this,council,i));
300 }
301 z.subscribe(home,*this,PC_INT_BND);
302 }
303
304 forceinline
306 : Propagator(home,p), d(p.d), r(p.r), council(home),
307 dirty(home,p.dirty), last_min(p.last_min), z_shared(p.z_shared) {
308 x.update(home,p.x); z.update(home,p.z); council.update(home,p.council);
309 int np = static_cast<int>(static_cast<long long int>(x.size())*(x.size()-1)/2);
310 cache = home.alloc<PairCache>(np);
311 std::copy(p.cache,p.cache+np,cache);
312 }
313
314 inline ExecStatus
316 const IntDistance& d, const IntSharedArray& r) {
317 (void) new (home) AdvisorForward(home,x,z,d,r);
318 return ES_OK;
319 }
320
321 inline Actor*
323 return new (home) AdvisorForward(home,*this);
324 }
325
326 inline PropCost
329 static_cast<unsigned int>(x.size())+d.size());
330 }
331
332 forceinline void
334 z.reschedule(home,*this,PC_INT_BND);
335 // Advisors have no reschedule method; ensure a manual reschedule also
336 // revisits every pair, even if no new domain event has been delivered.
337 last_min = -1;
338 }
339
340 inline ExecStatus
342 dirty.set(static_cast<XAdvisor&>(a).index);
343 return ES_NOFIX;
344 }
345
346 inline ExecStatus
348 for (;;) {
349 if (x.assigned()) {
350 GECODE_ES_CHECK(assigned(home,x,z,d,r));
351 return home.ES_SUBSUMED(*this);
352 }
353 int zmin = z.min();
354 bool all_dirty = zmin != last_min;
355 bool changed = false;
356 for (int i=0; i<x.size(); i++)
357 for (int j=i+1; j<x.size(); j++) {
358 if (!(all_dirty || dirty.get(i) || dirty.get(j)))
359 continue;
360 int t = std::max(zmin,requirement(r,x.size(),i,j));
361 if (x[i].assigned() && !x[j].assigned()) {
362 GECODE_ES_CHECK(forward(home,x[i],x[j],t,d,changed));
363 } else if (x[j].assigned() && !x[i].assigned()) {
364 GECODE_ES_CHECK(forward(home,x[j],x[i],t,d,changed));
365 }
366 }
367 if (z.assigned() && (z.val() == 0)) {
368 bool realized = false;
369 GECODE_ES_CHECK(zero(home,x,d,r,changed,realized));
370 }
371 int upper = Limits::max;
372 int k = 0;
373 for (int i=0; i<x.size(); i++)
374 for (int j=i+1; j<x.size(); j++,k++) {
375 PairCache& c = cache[k];
376 if (all_dirty || changed || dirty.get(i) || dirty.get(j)) {
377 // Unchanged pairs retain their witnesses. For a changed pair,
378 // a surviving witness still attains the maximum; shrinking
379 // domains cannot expose a larger distance.
380 if ((c.upper < 0) || !x[i].in(c.a) || !x[j].in(c.b))
381 pair_max(x[i],x[j],d,c);
382 if (c.upper < requirement(r,x.size(),i,j))
383 return ES_FAILED;
384 }
385 upper = std::min(upper,c.upper);
386 }
387 ModEvent me = z.lq(home,upper);
388 GECODE_ME_CHECK(me);
389 if (x.assigned()) {
390 GECODE_ES_CHECK(assigned(home,x,z,d,r));
391 return home.ES_SUBSUMED(*this);
392 }
393 if (changed || (z.min() != zmin) ||
394 (me_modified(me) && (z_shared || (z.max() == 0)))) {
395 // Own pruning can affect a pair already visited in this pass.
396 // Restart all assigned-endpoint work; valid maxima remain cached.
397 last_min = -1;
398 continue;
399 }
400 dirty.clearall();
401 last_min = z.min();
402 return ES_FIX;
403 }
404 }
405
406 inline size_t
408 home.ignore(*this,AP_DISPOSE);
409 for (Advisors<XAdvisor> a(council); a(); ++a)
410 x[a.advisor().index].cancel(home,a.advisor());
411 council.dispose(home);
412 z.cancel(home,*this,PC_INT_BND);
413 int np = static_cast<int>(
414 static_cast<long long int>(x.size())*(x.size()-1)/2);
415 home.free<PairCache>(cache,np);
416 dirty.dispose(home);
417 d.~IntDistance(); r.~IntSharedArray();
418 (void) Propagator::dispose(home);
419 return sizeof(*this);
420 }
421
422 forceinline
424 const IntDistance& d0)
426 home.notice(*this,AP_DISPOSE);
427 home.notice(*this,AP_WEAKLY);
428 }
429
430 forceinline
433
434 inline bool
435 Matching::refuted(int* sites, int n, bool* matched, int threshold) const {
436 if (threshold == 0)
437 return false; // Repeated sites are permitted at distance zero.
438 std::fill(matched,matched+n,false);
439 int edges = 0;
440 for (int a=0; a<n; a++) {
441 if (matched[a])
442 continue;
443 for (int b=a+1; b<n; b++)
444 if (!matched[b] && (d(sites[a],sites[b]) < threshold)) {
445 matched[a] = matched[b] = true;
446 edges++;
447 break;
448 }
449 }
450 return n-edges < x.size();
451 }
452
453 inline ExecStatus
455 const IntDistance& d) {
456 if (!z.assigned())
457 (void) new (home) Matching(home,x,z,d);
458 return ES_OK;
459 }
460
461 inline Actor*
463 return new (home) Matching(home,*this);
464 }
465
466 inline PropCost
467 Matching::cost(const Space&, const ModEventDelta&) const {
469 }
470
471 inline ExecStatus
473 if (y.assigned())
474 return home.ES_SUBSUMED(*this);
475 Region region;
476 bool* present = region.alloc<bool>(d.size());
477 std::fill(present,present+d.size(),false);
478 for (int i=0; i<x.size(); i++)
479 for (ViewValues<IntView> v(x[i]); v(); ++v)
480 present[v.val()] = true;
481 int* sites = region.alloc<int>(d.size());
482 int n = 0;
483 for (int i=0; i<d.size(); i++)
484 if (present[i])
485 sites[n++] = i;
486 bool* matched = region.alloc<bool>(n);
487 int lo = y.min();
488 int hi = y.max();
489 if (refuted(sites,n,matched,lo))
490 return ES_FAILED;
491 // A failed certificate at t excludes every objective >= t. Greedy
492 // certificate sizes themselves need not be monotone, so this search
493 // can miss tighter bounds but cannot delete a feasible objective.
494 while (lo < hi) {
495 int mid = lo+(hi-lo+1)/2;
496 if (refuted(sites,n,matched,mid))
497 hi = mid-1;
498 else
499 lo = mid;
500 }
501 ModEvent me = y.lq(home,hi);
502 GECODE_ME_CHECK(me);
503 if (y.assigned())
504 return home.ES_SUBSUMED(*this);
505 return me_modified(me) ? ES_NOFIX : ES_FIX;
506 }
507
508 inline size_t
510 home.ignore(*this,AP_DISPOSE);
511 home.ignore(*this,AP_WEAKLY);
512 d.~IntDistance();
514 return sizeof(*this);
515 }
516
517}}}
518
519// STATISTICS: int-prop
Base-class for both propagators and branchers.
Definition core.hpp:635
virtual size_t dispose(Space &home)
Delete actor and return its size.
Definition core.hpp:3430
Advisor(Space &home, Propagator &p, Council< A > &c)
Constructor for creation.
Definition core.hpp:4060
friend class Council
Definition core.hpp:1310
Class to iterate over advisors of a council.
Definition core.hpp:1282
Generic domain change information to be supplied to advisors.
Definition core.hpp:209
Home class for posting propagators
Definition core.hpp:863
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
Definition core.hpp:3373
Shared distances between indexed sites.
Definition int.hh:3356
int size(void) const
Number of sites.
Integer view for integer variables.
Definition view.hpp:129
unsigned int size(void) const
Return size (cardinality) of domain.
Definition int.hpp:81
int min(void) const
Return minimum of domain.
Definition int.hpp:58
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition int.hpp:121
ModEvent minus_v(Space &home, I &i, bool depends=true)
Remove from domain the values described by i.
Definition int.hpp:206
int val(void) const
Return assigned value (only if assigned).
Definition int.hpp:70
int max(void) const
Return maximum of domain.
Definition int.hpp:62
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
Definition int.hpp:166
Domain advisor for a selected position.
XAdvisor(Space &home, Propagator &p, Council< XAdvisor > &c, int i)
Constructor for creation.
Definition prop.hpp:277
IntSharedArray r
Shared pair requirements.
Council< XAdvisor > council
Domain advisors.
Support::BitSetBase dirty
Positions changed since the last fixpoint.
AdvisorForward(Home home, ViewArray< IntView > &x0, IntView z0, const IntDistance &d0, const IntSharedArray &r0)
Constructor for posting.
Definition prop.hpp:286
int last_min
Objective lower bound at the last fixpoint.
virtual ExecStatus advise(Space &, Advisor &a, const Delta &)
Record a changed selected-site domain.
Definition prop.hpp:341
static ExecStatus post(Home home, ViewArray< IntView > &x, IntView z, const IntDistance &d, const IntSharedArray &r)
Post propagator.
Definition prop.hpp:315
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition prop.hpp:322
ViewArray< IntView > x
Selected sites.
bool z_shared
Whether the objective shares a selected-site variable.
virtual size_t dispose(Space &home)
Cancel subscriptions and dispose stored data.
Definition prop.hpp:407
PairCache * cache
Pair maxima and witnesses.
virtual PropCost cost(const Space &, const ModEventDelta &) const
Cost function.
Definition prop.hpp:327
virtual void reschedule(Space &home)
Reschedule propagation.
Definition prop.hpp:333
virtual ExecStatus propagate(Space &home, const ModEventDelta &)
Perform propagation.
Definition prop.hpp:347
static ExecStatus post(Home home, ViewArray< IntView > &x, IntView z, const IntDistance &d, const IntSharedArray &r)
Post propagator.
Definition prop.hpp:236
virtual ExecStatus propagate(Space &home, const ModEventDelta &)
Perform propagation.
Definition prop.hpp:253
IntSharedArray r
Shared pair requirements.
virtual size_t dispose(Space &home)
Cancel subscriptions and dispose shared data.
Definition prop.hpp:269
virtual PropCost cost(const Space &, const ModEventDelta &) const
Cost function.
Definition prop.hpp:248
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition prop.hpp:243
Finalize(Home home, ViewArray< IntView > &x, IntView z, const IntDistance &d0, const IntSharedArray &r0)
Constructor for posting.
Definition prop.hpp:223
IntDistance d
Shared distances.
virtual size_t dispose(Space &home)
Cancel subscriptions and dispose shared data.
Definition prop.hpp:509
IntDistance d
Shared distances.
virtual PropCost cost(const Space &, const ModEventDelta &) const
Cost function.
Definition prop.hpp:467
bool refuted(int *sites, int n, bool *matched, int threshold) const
Whether a greedy conflict matching refutes the threshold.
Definition prop.hpp:435
Matching(Home home, ViewArray< IntView > &x, IntView z, const IntDistance &d0)
Constructor for posting.
Definition prop.hpp:423
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition prop.hpp:462
virtual ExecStatus propagate(Space &home, const ModEventDelta &)
Perform propagation.
Definition prop.hpp:472
static ExecStatus post(Home home, ViewArray< IntView > &x, IntView z, const IntDistance &d)
Post propagator.
Definition prop.hpp:454
IntDistance d
Shared distances.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition prop.hpp:179
virtual PropCost cost(const Space &, const ModEventDelta &) const
Cost function.
Definition prop.hpp:184
virtual ExecStatus propagate(Space &home, const ModEventDelta &)
Perform propagation.
Definition prop.hpp:189
static ExecStatus post(Home home, IntView x0, IntView x1, IntView x2, const IntDistance &d, int r)
Post propagator.
Definition prop.hpp:165
virtual size_t dispose(Space &home)
Cancel subscriptions and dispose shared data.
Definition prop.hpp:214
Pair(Home home, IntView x0, IntView y0, IntView z0, const IntDistance &d0, int r0)
Constructor for posting.
Definition prop.hpp:150
int r
Inclusive pair requirement.
Value iterator for integer views.
Definition view.hpp:94
Value iterator for array of integers
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Definition pattern.hpp:766
Propagation cost.
Definition core.hpp:493
static PropCost quadratic(PropCost::Mod m, unsigned int n)
Quadratic complexity for modifier m and size measure n.
Definition core.hpp:5071
static PropCost cubic(PropCost::Mod m, unsigned int n)
Cubic complexity for modifier m and size measure n.
Definition core.hpp:5062
@ HI
Expensive.
Definition core.hpp:521
friend class Space
Definition core.hpp:1075
friend class Advisor
Definition core.hpp:1077
Propagator(Home home)
Constructor for posting.
Definition core.hpp:3707
Handle to region.
Definition region.hpp:55
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
Definition region.hpp:386
Computation spaces.
Definition core.hpp:1787
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
Definition core.hpp:2973
void free(T *b, long unsigned int n)
Delete n objects allocated from space heap starting at b.
Definition core.hpp:2999
void dispose(A &a)
Dispose memory for bit set.
bool get(unsigned int i) const
Access value at bit i.
void clearall(bool setbits=false)
Clear sz bits.
void set(unsigned int i)
Set bit i.
void update(Space &home, VarImpView< Var > &y)
Update this view to be a clone of view y.
Definition view.hpp:567
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p with propagation condition pc to view.
Definition view.hpp:527
void reschedule(Space &home, Propagator &p, PropCond pc)
Re-schedule propagator p with propagation condition pc.
Definition view.hpp:532
bool assigned(void) const
Test whether view is assigned.
Definition view.hpp:516
void subscribe(Space &home, Propagator &p, PropCond pc, bool schedule=true)
Subscribe propagator p with propagation condition pc to view.
Definition view.hpp:521
View arrays.
Definition array.hpp:255
void update(Space &home, ViewArray< View > &a)
Update array to be a clone of array a.
Definition array.hpp:1337
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p with propagation condition pc to all views.
Definition array.hpp:1358
void subscribe(Space &home, Propagator &p, PropCond pc, bool schedule=true)
Subscribe propagator p with propagation condition pc to variable.
Definition array.hpp:1350
bool assigned(void) const
Test if all variables are assigned.
Definition array.hpp:1386
int size(void) const
Return size of array (number of elements).
Definition array.hpp:1165
ExecStatus ES_SUBSUMED(Propagator &p)
Propagator p is subsumed
Definition core.hpp:3780
void ignore(Actor &a, ActorProperty p, bool duplicate=false)
Ignore actor property.
Definition core.hpp:4321
int ModEventDelta
Modification event deltas.
Definition core.hpp:94
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Definition macros.hpp:52
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
Definition macros.hpp:91
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
Definition modevent.hpp:59
@ AP_DISPOSE
Actor must always be disposed.
Definition core.hpp:569
@ AP_WEAKLY
Definition core.hpp:575
const int max
Largest allowed integer value.
Definition int.hh:121
Minimum-distance propagators over indexed sites.
ExecStatus assigned(Space &home, const ViewArray< IntView > &x, IntView z, const IntDistance &d, const IntSharedArray &r)
Validate and bind a complete assignment.
Definition prop.hpp:77
ExecStatus forward(Space &home, IntView a, IntView b, int threshold, const IntDistance &d, bool &changed)
Prune the partner of an assigned endpoint.
Definition prop.hpp:45
void pair_max(IntView x, IntView y, const IntDistance &d, PairCache &c)
Recompute the maximum distance between current domains.
Definition prop.hpp:64
ExecStatus zero(Space &home, const ViewArray< IntView > &x, const IntDistance &d, const IntSharedArray &r, bool &changed, bool &realized)
Enforce an actual zero-distance witness when the objective is zero.
Definition prop.hpp:93
int requirement(const IntSharedArray &r, int n, int i, int j)
Inclusive requirement, with an empty matrix denoting all zeroes.
Definition prop.hpp:39
Finite domain integers.
Definition lastval.hh:52
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
Definition var-type.hpp:99
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
Definition var-type.hpp:108
Gecode toplevel namespace
void count(Home home, const IntVarArgs &x, int n, IntRelType irt, int m, IntPropLevel ipl=IPL_DEF)
Post propagator for .
SharedArray< int > IntSharedArray
Arrays of integers that can be shared among several element constraints.
Definition int.hh:1813
void values(Home home, const IntVarArgs &x, IntSet y, IntPropLevel ipl=IPL_DEF)
Post constraint .
Definition aliases.hpp:143
ExecStatus
Definition core.hpp:479
@ ES_OK
Execution is okay.
Definition core.hpp:483
@ ES_FIX
Propagation has computed fixpoint.
Definition core.hpp:484
@ ES_FAILED
Execution has resulted in failure.
Definition core.hpp:481
@ ES_NOFIX
Propagation has not computed fixpoint.
Definition core.hpp:482
bool shared(ViewArray< ViewX > x, ViewArray< ViewY > y)
Definition array.hpp:1464
int ModEvent
Type for modification events.
Definition core.hpp:67
Pair maximum and its witness.
int b
Site at the second endpoint.
int a
Site at the first endpoint.
int upper
Maximum distance between the endpoint domains.