[BCP] Bug related to CoinSearchTreeBase::top() function

oyo1 at pitt.edu oyo1 at pitt.edu
Sat Dec 19 17:00:07 EST 2009


I am using BCP-1.2.2. I am not sure if it is fixed in the latest version
of BCP but I figured out a small bug on BCP-1.2.2.

If you select diving by keeping one of the children after branching,
current implementation of

CoinTreeNode* CoinSearchTreeBase::top()

function sometimes gives a segmentation error because the actual size of
the 'candidateList_' vector and 'size_' class variable may differ from
each other. This is because BCP advances the current node of the siblings
before creating the child nodes when diving is selected.

A simple resolution to this bug can be checking the size of the
'candidateList_' vector as well as the 'size_' variable in the top()
function. So, the corrected version of the function should be something
like:

===============================================
00238     inline CoinTreeNode* top() const {
00239       if (size_ == 0 || candidateList_.size() == 0)
00240         return NULL;
00241 #ifdef DEBUG_PRINT
00242       char output[44];
00243       output[43] = 0;
00244      
candidateList_.front()->currentNode()->getPreferred().print(output);
00245       printf("top's pref: %s\n", output);
00246 #endif
00247       return candidateList_.front()->currentNode();
00248     }
================================================



Osman Y. Ozaltin
Graduate Student
1069 Benedum Hall
Department of Industrial Engineering
University of Pittsburgh
Pittsburgh PA 15261



More information about the BCP mailing list