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

Method prune

test/int.cpp:275–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273 }
274
275 void
276 TestSpace::prune(int i, bool bounds_only, Gecode::Support::RandomGenerator& rand) {
277 using namespace Gecode;
278 // Prune values
279 if (bounds_only) {
280 if (rand(2) && !x[i].assigned()) {
281 int v=x[i].min()+1+
282 static_cast<int>(rand(static_cast<unsigned int>(x[i].max()-x[i].min())));
283 assert((v > x[i].min()) && (v <= x[i].max()));
284 rel(i, Gecode::IRT_LE, v);
285 }
286 if (rand(2) && !x[i].assigned()) {
287 int v=x[i].min()+
288 static_cast<int>(rand(static_cast<unsigned int>(x[i].max()-x[i].min())));
289 assert((v < x[i].max()) && (v >= x[i].min()));
290 rel(i, Gecode::IRT_GR, v);
291 }
292 } else {
293 for (int vals =
294 static_cast<int>(rand(static_cast<unsigned int>(x[i].size()-1))+1); vals--; ) {
295 int v;
296 Gecode::Int::ViewRanges<Gecode::Int::IntView> it(x[i]);
297 unsigned int skip = rand(x[i].size()-1);
298 while (true) {
299 if (it.width() > skip) {
300 v = it.min() + static_cast<int>(skip); break;
301 }
302 skip -= it.width(); ++it;
303 }
304 rel(i, IRT_NQ, v);
305 }
306 }
307 }
308
309 void
310 TestSpace::prune(Gecode::Support::RandomGenerator& rand) {

Callers 1

runMethod · 0.45

Calls 10

indClass · 0.85
relFunction · 0.50
assignedMethod · 0.45
minMethod · 0.45
maxMethod · 0.45
sizeMethod · 0.45
widthMethod · 0.45
postMethod · 0.45
failedMethod · 0.45
varMethod · 0.45

Tested by

no test coverage detected