MCPcopy Create free account
hub / github.com/Gecode/gecode / post

Method post

gecode/int/nvalues/int-lq.hpp:47–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46 template<class VY>
47 inline ExecStatus
48 LqInt<VY>::post(Home home, ViewArray<IntView>& x, VY y) {
49 if (x.size() == 0) {
50 GECODE_ME_CHECK(y.eq(home,0));
51 return ES_OK;
52 }
53
54 x.unique();
55
56 GECODE_ME_CHECK(y.gq(home,1));
57
58 if (x.size() == 1)
59 return ES_OK;
60
61 if (y.max() == 1) {
62 assert(y.assigned());
63 return Rel::NaryEqDom<IntView>::post(home,x);
64 }
65
66 if (y.min() >= x.size())
67 return ES_OK;
68
69 // Eliminate assigned views and store them into the value set
70 ValSet vs;
71 int n = x.size();
72 for (int i=n; i--; )
73 if (x[i].assigned()) {
74 vs.add(home, x[i].val());
75 x[i] = x[--n];
76 }
77
78 GECODE_ME_CHECK(y.gq(home,vs.size()));
79
80 if (n == 0) {
81 assert(y.min() >= vs.size());
82 return ES_OK;
83 }
84
85 x.size(n);
86
87 (void) new (home) LqInt<VY>(home, vs, x, y);
88 return ES_OK;
89 }
90
91 template<class VY>
92 forceinline

Callers

nothing calls this directly

Calls 10

postFunction · 0.50
sizeMethod · 0.45
eqMethod · 0.45
uniqueMethod · 0.45
gqMethod · 0.45
maxMethod · 0.45
assignedMethod · 0.45
minMethod · 0.45
addMethod · 0.45
valMethod · 0.45

Tested by

no test coverage detected