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

Function weightI

test/set/int.cpp:409–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407
408 template<class I>
409 int weightI(const IntArgs& elements,
410 const IntArgs& weights,
411 I& iter) {
412 int sum = 0;
413 int i = 0;
414 for (Iter::Ranges::ToValues<I> v(iter); v(); ++v) {
415 // Skip all elements below the current
416 while (elements[i]<v.val()) i++;
417 assert(elements[i] == v.val());
418 sum += weights[i];
419 }
420 return sum;
421 }
422
423 /// %Test for set weight constraint
424 class Weights : public SetTest {

Callers 1

solutionMethod · 0.70

Calls 1

valMethod · 0.45

Tested by

no test coverage detected