Changeset 1001 for branches


Ignore:
Timestamp:
Jul 9, 2008 6:59:48 PM (11 years ago)
Author:
jpgoncal
Message:

The boounds of the parent were not changed when the grandparent was deleted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/dynamicbranching/dynamicbranching.cpp

    r999 r1001  
    12251225
    12261226  // Now make sure way_ is set properly
     1227  bool removeGrandparent = false;
    12271228  if (down_child_stays_with_parent) {
    12281229    if (!parent.bothChildDone()) {
     
    12411242        // remove grandparent, none of its children is processed now, why
    12421243        // force its branching decision?
    1243         removeNode(grandparent_id);
     1244        removeGrandparent = true;
     1245        // the node is removed further down after changing the parent's bounds
    12441246        parent.child_up_ = -1;
    12451247        parent.way_ = DBNodeSimple::WAY_DOWN_UP__DOWN_DONE;
    1246         sizeDeferred_--;
    1247         return; // No bound changes are needed on the GO side as GP is
    1248                 // deleted...
     1248        // No bound changes are needed on the GO side as GP is
     1249        // deleted...
    12491250      } else {
    12501251        grandparent.way_ = parent_is_down_child ?
     
    12671268    } else { // only parent is processed from the two children of grandparent
    12681269      if (! child_to_move_is_processed) {
    1269         removeNode(grandparent_id);
     1270        removeGrandparent = true;
     1271        // the node is removed further down after changing the parent's bounds
    12701272        parent.child_down_ = -1;
    12711273        parent.way_ = DBNodeSimple::WAY_UP_DOWN__UP_DONE;
    1272         sizeDeferred_--;
    1273         return;
    12741274      } else {
    12751275        grandparent.way_ = parent_is_down_child ?
     
    13021302  }
    13031303
    1304   // Now add the branching var bound change of P to GP and all of its
    1305   // descendant
    1306   if (down_child_stays_with_parent) {
    1307     adjustBounds(grandparent_id, parent.variable_,
    1308                  (int)ceil(parent.value_), parent.upper_[parent.variable_]);
    1309   } else {
    1310     adjustBounds(grandparent_id, parent.variable_,
    1311                  parent.lower_[parent.variable_], (int)floor(parent.value_));
     1304  if(removeGrandparent) {
     1305    removeNode(grandparent_id);
     1306    sizeDeferred_--;
     1307  }
     1308  else {
     1309    // Now add the branching var bound change of P to GP and all of its
     1310    // descendant
     1311    if (down_child_stays_with_parent) {
     1312      adjustBounds(grandparent_id, parent.variable_,
     1313                   (int)ceil(parent.value_), parent.upper_[parent.variable_]);
     1314    } else {
     1315      adjustBounds(grandparent_id, parent.variable_,
     1316                   parent.lower_[parent.variable_], (int)floor(parent.value_));
     1317    }
    13121318  }
    13131319}
     
    16871693            assert(!lpres.isProvenOptimal || ! model.isProvenOptimal() ||
    16881694                   (lpres.isProvenOptimal && model.isProvenOptimal() &&
    1689                     lpres.getObjValue == model.getObjValue()));
     1695                    abs(lpres.getObjValue - model.getObjValue()) < 1.0e-8));
    16901696#endif
    16911697            printf("Finished moving node %d up by %i levels.\n", node.node_id_, cnt);
Note: See TracChangeset for help on using the changeset viewer.