In the code below, the numberIntegers variable taken from the current model is sometimes (in really rare cases) bigger than the space allocated for downLocks table (used later), thus giving some runetime memory access exceptions. I checked this creating additional field holding the real size of the downLocks_ table, and comparing it to the numberIntegers variable.
Program compiled under MSVC 2008. NOT parallel version of the CBC. I haven't noticed the behaviour in gcc.
Best regards, Tomasz Sliwinski
bool
69 CbcHeuristicDiveCoefficient::selectVariableToBranch(OsiSolverInterface? solver, 70 const double newSolution, 71 int& bestColumn, 72 int& bestRound) 73 { 74 int numberIntegers = model->numberIntegers(); 75 const int * integerVariable = model->integerVariable(); 76 double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance?); 77 78 bestColumn = -1; 79 bestRound = -1; -1 rounds down, +1 rounds up 80 double bestFraction = DBL_MAX; 81 int bestLocks = COIN_INTMAX; 82 bool allTriviallyRoundableSoFar = true; 83 for (int i = 0; i < numberIntegers; i++) { 84 int iColumn = integerVariable[i]; 85 double value = newSolution[iColumn]; 86 double fraction = value - floor(value); 87 int round = 0; 88 if (fabs(floor(value + 0.5) - value) > integerTolerance) { 89 int nDownLocks = downLocks[i]; 90 int nUpLocks = upLocks_[i];
In the code below, the numberIntegers variable taken from the current model is sometimes (in really rare cases) bigger than the space allocated for downLocks table (used later), thus giving some runetime memory access exceptions. I checked this creating additional field holding the real size of the downLocks_ table, and comparing it to the numberIntegers variable.
Program compiled under MSVC 2008. NOT parallel version of the CBC. I haven't noticed the behaviour in gcc.
Best regards, Tomasz Sliwinski
bool
69 CbcHeuristicDiveCoefficient::selectVariableToBranch(OsiSolverInterface? solver, 70 const double newSolution, 71 int& bestColumn, 72 int& bestRound) 73 { 74 int numberIntegers = model->numberIntegers(); 75 const int * integerVariable = model->integerVariable(); 76 double integerTolerance = model_->getDblParam(CbcModel::CbcIntegerTolerance?); 77 78 bestColumn = -1; 79 bestRound = -1; -1 rounds down, +1 rounds up 80 double bestFraction = DBL_MAX; 81 int bestLocks = COIN_INTMAX; 82 bool allTriviallyRoundableSoFar = true; 83 for (int i = 0; i < numberIntegers; i++) { 84 int iColumn = integerVariable[i]; 85 double value = newSolution[iColumn]; 86 double fraction = value - floor(value); 87 int round = 0; 88 if (fabs(floor(value + 0.5) - value) > integerTolerance) { 89 int nDownLocks = downLocks[i]; 90 int nUpLocks = upLocks_[i];