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

Method updatePart1

gecode/set/ldsb/brancher.hpp:132–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130 template<class View, int n, class Val, unsigned int a,
131 class Filter, class Print>
132 void
133 LDSBSetBrancher<View,n,Val,a,Filter,Print>::
134 updatePart1(Space& home, int choicePos) {
135 if (_nValueSymmetries > 0) {
136 // If this is a different variable from the last commit, restore
137 // the old value symmetries and update the copy.
138 if (choicePos != _prevPos) {
139 if (_prevPos != -1) {
140 int i = 0;
141 for (int j = _nNonValueSymmetries ; j < this->_nsyms ; j++) {
142 this->_syms[j] = _copiedSyms[i];
143 i++;
144 }
145
146 for (int i = 0 ; i < _nCopiedSyms ; i++) {
147 ValueSymmetryImp<View>* ns =
148 specialUpdate(home, _copiedSyms[i], _leftBranchValues);
149 if (ns) {
150 this->_syms = home.realloc<SymmetryImp<View>*>(this->_syms,
151 this->_nsyms,
152 this->_nsyms+1);
153 this->_syms[this->_nsyms] = ns;
154 this->_nsyms++;
155 this->_nValueSymmetries++;
156 }
157 }
158 }
159
160 // Reset for current variable, make copy of value symmetries
161 _leftBranchValues = IntSet::empty;
162 _prevPos = choicePos;
163 if (_nCopiedSyms > 0) home.free(_copiedSyms, _nCopiedSyms);
164 _nCopiedSyms = _nValueSymmetries;
165 _copiedSyms = home.alloc<ValueSymmetryImp<View>*>(_nCopiedSyms);
166 {
167 int i = 0;
168 for (int j = _nNonValueSymmetries ; j < this->_nsyms ; j++) {
169 ValueSymmetryImp<View>* vsi =
170 static_cast<ValueSymmetryImp<View>*>(this->_syms[j]);
171 _copiedSyms[i] =
172 static_cast<ValueSymmetryImp<View>*>(vsi->copy(home));
173 i++;
174 }
175 }
176 }
177 }
178 }
179
180 // Compute choice
181 template<class View, int n, class Val, unsigned int a,

Callers

nothing calls this directly

Calls 3

specialUpdateFunction · 0.85
freeMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected