Post expression
| 80 | ~ArithNonLinFloatExpr(void) { heap.free<LinFloatExpr>(a,n); } |
| 81 | /// Post expression |
| 82 | virtual FloatVar post(Home home, FloatVar* ret) const { |
| 83 | FloatVar y; |
| 84 | switch (t) { |
| 85 | case ANLFE_ABS: |
| 86 | { |
| 87 | FloatVar x = a[0].post(home); |
| 88 | if (x.min() >= 0) |
| 89 | y = result(home,ret,x); |
| 90 | else { |
| 91 | y = result(home,ret); |
| 92 | abs(home, x, y); |
| 93 | } |
| 94 | } |
| 95 | break; |
| 96 | case ANLFE_MIN: |
| 97 | if (n==1) { |
| 98 | y = result(home,ret, a[0].post(home)); |
| 99 | } else if (n==2) { |
| 100 | FloatVar x0 = a[0].post(home); |
| 101 | FloatVar x1 = a[1].post(home); |
| 102 | if (x0.max() <= x1.min()) |
| 103 | y = result(home,ret,x0); |
| 104 | else if (x1.max() <= x0.min()) |
| 105 | y = result(home,ret,x1); |
| 106 | else { |
| 107 | y = result(home,ret); |
| 108 | min(home, x0, x1, y); |
| 109 | } |
| 110 | } else { |
| 111 | FloatVarArgs x(n); |
| 112 | for (int i=n; i--;) |
| 113 | x[i] = a[i].post(home); |
| 114 | y = result(home,ret); |
| 115 | min(home, x, y); |
| 116 | } |
| 117 | break; |
| 118 | case ANLFE_MAX: |
| 119 | if (n==1) { |
| 120 | y = result(home,ret,a[0].post(home)); |
| 121 | } else if (n==2) { |
| 122 | FloatVar x0 = a[0].post(home); |
| 123 | FloatVar x1 = a[1].post(home); |
| 124 | if (x0.max() <= x1.min()) |
| 125 | y = result(home,ret,x1); |
| 126 | else if (x1.max() <= x0.min()) |
| 127 | y = result(home,ret,x0); |
| 128 | else { |
| 129 | y = result(home,ret); |
| 130 | max(home, x0, x1, y); |
| 131 | } |
| 132 | } else { |
| 133 | FloatVarArgs x(n); |
| 134 | for (int i=n; i--;) |
| 135 | x[i] = a[i].post(home); |
| 136 | y = result(home,ret); |
| 137 | max(home, x, y); |
| 138 | } |
| 139 | break; |