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

Method post

gecode/int/linear/bool-view.hpp:90–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88
89 template<class XV, class YV>
90 ExecStatus
91 EqBoolView<XV,YV>::post(Home home, ViewArray<XV>& x, YV y, int c) {
92 if (y.assigned())
93 return EqBoolInt<XV>::post(home,x,y.val()+c);
94 int n = x.size();
95 for (int i=n; i--; )
96 if (x[i].one()) {
97 x[i]=x[--n]; c--;
98 } else if (x[i].zero()) {
99 x[i]=x[--n];
100 }
101 x.size(n);
102 GECODE_ME_CHECK(y.lq(home,n-c));
103 GECODE_ME_CHECK(y.gq(home,-c));
104 if (n == 0)
105 return ES_OK;
106 if (y.min()+c == n) {
107 assert(y.assigned());
108 for (int i=0; i<n; i++)
109 GECODE_ME_CHECK(x[i].one_none(home));
110 return ES_OK;
111 }
112 if (y.max()+c == 0) {
113 assert(y.assigned());
114 for (int i=0; i<n; i++)
115 GECODE_ME_CHECK(x[i].zero_none(home));
116 return ES_OK;
117 }
118 (void) new (home) EqBoolView<XV,YV>(home,x,y,c);
119 return ES_OK;
120 }
121
122 template<class XV, class YV>
123 forceinline

Callers

nothing calls this directly

Calls 13

postFunction · 0.70
assignedMethod · 0.45
valMethod · 0.45
sizeMethod · 0.45
oneMethod · 0.45
zeroMethod · 0.45
lqMethod · 0.45
gqMethod · 0.45
minMethod · 0.45
one_noneMethod · 0.45
maxMethod · 0.45
zero_noneMethod · 0.45

Tested by

no test coverage detected