| 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) { |
no test coverage detected