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

Function specialUpdate

gecode/set/ldsb/brancher.hpp:99–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97 */
98 template <class View>
99 ValueSymmetryImp<View>*
100 specialUpdate(Space& home, ValueSymmetryImp<View>* s, IntSet usedValues) {
101 // Calculate intersection and difference.
102 IntArgs intersection;
103 IntArgs difference;
104 int n = 0;
105 for (int i = s->values.next(s->values.offset()) ;
106 i <= s->values.max_bit() ; i = s->values.next(i+1)) {
107 n++;
108 if (usedValues.in(i))
109 intersection << i;
110 else
111 difference << i;
112 }
113
114 for (IntSetValues v(usedValues) ; v() ; ++v) {
115 s->update(Literal(0, v.val()));
116 }
117
118 if (intersection.size() < 2)
119 return nullptr;
120 int *a = new int[intersection.size()];
121 for (int i = 0 ; i < intersection.size() ; i++) {
122 a[i] = intersection[i];
123 }
124 ValueSymmetryImp<View>* ns =
125 new (home) ValueSymmetryImp<View>(home, a, intersection.size());
126 delete [] a;
127 return ns;
128 }
129
130 template<class View, int n, class Val, unsigned int a,
131 class Filter, class Print>

Callers 1

updatePart1Method · 0.85

Calls 8

LiteralClass · 0.85
max_bitMethod · 0.80
nextMethod · 0.45
offsetMethod · 0.45
inMethod · 0.45
updateMethod · 0.45
valMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected