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

Method cut

test/float.cpp:302–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300 }
301
302 Gecode::FloatNum
303 TestSpace::cut(int* cutDirections) {
304 using namespace Gecode;
305 using namespace Gecode::Float;
306 // Select variable to be cut
307 int i = 0;
308 while (x[i].assigned()) i++;
309 for (int j=x.size(); j--; ) {
310 if (!x[j].assigned() && (x[j].size() > x[i].size())) i = j;
311 }
312 Rounding rounding;
313 if (cutDirections[i]) {
314 FloatNum m = rounding.div_up(rounding.add_up(x[i].min(), x[i].max()), 2);
315 FloatNum n = nextafter(x[i].min(), x[i].max());
316 if (m > n)
317 rel(i, FRT_LQ, m);
318 else
319 rel(i, FRT_LQ, n);
320 } else {
321 FloatNum m = rounding.div_down(rounding.add_down(x[i].min(), x[i].max()), 2);
322 FloatNum n = nextafter(x[i].max(), x[i].min());
323 if (m < n)
324 rel(i, FRT_GQ, m);
325 else
326 rel(i, FRT_GQ, n);
327 }
328 return x[i].size();
329 }
330
331 void
332 TestSpace::prune(int i, Gecode::Support::RandomGenerator& rand) {

Callers

nothing calls this directly

Calls 10

nextafterFunction · 0.85
relFunction · 0.50
assignedMethod · 0.45
sizeMethod · 0.45
div_upMethod · 0.45
add_upMethod · 0.45
minMethod · 0.45
maxMethod · 0.45
div_downMethod · 0.45
add_downMethod · 0.45

Tested by

no test coverage detected