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

Function min

gecode/minimodel/float-arith.cpp:338–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

336 }
337
338 LinFloatExpr
339 min(const LinFloatExpr& e0, const LinFloatExpr& e1) {
340 using namespace MiniModel;
341 int n = 0;
342 if (hasType(e0, ArithNonLinFloatExpr::ANLFE_MIN))
343 n += static_cast<ArithNonLinFloatExpr*>(e0.nlfe())->n;
344 else
345 n += 1;
346 if (hasType(e1, ArithNonLinFloatExpr::ANLFE_MIN))
347 n += static_cast<ArithNonLinFloatExpr*>(e1.nlfe())->n;
348 else
349 n += 1;
350 ArithNonLinFloatExpr* ae =
351 new ArithNonLinFloatExpr(ArithNonLinFloatExpr::ANLFE_MIN,n);
352 int i=0;
353 if (hasType(e0, ArithNonLinFloatExpr::ANLFE_MIN)) {
354 ArithNonLinFloatExpr* e0e = static_cast<ArithNonLinFloatExpr*>(e0.nlfe());
355 for (; i<e0e->n; i++)
356 ae->a[i] = e0e->a[i];
357 } else {
358 ae->a[i++] = e0;
359 }
360 if (hasType(e1, ArithNonLinFloatExpr::ANLFE_MIN)) {
361 ArithNonLinFloatExpr* e1e = static_cast<ArithNonLinFloatExpr*>(e1.nlfe());
362 int curN = i;
363 for (; i<curN+e1e->n; i++)
364 ae->a[i] = e1e->a[i-curN];
365 } else {
366 ae->a[i++] = e1;
367 }
368 return LinFloatExpr(ae);
369 }
370
371 LinFloatExpr
372 min(const FloatVarArgs& x) {

Callers 1

postFunction · 0.70

Calls 4

LinFloatExprClass · 0.85
nlfeMethod · 0.80
hasTypeFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected