| 612 | |
| 613 | template<class View, class Table> |
| 614 | ExecStatus |
| 615 | PosCompact<View,Table>::advise(Space& home, Advisor& a0, const Delta& d) { |
| 616 | CTAdvisor& a = static_cast<CTAdvisor&>(a0); |
| 617 | |
| 618 | // Do not fail a disabled propagator |
| 619 | if (table.empty()) |
| 620 | return Compact<View,true>::disabled() ? |
| 621 | home.ES_NOFIX_DISPOSE(c,a) : ES_FAILED; |
| 622 | |
| 623 | View x = a.view(); |
| 624 | |
| 625 | /* |
| 626 | * Do not schedule if propagator is performing propagation, |
| 627 | * and dispose if assigned. |
| 628 | */ |
| 629 | if (status.type() == StatusType::PROPAGATING) |
| 630 | return x.assigned() ? home.ES_FIX_DISPOSE(c,a) : ES_FIX; |
| 631 | |
| 632 | // Update status |
| 633 | status.touched(a); |
| 634 | |
| 635 | if (x.assigned()) { |
| 636 | // Variable is assigned -- intersect with its value |
| 637 | table.template intersect_with_mask<true>(supports(a,x.val())); |
| 638 | return home.ES_NOFIX_DISPOSE(c,a); |
| 639 | } |
| 640 | |
| 641 | if (!x.any(d) && (x.min(d) == x.max(d))) { |
| 642 | table.nand_with_mask(supports(a,x.min(d))); |
| 643 | a.adjust(); |
| 644 | } else if (!x.any(d) && (x.width(d) <= x.size())) { |
| 645 | // Incremental update, using the removed values |
| 646 | for (LostSupports ls(*this,a,x.min(d),x.max(d)); ls(); ++ls) { |
| 647 | table.nand_with_mask(ls.supports()); |
| 648 | if (table.empty()) |
| 649 | return Compact<View,true>::disabled() ? |
| 650 | home.ES_NOFIX_DISPOSE(c,a) : ES_FAILED; |
| 651 | } |
| 652 | a.adjust(); |
| 653 | } else { |
| 654 | a.adjust(); |
| 655 | // Reset-based update, using the values that are left |
| 656 | if (x.size() == 2) { |
| 657 | table.intersect_with_masks(supports(a,x.min()), |
| 658 | supports(a,x.max())); |
| 659 | } else { |
| 660 | Region r; |
| 661 | BitSetData* mask = r.alloc<BitSetData>(table.size()); |
| 662 | // Collect all tuples to be kept in a temporary mask |
| 663 | table.clear_mask(mask); |
| 664 | for (ValidSupports vs(*this,a); vs(); ++vs) |
| 665 | table.add_to_mask(vs.supports(),mask); |
| 666 | table.template intersect_with_mask<false>(mask); |
| 667 | } |
| 668 | } |
| 669 | |
| 670 | // Do not fail a disabled propagator |
| 671 | if (table.empty()) |
nothing calls this directly
no test coverage detected