Changeset 113


Ignore:
Timestamp:
Apr 28, 2009 5:06:00 PM (13 years ago)
Author:
pbelotti
Message:

skip restore unused if there are none (see bug pointed out by C. D'Ambrosio). Restored precedence in if+assignment+OR in impliedBounds-exprSum while (hopefully) avoiding warnings Stefan mentioned.

Location:
stable/0.1/Couenne/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable/0.1/Couenne/src/bound_tightening/operators/impliedBounds-exprSum.cpp

    r111 r113  
    251251    for (register int i=ipos; i--;) {
    252252      int ind = I1 [i];
    253       if ((tighter = updateBound (+1, u + ind, (wu - lower) / C1 [i] + lc [ind])) || tighter) {
     253      if ((tighter = (updateBound (+1, u + ind, (wu - lower) / C1 [i] + lc [ind]) || tighter))) {
    254254        chg [ind].setUpper(t_chg_bounds::CHANGED);
    255255        if (intSet.find (ind)!= intSet.end ())
     
    261261    for (register int i=ineg; i--;) {
    262262      int ind = I2 [i];
    263       if ((tighter = updateBound (-1, l + ind, (wu - lower) / C2 [i] + uc [ind])) || tighter) {
     263      if ((tighter = (updateBound (-1, l + ind, (wu - lower) / C2 [i] + uc [ind]) || tighter))) {
    264264        chg [ind].setLower(t_chg_bounds::CHANGED);
    265265        if (intSet.find (ind)!= intSet.end ())
     
    271271    if ((infLo1 >= 0) && (infUp2 == -1)) {    // There is one infinite lower bound in I1
    272272      int ind = I1 [infLo1];
    273       if ((tighter = updateBound (+1, u + ind, (wu - lower) / C1 [infLo1])) || tighter) {
     273      if ((tighter = (updateBound (+1, u + ind, (wu - lower) / C1 [infLo1]) || tighter))) {
    274274        chg [ind].setUpper(t_chg_bounds::CHANGED);
    275275        if (intSet.find (ind)!= intSet.end ())
     
    280280      if ((infLo1 == -1) && (infUp2 >= 0)) {  // There is one infinite upper bound in I2
    281281        int ind = I2 [infUp2];
    282         if ((tighter = updateBound (-1, l + ind, (wu - lower) / C2 [infUp2])) || tighter) {
     282        if ((tighter = (updateBound (-1, l + ind, (wu - lower) / C2 [infUp2]) || tighter))) {
    283283          chg [ind].setLower(t_chg_bounds::CHANGED);
    284284          if (intSet.find (ind)!= intSet.end ())
     
    294294    for (register int i=ipos; i--;) {
    295295      int ind = I1 [i];
    296       if ((tighter = updateBound (-1, l + ind, (wl - upper) / C1 [i] + uc [ind])) || tighter) {
     296      if ((tighter = (updateBound (-1, l + ind, (wl - upper) / C1 [i] + uc [ind]) || tighter))) {
    297297        chg [ind].setLower(t_chg_bounds::CHANGED);
    298298        if (intSet.find (ind) != intSet.end ())
     
    303303    for (register int i=ineg; i--;) {
    304304      int ind = I2 [i];
    305       if ((tighter = updateBound (+1, u + ind, (wl - upper) / C2 [i] + lc [ind])) || tighter) {
     305      if ((tighter = (updateBound (+1, u + ind, (wl - upper) / C2 [i] + lc [ind]) || tighter))) {
    306306        chg [ind].setUpper(t_chg_bounds::CHANGED);
    307307        if (intSet.find (ind) != intSet.end ())
     
    313313    if ((infUp1 >= 0) && (infLo2 == -1)) { // There is one infinite lower bound in I2
    314314      int ind = I1 [infUp1];
    315       if ((tighter = updateBound (-1, l + ind, (wl - upper) / C1 [infUp1])) || tighter) {
     315      if ((tighter = (updateBound (-1, l + ind, (wl - upper) / C1 [infUp1]) || tighter))) {
    316316        chg [ind].setLower(t_chg_bounds::CHANGED);
    317317        if (intSet.find (ind) != intSet.end ())
     
    322322      if ((infUp1 == -1) && (infLo2 >= 0)) {  // There is one infinite upper bound in I1
    323323        int ind = I2 [infLo2];
    324         if ((tighter = updateBound (+1, u + ind, (wl - upper) / C2 [infLo2])) || tighter) {
     324        if ((tighter = (updateBound (+1, u + ind, (wl - upper) / C2 [infLo2]) || tighter))) {
    325325          chg [ind].setUpper(t_chg_bounds::CHANGED);
    326326          if (intSet.find (ind) != intSet.end ())
  • stable/0.1/Couenne/src/problem/CouenneRestoreUnused.cpp

    r105 r113  
    5454
    5555  if (x)
    56     domain_.push (nVars(), x, NULL, NULL);
     56    domain_.push (nVars(), x, NULL, NULL, false);
    5757
    5858  for (int i=0; i<nUnusedOriginals_; i++) {
  • stable/0.1/Couenne/src/problem/CouenneSolverInterface.cpp

    r111 r113  
    6161  // some originals may be unused due to their zero multiplicity (that
    6262  // happens when they are duplicates), restore their value
    63   CouNumber *x = new CouNumber [getNumCols ()];
    64   CoinCopyN (getColSolution (), getNumCols (), x);
    65   cutgen_ -> Problem () -> restoreUnusedOriginals (x);
    66   setColSolution (x);
    67   delete [] x;
     63  if (cutgen_ -> Problem () -> nUnusedOriginals () > 0) {
     64    CouNumber *x = new CouNumber [getNumCols ()];
     65    CoinCopyN (getColSolution (), getNumCols (), x);
     66    cutgen_ -> Problem () -> restoreUnusedOriginals (x);
     67    setColSolution (x);
     68    delete [] x;
     69  }
    6870
    6971  /*
     
    149151  // some originals may be unused due to their zero multiplicity (that
    150152  // happens when they are duplicates), restore their value
    151   CouNumber *x = new CouNumber [getNumCols ()];
    152   CoinCopyN (getColSolution (), getNumCols (), x);
    153   cutgen_ -> Problem () -> restoreUnusedOriginals (x);
    154   setColSolution (x);
    155   delete [] x;
     153  if (cutgen_ -> Problem () -> nUnusedOriginals () > 0) {
     154    CouNumber *x = new CouNumber [getNumCols ()];
     155    CoinCopyN (getColSolution (), getNumCols (), x);
     156    cutgen_ -> Problem () -> restoreUnusedOriginals (x);
     157    setColSolution (x);
     158    delete [] x;
     159  }
    156160
    157161  //cutgen_ -> Problem () -> restoreUnusedOriginals (this);
     
    323327  // some originals may be unused due to their zero multiplicity (that
    324328  // happens when they are duplicates), restore their value
    325   CouNumber *x = new CouNumber [getNumCols ()];
    326   CoinCopyN (getColSolution (), getNumCols (), x);
    327   cutgen_ -> Problem () -> restoreUnusedOriginals (x);
    328   setColSolution (x);
    329   delete [] x;
     329  if (cutgen_ -> Problem () -> nUnusedOriginals () > 0) {
     330    CouNumber *x = new CouNumber [getNumCols ()];
     331    CoinCopyN (getColSolution (), getNumCols (), x);
     332    cutgen_ -> Problem () -> restoreUnusedOriginals (x);
     333    setColSolution (x);
     334    delete [] x;
     335  }
    330336
    331337  if (isProvenPrimalInfeasible ()) knowInfeasible_ = true;
Note: See TracChangeset for help on using the changeset viewer.