%Test whether \a x is solution
| 434 | elements(el), weights(w), minWeight(min), maxWeight(max) {} |
| 435 | /// %Test whether \a x is solution |
| 436 | virtual bool solution(const SetAssignment& x) const { |
| 437 | CountableSetRanges x0(x.lub, x[0]); |
| 438 | return x.intval()==weightI(elements,weights,x0) && |
| 439 | x.intval() >= minWeight && x.intval() <= maxWeight; |
| 440 | } |
| 441 | /// Post constraint on \a x |
| 442 | virtual void post(Space& home, SetVarArray& x, IntVarArray& y) { |
| 443 | Gecode::rel(home, minWeight <= y[0]); |