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

Method advise

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

Source from the content-addressed store, hash-verified

128
129 template<class VX>
130 ExecStatus
131 GqBoolInt<VX>::advise(Space& home, Advisor& a, const Delta& d) {
132 // Check whether propagator is running
133 if (n_as == 0)
134 return ES_FIX;
135
136 if (VX::one(d)) {
137 c--; goto check;
138 }
139 if (c+1 < n_as)
140 goto check;
141 // Find a new subscription
142 for (int i = x.size()-1; i>=n_hs; i--)
143 if (x[i].none()) {
144 std::swap(x[i],x[n_hs]);
145 x[n_hs++].subscribe(home,a);
146 x.size(i+1);
147 return ES_FIX;
148 } else if (x[i].one()) {
149 c--;
150 if (c+1 < n_as) {
151 x.size(i);
152 assert(n_hs <= x.size());
153 goto check;
154 }
155 }
156 // No view left for subscription
157 x.size(n_hs);
158 check:
159 // Do not update subscription
160 n_as--;
161 int n = x.size()-n_hs+n_as;
162 if ((n < c) && !disabled())
163 return ES_FAILED;
164 if ((c <= 0) || (c == n))
165 return ES_NOFIX;
166 else
167 return ES_FIX;
168 }
169
170 template<class VX>
171 void

Callers

nothing calls this directly

Calls 5

oneFunction · 0.50
sizeMethod · 0.45
noneMethod · 0.45
subscribeMethod · 0.45
oneMethod · 0.45

Tested by

no test coverage detected