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

Method adjust

gecode/int/linear/int-dom.hpp:263–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261 }
262 template<class Val>
263 forceinline bool
264 PosSupportIter<Val>::adjust(Val& d) {
265 // Current value
266 Val v = static_cast<Val>(a) * c;
267 // Subtract current value from d
268 d -= v;
269 // Move to next position (number of value)
270 p++;
271 // Still in the same range
272 if (c < i.max()) {
273 // Decrement current values
274 c += 1; v += a;
275 } else {
276 // Go to next range
277 ++i;
278 if (!i())
279 return false;
280 c = i.min(); v = static_cast<Val>(a) * c;
281 }
282 // Is d with the current value too large?
283 if (d + v > l)
284 return false;
285 // Update d
286 d += v;
287 return true;
288 }
289
290
291 /*

Callers 1

propagateMethod · 0.45

Calls 3

iFunction · 0.50
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected