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

Function max

gecode/minimodel/int-arith.cpp:343–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341 }
342
343 LinIntExpr
344 max(const LinIntExpr& e0, const LinIntExpr& e1) {
345 using namespace MiniModel;
346 int n = 0;
347 if (hasType(e0, ArithNonLinIntExpr::ANLE_MAX))
348 n += static_cast<ArithNonLinIntExpr*>(e0.nle())->n;
349 else
350 n += 1;
351 if (hasType(e1, ArithNonLinIntExpr::ANLE_MAX))
352 n += static_cast<ArithNonLinIntExpr*>(e1.nle())->n;
353 else
354 n += 1;
355 ArithNonLinIntExpr* ae =
356 new ArithNonLinIntExpr(ArithNonLinIntExpr::ANLE_MAX,n);
357 int i=0;
358 if (hasType(e0, ArithNonLinIntExpr::ANLE_MAX)) {
359 ArithNonLinIntExpr* e0e = static_cast<ArithNonLinIntExpr*>(e0.nle());
360 for (; i<e0e->n; i++)
361 ae->a[i] = e0e->a[i];
362 } else {
363 ae->a[i++] = e0;
364 }
365 if (hasType(e1, ArithNonLinIntExpr::ANLE_MAX)) {
366 ArithNonLinIntExpr* e1e = static_cast<ArithNonLinIntExpr*>(e1.nle());
367 int curN = i;
368 for (; i<curN+e1e->n; i++)
369 ae->a[i] = e1e->a[i-curN];
370 } else {
371 ae->a[i++] = e1;
372 }
373 return LinIntExpr(ae);
374 }
375
376 LinIntExpr
377 min(const IntVarArgs& x) {

Callers 1

postFunction · 0.70

Calls 4

LinIntExprClass · 0.85
nleMethod · 0.80
hasTypeFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected