Changeset 318


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

fixed bug that gave 2.982 on minlplib/alan -- wrong OBBT implication on univariate (semi)-aux

Location:
trunk/Couenne/src/bound_tightening
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/bound_tightening/aggressiveBT.cpp

    r307 r318  
    210210          improved = 0;
    211211
    212           if (variables_ [index] -> sign () != exprVar::GEQ) {
     212          if ((variables_ [index] -> sign () != expression::GEQ) &&
     213              (X [index] >= Lb (index) + COUENNE_EPS)) {
    213214
    214215            Jnlst()->Printf(J_DETAILED, J_BOUNDTIGHTENING,
     
    216217
    217218            // tighten on left
    218             if ((X [index] >= Lb (index) + COUENNE_EPS)
    219                 && ((improved = fake_tighten (0, index, X, olb, oub, chg_bds, f_chg)) < 0)) {
     219            if ((improved = fake_tighten (0, index, X, olb, oub, chg_bds, f_chg)) < 0) {
    220220              retval = false;
    221221              break;
     
    225225          second = 0;
    226226
    227           if (variables_ [index] -> sign () != exprVar::LEQ) {
     227          if (retval && (variables_ [index] -> sign () != expression::LEQ) &&
     228              (X [index] <= Ub (index) - COUENNE_EPS)) {
    228229            Jnlst()->Printf(J_DETAILED, J_BOUNDTIGHTENING,
    229230                            "------------- tighten right x%d\n", index);
    230231
    231232            // tighten on right
    232             if ((X [index] <= Ub (index) - COUENNE_EPS)
    233                 && ((second = fake_tighten (1, index, X, olb, oub, chg_bds, f_chg) < 0))) {
     233            if ((second = fake_tighten (1, index, X, olb, oub, chg_bds, f_chg) < 0)) {
    234234              retval = false;
    235235              break;
     
    247247
    248248    if (Jnlst()->ProduceOutput(J_ITERSUMMARY, J_BOUNDTIGHTENING)) {
     249
    249250      Jnlst()->Printf(J_ITERSUMMARY, J_BOUNDTIGHTENING,"------------------\n");
    250251
  • trunk/Couenne/src/bound_tightening/fake_tightening.cpp

    r308 r318  
    118118      }
    119119
    120       if ( (direction  && ((fb < inner) || (fb > outer))) ||
     120      if ( (direction && ((fb < inner) || (fb > outer))) ||
    121121          (!direction && ((fb > inner) || (fb < outer))))
    122122        fb = 0.5 * (inner + outer);
  • trunk/Couenne/src/bound_tightening/obbt.cpp

    r312 r318  
    5454        (Var (i) -> Multiplicity () > 0) &&
    5555        ((type == VAR)                               ||
    56          (aSign  == expression::EQ))) {
    57       //||
    58       //((aSign == expression::LEQ) && (sense > 0)) ||
    59       //((aSign == expression::GEQ) && (sense < 0)))) {
     56         (aSign  == expression::EQ) ||
     57         ((aSign == expression::LEQ) && (sense > 0)) ||
     58         ((aSign == expression::GEQ) && (sense < 0)))) {
    6059
    6160      int ni = obbt_iter (csi, chg_bds, warmstart, babInfo, objcoe, sense, i);
     61
     62//       {
     63//      // ToDo: Pipe all output through journalist
     64//      Jnlst()->Printf(J_DETAILED, J_BOUNDTIGHTENING,
     65//                      "  bounds after obbt step  =====================\n  ");
     66//      int j=0;
     67//      for (int i=0; i < nVars (); i++)
     68//        if (variables_ [i] -> Multiplicity () > 0) {
     69//          Jnlst()->Printf(J_VECTOR, J_BOUNDTIGHTENING,
     70//                          "x_%03d [%+10g %+10g] ", i,
     71//                          domain_. lb (i),
     72//                          domain_. ub (i));
     73//          if (!(++j % 6)) Jnlst()->Printf(J_VECTOR, J_BOUNDTIGHTENING,"\n  ");
     74//        }
     75//      if (j % 6) Jnlst()->Printf(J_VECTOR, J_BOUNDTIGHTENING,"\n");
     76//       }
    6277
    6378      if (ni < 0) return ni;
  • trunk/Couenne/src/bound_tightening/obbt_iter.cpp

    r309 r318  
    111111
    112112      if // independent variable is exactly bounded in both ways
    113         (((chg_bds [indInd].lower() & t_chg_bounds::EXACT) &&
    114           (chg_bds [indInd].upper() & t_chg_bounds::EXACT)) ||
    115          // or if this expression is of the form w=cx+d, that is, it
    116          // depends on one variable only and it is linear
    117          (var -> Image () -> Linearity () <= LINEAR)) {
     113        ((((chg_bds [indInd].lower() & t_chg_bounds::EXACT) &&
     114           (chg_bds [indInd].upper() & t_chg_bounds::EXACT)) ||
     115          // or if this expression is of the form w=cx+d, that is, it
     116          // depends on one variable only and it is linear
     117          (var -> Image () -> Linearity () <= LINEAR)) &&
     118         (var -> sign () == expression::EQ)) {
    118119
    119120        issimple = true;
     
    122123        var -> Image () -> getBounds (lb, ub);
    123124
     125        if (var -> isInteger ()) {
     126          lb = ceil  (lb - COUENNE_EPS);
     127          ub = floor (ub + COUENNE_EPS);
     128        }
     129
    124130        if (csi -> getColLower () [index] < lb - COUENNE_EPS) {
    125131          csi -> setColLower (index, lb);
     132          Lb (index) = lb;
    126133          chg_bds      [index].setLowerBits(t_chg_bounds::CHANGED | t_chg_bounds::EXACT);
    127134        } else chg_bds [index].setLowerBits(t_chg_bounds::EXACT);
     
    129136        if (csi -> getColUpper () [index] > ub + COUENNE_EPS) {
    130137          csi -> setColUpper (index, ub);
     138          Ub (index) = ub;
    131139          chg_bds      [index].setUpperBits(t_chg_bounds::CHANGED | t_chg_bounds::EXACT);
    132140        } else chg_bds [index].setUpperBits(t_chg_bounds::EXACT);
     
    320328  if (nImprov && jnlst_ -> ProduceOutput (J_ITERSUMMARY, J_BOUNDTIGHTENING)) {
    321329    Jnlst () -> Printf (J_ITERSUMMARY, J_BOUNDTIGHTENING, "OBBT: tightened ", nImprov);
    322     if (jnlst_ -> ProduceOutput (J_ITERSUMMARY, J_BOUNDTIGHTENING)) Var (index) -> print ();
     330    Var (index) -> print ();
    323331    Jnlst () -> Printf (J_ITERSUMMARY, J_BOUNDTIGHTENING, "\n");
    324332  }
Note: See TracChangeset for help on using the changeset viewer.