void CbcNodeInfo::incrementParentCuts(CbcModel * model, int change) { if (parent_) { int i; // Get over-estimate of space needed for basis CoinWarmStartBasis & dummy = model->workingBasis(); dummy.setSize(0, numberRows_ + numberCuts_); /* everything is zero (i.e. free) so we can use to see if latest basis */ buildRowBasis(dummy); CbcNodeInfo * thisInfo = parent_; while (thisInfo) thisInfo = thisInfo->buildRowBasis(dummy); // increment cut counts thisInfo = parent_; int numberRows = numberRows_; while (thisInfo) { for (i = thisInfo->numberCuts_ - 1; i >= 0; i--) { CoinWarmStartBasis::Status status = dummy.getArtifStatus(--numberRows); #ifdef ALLCUTS status = CoinWarmStartBasis::isFree; #endif if (thisInfo->cuts_[i] && status != CoinWarmStartBasis::basic) { thisInfo->cuts_[i]->increment(change); } } thisInfo = thisInfo->parent_; } } }
void CbcNodeInfo::decrementParentCuts(CbcModel * model, int change) { if (parent_) { // get rid of all remaining if negative int changeThis; if (change < 0) changeThis = numberBranchesLeft_; else changeThis = change; int i; // Get over-estimate of space needed for basis CoinWarmStartBasis & dummy = model->workingBasis(); dummy.setSize(0, numberRows_ + numberCuts_); buildRowBasis(dummy); /* everything is zero (i.e. free) so we can use to see if latest basis */ CbcNodeInfo * thisInfo = parent_; while (thisInfo) thisInfo = thisInfo->buildRowBasis(dummy); // decrement cut counts thisInfo = parent_; int numberRows = numberRows_; while (thisInfo) { for (i = thisInfo->numberCuts_ - 1; i >= 0; i--) { CoinWarmStartBasis::Status status = dummy.getArtifStatus(--numberRows); #ifdef ALLCUTS status = CoinWarmStartBasis::isFree; #endif if (thisInfo->cuts_[i]) { int number = 1; if (status != CoinWarmStartBasis::basic) { // tight - drop 1 or 2 if (change < 0) number = thisInfo->cuts_[i]->decrement(changeThis); else number = thisInfo->cuts_[i]->decrement(change); } if (!number) { #ifndef GLOBAL_CUTS_JUST_POINTERS delete thisInfo->cuts_[i]; #else if (thisInfo->cuts_[i]->globallyValidAsInteger() != 2) delete thisInfo->cuts_[i]; #endif thisInfo->cuts_[i] = NULL; } } } thisInfo = thisInfo->parent_; } } }