| 149 | } |
| 150 | |
| 151 | void |
| 152 | LinFloatExpr::post(Home home, FloatRelType frt) const { |
| 153 | if (home.failed()) return; |
| 154 | Region r; |
| 155 | if (n->t==NT_ADD && n->l == nullptr && n->r->t==NT_NONLIN) { |
| 156 | n->r->sum.ne->post(home,frt,-n->c); |
| 157 | } else if (n->t==NT_SUB && n->r->t==NT_NONLIN && n->l==nullptr) { |
| 158 | switch (frt) { |
| 159 | case FRT_LQ: frt=FRT_GQ; break; |
| 160 | case FRT_LE: frt=FRT_GR; break; |
| 161 | case FRT_GQ: frt=FRT_LQ; break; |
| 162 | case FRT_GR: frt=FRT_LE; break; |
| 163 | default: break; |
| 164 | } |
| 165 | n->r->sum.ne->post(home,frt,n->c); |
| 166 | } else if (frt==FRT_EQ && |
| 167 | n->t==NT_SUB && n->r->t==NT_NONLIN && |
| 168 | n->l != nullptr && n->l->t==NT_VAR |
| 169 | && n->l->a==1) { |
| 170 | (void) n->r->sum.ne->post(home,&n->l->x_float); |
| 171 | } else if (frt==FRT_EQ && |
| 172 | n->t==NT_SUB && n->r->t==NT_VAR && |
| 173 | n->l != nullptr && n->l->t==NT_NONLIN |
| 174 | && n->r->a==1) { |
| 175 | (void) n->l->sum.ne->post(home,&n->r->x_float); |
| 176 | } else { |
| 177 | Float::Linear::Term* fts = |
| 178 | r.alloc<Float::Linear::Term>(n->n_float); |
| 179 | FloatVal c = n->fill(home,fts); |
| 180 | Float::Linear::post(home, fts, n->n_float, frt, -c); |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | void |
| 185 | LinFloatExpr::post(Home home, FloatRelType frt, const BoolVar& b) const { |