Changeset 306


Ignore:
Timestamp:
Mar 4, 2010 11:22:05 PM (10 years ago)
Author:
pbelotti
Message:

eliminate redundant (empty) constraints. Thanks to Leo Liberti and Giuliano Casale for pointing that out.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/standardize/standardize.cpp

    r294 r306  
    153153#endif
    154154
     155    CouNumber
     156      conLb = (*((*i) -> Lb ())) (),
     157      conUb = (*((*i) -> Ub ())) ();
     158
     159    // sanity check: if (due to bad model or redundancies) the
     160    // constraint's body is constant, check if it's within bounds.
     161
     162    expression *eBody = (*i) -> Body ();
     163
     164    if (eBody -> Linearity () <= CONSTANT) {
     165
     166      CouNumber bodyVal = (*eBody)();
     167      if ((bodyVal < conLb - COUENNE_EPS) ||
     168          (bodyVal > conUb + COUENNE_EPS)) { // all variables eliminated, but out of bounds
     169       
     170        jnlst_ -> Printf (J_SUMMARY, J_PROBLEM,
     171                          "Constraint %d: all variables eliminated, but value %g out of bounds [%g,%g]\n",
     172                          bodyVal, conLb, conUb);
     173        retval = false;
     174        break;
     175
     176      } else {
     177        iters2erase.push_back (i);
     178        continue; // all variables eliminated and constraint is redundant
     179      }
     180    }
     181
    155182    exprAux *aux = (*i) -> standardize (this);
    156183
Note: See TracChangeset for help on using the changeset viewer.