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

Function postposcompact

gecode/int/extensional/compact.hpp:684–726  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

682 */
683 template<class View>
684 ExecStatus
685 postposcompact(Home home, ViewArray<View>& x, const TupleSet& ts) {
686 if (ts.tuples() == 0)
687 return (x.size() == 0) ? ES_OK : ES_FAILED;
688
689 // All variables pruned to correct domain
690 for (int i=0; i<x.size(); i++) {
691 TupleSet::Ranges r(ts,i);
692 GECODE_ME_CHECK(x[i].inter_r(home, r, false));
693 }
694
695 if ((x.size() <= 1) || (ts.tuples() <= 1))
696 return ES_OK;
697
698 // Choose the right bit set implementation
699 switch (ts.words()) {
700 case 0U:
701 GECODE_NEVER; return ES_OK;
702 case 1U:
703 return PosCompact<View,TinyBitSet<1U>>::post(home,x,ts);
704 case 2U:
705 return PosCompact<View,TinyBitSet<2U>>::post(home,x,ts);
706 case 3U:
707 return PosCompact<View,TinyBitSet<3U>>::post(home,x,ts);
708 case 4U:
709 return PosCompact<View,TinyBitSet<4U>>::post(home,x,ts);
710 default:
711 switch (Gecode::Support::u_type(ts.words())) {
712 case Gecode::Support::IT_CHAR:
713 return PosCompact<View,BitSet<unsigned char>>
714 ::post(home,x,ts);
715 case Gecode::Support::IT_SHRT:
716 return PosCompact<View,BitSet<unsigned short int>>
717 ::post(home,x,ts);
718 case Gecode::Support::IT_INT:
719 return PosCompact<View,BitSet<unsigned int>>
720 ::post(home,x,ts);
721 default: GECODE_NEVER;
722 }
723 }
724 GECODE_NEVER;
725 return ES_OK;
726 }
727
728
729 /*

Callers 2

postMethod · 0.85
propagateMethod · 0.85

Calls 6

u_typeFunction · 0.85
tuplesMethod · 0.80
postFunction · 0.50
sizeMethod · 0.45
inter_rMethod · 0.45
wordsMethod · 0.45

Tested by

no test coverage detected