From 354c2e48eba865dd4caaecccfe2d5af7506e3801 Mon Sep 17 00:00:00 2001 From: Stefan Vigerske Date: Tue, 4 Jul 2023 10:57:07 +0200 Subject: [PATCH] remove or disable unused-but-set variables - from clang 14.0.3 warnings --- Cbc/src/CbcCutGenerator.cpp | 8 ++--- Cbc/src/CbcFollowOn.cpp | 4 +++ Cbc/src/CbcHeuristic.cpp | 14 +++++++++ Cbc/src/CbcHeuristicDive.cpp | 12 +++++++- Cbc/src/CbcHeuristicDivePseudoCost.cpp | 6 ++++ Cbc/src/CbcHeuristicFPump.cpp | 10 ++++-- Cbc/src/CbcHeuristicGreedy.cpp | 18 ++++++++--- Cbc/src/CbcHeuristicRENS.cpp | 18 +++++++++++ Cbc/src/CbcLinked.cpp | 16 ++++++---- Cbc/src/CbcModel.cpp | 16 ++++++---- Cbc/src/CbcNode.cpp | 42 ++++++++++++++++---------- Cbc/src/CbcSolver.cpp | 4 +-- Cbc/src/CbcSolverAnalyze.cpp | 10 +++--- Cbc/src/CbcSolverHeuristics.cpp | 34 +++++++++++++++++++-- Cbc/src/CbcStrategy.cpp | 6 ++++ Cbc/src/CbcSymmetry.cpp | 6 ++++ 16 files changed, 175 insertions(+), 49 deletions(-) diff --git a/Cbc/src/CbcCutGenerator.cpp b/Cbc/src/CbcCutGenerator.cpp index 8b337ad36..da82b8222 100644 --- a/Cbc/src/CbcCutGenerator.cpp +++ b/Cbc/src/CbcCutGenerator.cpp @@ -791,7 +791,7 @@ bool CbcCutGenerator::generateCuts(OsiCuts &cs, int fullScan, OsiSolverInterface int nEls = 0; int nCuts = numberRowCutsAfter - numberRowCutsBefore; // Remove NULL cuts! - int nNull = 0; + //int nNull = 0; const double *solution = solver->getColSolution(); bool feasible = true; double primalTolerance = 1.0e-7; @@ -822,7 +822,7 @@ bool CbcCutGenerator::generateCuts(OsiCuts &cs, int fullScan, OsiSolverInterface } else { sum = 0.0; cs.eraseRowCut(k); - nNull++; + //nNull++; } } } @@ -996,7 +996,7 @@ bool CbcCutGenerator::generateCuts(OsiCuts &cs, int fullScan, OsiSolverInterface } CoinSort_2(sort, sort + nCuts, which); // Now see which ones are too similar - int nParallel = 0; + //int nParallel = 0; double testValue = (depth > 1) ? 0.99 : 0.999999; for (k = 0; k < nCuts; k++) { int j = which[k]; @@ -1048,7 +1048,7 @@ bool CbcCutGenerator::generateCuts(OsiCuts &cs, int fullScan, OsiSolverInterface if (fabs(ub - ubB) > tolerance) parallel = false; if (parallel) { - nParallel++; + //nParallel++; sort[k] = 0.0; break; } diff --git a/Cbc/src/CbcFollowOn.cpp b/Cbc/src/CbcFollowOn.cpp index 9538e1ab8..a8cf3130d 100644 --- a/Cbc/src/CbcFollowOn.cpp +++ b/Cbc/src/CbcFollowOn.cpp @@ -190,7 +190,9 @@ int CbcFollowOn::gutsOfFollowOn(int &otherRow, int &preferredWay) const #endif for (int k = 0; k < nSort - 1; k++) { i = sort[k]; +#if defined(COUNT) || !defined(NDEBUG) int numberUnsatisfied = 0; +#endif int n = 0; CoinBigIndex j; for (j = rowStart[i]; j < rowStart[i] + rowLength[i]; j++) { @@ -198,7 +200,9 @@ int CbcFollowOn::gutsOfFollowOn(int &otherRow, int &preferredWay) const if (columnLower[iColumn] != columnUpper[iColumn]) { double solValue = solution[iColumn] - columnLower[iColumn]; if (solValue < 1.0 - integerTolerance && solValue > integerTolerance) { +#if defined(COUNT) || !defined(NDEBUG) numberUnsatisfied++; +#endif for (CoinBigIndex jj = columnStart[iColumn]; jj < columnStart[iColumn] + columnLength[iColumn]; jj++) { int iRow = row[jj]; if (rhs_[iRow]) { diff --git a/Cbc/src/CbcHeuristic.cpp b/Cbc/src/CbcHeuristic.cpp index 687626750..75e126d49 100644 --- a/Cbc/src/CbcHeuristic.cpp +++ b/Cbc/src/CbcHeuristic.cpp @@ -1783,9 +1783,11 @@ CbcHeuristicNode::distance(const CbcHeuristicNode *node) const const double disjointWeight = 1; const double overlapWeight = 0.4; const double subsetWeight = 0.2; +#ifdef COIN_DETAIL int countDisjointWeight = 0; int countOverlapWeight = 0; int countSubsetWeight = 0; +#endif int i = 0; int j = 0; double dist = 0.0; @@ -1817,11 +1819,15 @@ CbcHeuristicNode::distance(const CbcHeuristicNode *node) const const int brComp = compare3BranchingObjects(br0, br1); if (brComp < 0) { dist += subsetWeight; +#ifdef COIN_DETAIL countSubsetWeight++; +#endif ++i; } else if (brComp > 0) { dist += subsetWeight; +#ifdef COIN_DETAIL countSubsetWeight++; +#endif ++j; } else { const int comp = br0->compareBranchingObject(br1, false); @@ -1831,16 +1837,22 @@ CbcHeuristicNode::distance(const CbcHeuristicNode *node) const break; case CbcRangeDisjoint: // disjoint decisions dist += disjointWeight; +#ifdef COIN_DETAIL countDisjointWeight++; +#endif break; case CbcRangeSubset: // subset one way or another case CbcRangeSuperset: dist += subsetWeight; +#ifdef COIN_DETAIL countSubsetWeight++; +#endif break; case CbcRangeOverlap: // overlap dist += overlapWeight; +#ifdef COIN_DETAIL countOverlapWeight++; +#endif break; } ++i; @@ -1848,7 +1860,9 @@ CbcHeuristicNode::distance(const CbcHeuristicNode *node) const } } dist += subsetWeight * (numObjects_ - i + node->numObjects_ - j); +#ifdef COIN_DETAIL countSubsetWeight += (numObjects_ - i + node->numObjects_ - j); +#endif COIN_DETAIL_PRINT(printf("subset = %i, overlap = %i, disjoint = %i\n", countSubsetWeight, countOverlapWeight, countDisjointWeight)); return dist; diff --git a/Cbc/src/CbcHeuristicDive.cpp b/Cbc/src/CbcHeuristicDive.cpp index 9eac8e91e..16851ded2 100644 --- a/Cbc/src/CbcHeuristicDive.cpp +++ b/Cbc/src/CbcHeuristicDive.cpp @@ -401,8 +401,8 @@ int CbcHeuristicDive::solution(double &solutionValue, int &numberNodes, int iteration = 0; int numberAtBoundFixed = 0; - int numberGeneralFixed = 0; // fixed as satisfied but not at bound #if DIVE_PRINT > 1 + int numberGeneralFixed = 0; // fixed as satisfied but not at bound int numberReducedCostFixed = 0; #endif while (numberFractionalVariables) { @@ -511,7 +511,9 @@ int CbcHeuristicDive::solution(double &solutionValue, int &numberNodes, #endif numberAtBoundFixed = 0; +#if DIVE_PRINT > 1 numberGeneralFixed = 0; // fixed as satisfied but not at bound +#endif #ifdef DIVE_FIX_BINARY_VARIABLES // fix binary variables based on pseudo reduced cost if (binVarIndex_.size()) { @@ -702,7 +704,9 @@ int CbcHeuristicDive::solution(double &solutionValue, int &numberNodes, solver->setColUpper(iColumn, lower[iColumn]); } else { // fix to interior value +#if DIVE_PRINT > 1 numberGeneralFixed++; +#endif double fixValue = floor(value + 0.5); columnFixed[numberAtBoundFixed] = iColumn; originalBound[numberAtBoundFixed] = upper[iColumn]; @@ -1518,14 +1522,18 @@ int CbcHeuristicDive::fixOtherVariables(OsiSolverInterface *solver, } int nOverGap = 0; #endif +#ifdef CLP_INVESTIGATE4 int numberFree = 0; int numberFixedAlready = 0; +#endif for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (!isHeuristicInteger(solver, iColumn)) continue; if (upper[iColumn] > lower[iColumn]) { +#ifdef CLP_INVESTIGATE4 numberFree++; +#endif double value = solution[iColumn]; if (fabs(floor(value + 0.5) - value) <= integerTolerance) { candidate[cnt].var = iColumn; @@ -1536,7 +1544,9 @@ int CbcHeuristicDive::fixOtherVariables(OsiSolverInterface *solver, #endif } } else { +#ifdef CLP_INVESTIGATE4 numberFixedAlready++; +#endif } } #ifdef GAP diff --git a/Cbc/src/CbcHeuristicDivePseudoCost.cpp b/Cbc/src/CbcHeuristicDivePseudoCost.cpp index 81e0c82fc..589353c6f 100644 --- a/Cbc/src/CbcHeuristicDivePseudoCost.cpp +++ b/Cbc/src/CbcHeuristicDivePseudoCost.cpp @@ -209,14 +209,18 @@ int CbcHeuristicDivePseudoCost::fixOtherVariables(OsiSolverInterface *solver, bool fixGeneralIntegers = (switches_ & 65536) != 0; // fix other integer variables that are at their bounds int cnt = 0; +#ifdef CLP_INVESTIGATE int numberFree = 0; int numberFixedAlready = 0; +#endif for (int i = 0; i < numberIntegers; i++) { int iColumn = integerVariable[i]; if (!isHeuristicInteger(solver, iColumn)) continue; if (upper[iColumn] > lower[iColumn]) { +#ifdef CLP_INVESTIGATE numberFree++; +#endif double value = solution[iColumn]; if (value - lower[iColumn] <= integerTolerance) { candidate[cnt].var = iColumn; @@ -235,7 +239,9 @@ int CbcHeuristicDivePseudoCost::fixOtherVariables(OsiSolverInterface *solver, * random[i]; } } else { +#ifdef CLP_INVESTIGATE numberFixedAlready++; +#endif } } #ifdef CLP_INVESTIGATE diff --git a/Cbc/src/CbcHeuristicFPump.cpp b/Cbc/src/CbcHeuristicFPump.cpp index 85bd8ade0..9b89afa8c 100644 --- a/Cbc/src/CbcHeuristicFPump.cpp +++ b/Cbc/src/CbcHeuristicFPump.cpp @@ -1099,7 +1099,9 @@ int CbcHeuristicFPump::solutionInternal(double &solutionValue, if (matched) break; } +#ifdef COIN_DEVELOP int numberPerturbed = 0; +#endif if (matched || numberPasses % 100 == 0) { // perturbation //sprintf(pumpPrint+strlen(pumpPrint)," perturbation applied"); @@ -1161,7 +1163,9 @@ int CbcHeuristicFPump::solutionInternal(double &solutionValue, double value = randomX[i]; double difference = fabs(solution[iColumn] - newSolution[iColumn]); if (difference + value * factor > 0.5) { +#ifdef COIN_DEVELOP numberPerturbed++; +#endif if (newSolution[iColumn] < lower[iColumn] + primalTolerance) { newSolution[iColumn] += 1.0; } else if (newSolution[iColumn] > upper[iColumn] - primalTolerance) { @@ -2878,24 +2882,24 @@ int CbcHeuristicFPump::rounds(OsiSolverInterface *solver, double *solution, double largestInfeasibility = primalTolerance; #ifdef JJF_ZERO double sumInfeasibility = 0.0; -#endif int numberBadRows = 0; +#endif for (i = 0; i < numberRows; i++) { double value; value = rowLower[i] - rowActivity[i]; if (value > primalTolerance) { - numberBadRows++; largestInfeasibility = CoinMax(largestInfeasibility, value); #ifdef JJF_ZERO sumInfeasibility += value; + numberBadRows++; #endif } value = rowActivity[i] - rowUpper[i]; if (value > primalTolerance) { - numberBadRows++; largestInfeasibility = CoinMax(largestInfeasibility, value); #ifdef JJF_ZERO sumInfeasibility += value; + numberBadRows++; #endif } } diff --git a/Cbc/src/CbcHeuristicGreedy.cpp b/Cbc/src/CbcHeuristicGreedy.cpp index 6c6cc97b2..4e24ebf7f 100644 --- a/Cbc/src/CbcHeuristicGreedy.cpp +++ b/Cbc/src/CbcHeuristicGreedy.cpp @@ -245,7 +245,7 @@ int CbcHeuristicGreedyCover::solution(double &solutionValue, // use current upper or original upper if (value + 0.99 < originalUpper[iColumn]) { double sum = 0.0; - int numberExact = 0; + //int numberExact = 0; for (j = columnStart[iColumn]; j < columnStart[iColumn] + columnLength[iColumn]; j++) { int iRow = row[j]; @@ -253,8 +253,8 @@ int CbcHeuristicGreedyCover::solution(double &solutionValue, double elementValue = allOnes ? 1.0 : element[j]; if (gap > 1.0e-7) { sum += CoinMin(elementValue, gap); - if (fabs(elementValue - gap) < 1.0e-7) - numberExact++; + //if (fabs(elementValue - gap) < 1.0e-7) + // numberExact++; } } // could bias if exact @@ -1259,7 +1259,10 @@ int CbcHeuristicGreedySOS::solution(double &solutionValue, CoinSort_2(contribution, contribution + numberColumns, which); // Go through columns int nAdded = 0; + //#define REPORT 1 +#ifdef REPORT int nSlacks = 0; +#endif for (int jColumn = 0; jColumn < numberColumns; jColumn++) { if (contribution[jColumn] >= 1.0e30) break; @@ -1281,7 +1284,6 @@ int CbcHeuristicGreedySOS::solution(double &solutionValue, } } if (possible) { - //#define REPORT 1 #ifdef REPORT if ((nAdded % 1000) == 0) { double gap = 0.0; @@ -1295,8 +1297,10 @@ int CbcHeuristicGreedySOS::solution(double &solutionValue, } #endif nAdded++; +#ifdef REPORT if (columnLength[iColumn] == 1) nSlacks++; +#endif // Increase chosen column newSolution[iColumn] = 1.0; double cost = modifiedCost[iColumn]; @@ -1375,8 +1379,10 @@ int CbcHeuristicGreedySOS::solution(double &solutionValue, // get list of columns which can go down without making // things much worse int nPossible = 0; +#ifdef REPORT int nEasyDown = 0; int nSlackDown = 0; +#endif for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (newSolution[iColumn] && columnUpper[iColumn] > columnLower[iColumn]) { bool canGoDown = true; @@ -1429,12 +1435,14 @@ int CbcHeuristicGreedySOS::solution(double &solutionValue, int iRow = row[j]; rowActivity[iRow] += element[j]; } +#ifdef REPORT nEasyDown++; if (columnLength[iColumn] > 1) { //printf("%d is easy down\n",iColumn); } else { nSlackDown++; } +#endif } } else if (modifiedCost[iColumn] > 0.0) { // easy down @@ -1446,7 +1454,9 @@ int CbcHeuristicGreedySOS::solution(double &solutionValue, int iRow = row[j]; rowActivity[iRow] -= element[j]; } +#ifdef REPORT nEasyDown++; +#endif } } else { which[nPossible++] = iColumn; diff --git a/Cbc/src/CbcHeuristicRENS.cpp b/Cbc/src/CbcHeuristicRENS.cpp index 518e48486..87c240925 100644 --- a/Cbc/src/CbcHeuristicRENS.cpp +++ b/Cbc/src/CbcHeuristicRENS.cpp @@ -729,8 +729,10 @@ int CbcHeuristicRENS::solution(double &solutionValue, solver->getDblParam(OsiPrimalTolerance, primalTolerance); int i; +#ifdef CLP_INVESTIGATE2 int numberTightened = 0; int numberAtBound = 0; +#endif int numberContinuous = numberColumns - numberIntegers; /* 0 - allow fixing @@ -784,13 +786,19 @@ int CbcHeuristicRENS::solution(double &solutionValue, if (dontFix) { continue; } +#ifdef CLP_INVESTIGATE2 if (value == lower || value == upper) numberAtBound++; +#endif newSolver->setColLower(iColumn, value); newSolver->setColUpper(iColumn, value); +#ifdef CLP_INVESTIGATE2 numberFixed++; +#endif } else if (colUpper[iColumn] - colLower[iColumn] >= 2.0) { +#ifdef CLP_INVESTIGATE2 numberTightened++; +#endif newSolver->setColLower(iColumn, floor(value)); newSolver->setColUpper(iColumn, ceil(value)); } @@ -800,7 +808,9 @@ int CbcHeuristicRENS::solution(double &solutionValue, continue; } value = floor(value + 0.5); +#ifdef CLP_INVESTIGATE2 numberAtBound++; +#endif newSolver->setColLower(iColumn, value); newSolver->setColUpper(iColumn, value); numberFixed++; @@ -809,12 +819,16 @@ int CbcHeuristicRENS::solution(double &solutionValue, if (dontFix) { continue; } +#ifdef CLP_INVESTIGATE2 numberAtBound++; +#endif newSolver->setColLower(iColumn, value); newSolver->setColUpper(iColumn, value); numberFixed++; } else if (colUpper[iColumn] - colLower[iColumn] >= 2.0 && djTolerance < 0.0) { +#ifdef CLP_INVESTIGATE2 numberTightened++; +#endif if (fabs(value - floor(value + 0.5)) < 1.0e-8) { value = floor(value + 0.5); if (value < upper) { @@ -956,8 +970,10 @@ int CbcHeuristicRENS::solution(double &solutionValue, #endif for (int iPass = 0; iPass < RENS_PASS; iPass++) { int nFixed = 0; +#ifdef CLP_INVESTIGATE2 int nFixedAlready = 0; int nFixedContinuous = 0; +#endif for (int iColumn = 0; iColumn < numberColumns; iColumn++) { if (colUpper[iColumn] > colLower[iColumn]) { if (newSolver->isInteger(iColumn)) { @@ -970,10 +986,12 @@ int CbcHeuristicRENS::solution(double &solutionValue, newSolver->setColUpper(iColumn, fixTo); } } +#ifdef CLP_INVESTIGATE2 } else if (newSolver->isInteger(iColumn)) { nFixedAlready++; } else { nFixedContinuous++; +#endif } } #ifdef CLP_INVESTIGATE2 diff --git a/Cbc/src/CbcLinked.cpp b/Cbc/src/CbcLinked.cpp index 6e7a7aa42..d725738eb 100644 --- a/Cbc/src/CbcLinked.cpp +++ b/Cbc/src/CbcLinked.cpp @@ -529,13 +529,17 @@ void OsiSolverLink::resolve() } else if (satisfied == 2) { // is there anything left to do? int i; +#if 0 int numberContinuous = 0; +#endif double gap = 0.0; for (i = 0; i < numberObjects_; i++) { OsiBiLinear *obj = dynamic_cast< OsiBiLinear * >(object_[i]); if (obj) { if (obj->xMeshSize() < 1.0 && obj->yMeshSize() < 1.0) { +#if 0 numberContinuous++; +#endif int xColumn = obj->xColumn(); double gapX = upper[xColumn] - lower[xColumn]; int yColumn = obj->yColumn(); @@ -987,7 +991,6 @@ void OsiSolverLink::load(CoinModel &coinModelOriginal, bool tightenBounds, int l for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinModelLink triple = coinModelOriginal.firstInColumn(iColumn); bool linear = true; - int n = 0; // See if quadratic objective const char *expr = coinModelOriginal.getColumnObjectiveAsString(iColumn); if (strcmp(expr, "Numeric")) { @@ -1000,7 +1003,6 @@ void OsiSolverLink::load(CoinModel &coinModelOriginal, bool tightenBounds, int l linear = false; } triple = coinModelOriginal.next(triple); - n++; } if (!linear) { which[numberVariables_++] = iColumn; @@ -1472,7 +1474,6 @@ void OsiSolverLink::load(CoinModel &coinModelOriginal, bool tightenBounds, int l } } // See if there are any quadratic bounds - int nQ = 0; const CoinPackedMatrix *rowCopy = getMatrixByRow(); //const double * element = rowCopy->getElements(); //const int * column = rowCopy->getIndices(); @@ -1486,7 +1487,6 @@ void OsiSolverLink::load(CoinModel &coinModelOriginal, bool tightenBounds, int l int xyRow = obj->xyRow(); if (rowLength[xyRow] == 4 && false) { // we have simple bound - nQ++; double coefficient = obj->coefficient(); double lo = rowLower[xyRow]; double up = rowUpper[xyRow]; @@ -1863,7 +1863,6 @@ OsiSolverLink::nonlinearSLP(int numberPasses, double deltaTolerance) for (iColumn = 0; iColumn < numberColumns; iColumn++) { CoinModelLink triple = coinModel.firstInColumn(iColumn); bool linear = true; - int n = 0; // See if nonlinear objective const char *expr = coinModel.getColumnObjectiveAsString(iColumn); if (strcmp(expr, "Numeric")) { @@ -1913,7 +1912,6 @@ OsiSolverLink::nonlinearSLP(int numberPasses, double deltaTolerance) } } triple = coinModel.next(triple); - n++; } if (!linear) { markNonlinear[iColumn] = 1; @@ -2226,8 +2224,10 @@ OsiSolverLink::nonlinearSLP(int numberPasses, double deltaTolerance) } double maxGap = 0.0; int numberSmaller = 0; +#ifdef CLP_DEBUG int numberSmaller2 = 0; int numberLarger = 0; +#endif for (jNon = 0; jNon < numberNonLinearColumns; jNon++) { iColumn = listNonLinearColumn[jNon]; maxDelta = CoinMax(maxDelta, @@ -2236,11 +2236,15 @@ OsiSolverLink::nonlinearSLP(int numberPasses, double deltaTolerance) if (last[0][jNon] * last[1][jNon] < 0) { // halve trust[jNon] *= 0.5; +#ifdef CLP_DEBUG numberSmaller2++; +#endif } else { if (last[0][jNon] == last[1][jNon] && last[0][jNon] == last[2][jNon]) trust[jNon] = CoinMin(1.5 * trust[jNon], 1.0e6); +#ifdef CLP_DEBUG numberLarger++; +#endif } } else if (goodMove != -2 && trust[jNon] > 10.0 * deltaTolerance) { trust[jNon] *= 0.2; diff --git a/Cbc/src/CbcModel.cpp b/Cbc/src/CbcModel.cpp index e49c8699a..ed7fde0d9 100644 --- a/Cbc/src/CbcModel.cpp +++ b/Cbc/src/CbcModel.cpp @@ -810,12 +810,16 @@ void CbcModel::analyzeObjective() // now look at continuous bool allGood = true; double direction = solver_->getObjSense(); +#if COIN_DEVELOP > 1 int numberObj = 0; +#endif for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (upper[iColumn] > lower[iColumn]) { double objValue = objective[iColumn] * direction; if (objValue && !solver_->isInteger(iColumn)) { +#if COIN_DEVELOP > 1 numberObj++; +#endif CoinBigIndex start = columnStart[iColumn]; CoinBigIndex end = start + columnLength[iColumn]; if (objValue > 0.0) { @@ -7744,13 +7748,13 @@ int CbcModel::addCuts(CbcNode *node, CoinWarmStartBasis *&lastws) int i1 = 0; int i2 = 0; int nDiff = 0; - int nSame = 0; + //int nSame = 0; if (lastNumberCuts2_ == numberToAdd) { for (int i = 0; i < numberToCheck; i++) { if (lastCut_[i1++] != addCuts[i2++]) { nDiff++; } else { - nSame++; + //nSame++; } } } else if (lastNumberCuts2_ > numberToAdd) { @@ -7762,14 +7766,14 @@ int CbcModel::addCuts(CbcNode *node, CoinWarmStartBasis *&lastws) i1++; nDiff2--; if (lastCut_[i1] == addCuts[i2]) { - nSame++; + //nSame++; break; } else { nDiff++; } } } else { - nSame++; + //nSame++; } } nDiff += nDiff2; @@ -7782,14 +7786,14 @@ int CbcModel::addCuts(CbcNode *node, CoinWarmStartBasis *&lastws) i2++; nDiff2--; if (lastCut_[i1] == addCuts[i2]) { - nSame++; + //nSame++; break; } else { nDiff++; } } } else { - nSame++; + //nSame++; } } nDiff += nDiff2; diff --git a/Cbc/src/CbcNode.cpp b/Cbc/src/CbcNode.cpp index 348452baf..46fe12f2a 100644 --- a/Cbc/src/CbcNode.cpp +++ b/Cbc/src/CbcNode.cpp @@ -583,23 +583,25 @@ int CbcNode::chooseBranch(CbcModel *model, CbcNode *lastNode, int numberPassesLe numberStrong = 0; if ((model->moreSpecialOptions() & 1024) != 0 || true) { int nBad = 0; +#ifdef CLP_INVESTIGATE int nUnsat = 0; int nDiff = 0; +#endif for (int i = 0; i < numberObjects; i++) { OsiObject *object = model->modifiableObject(i); const CbcSimpleInteger *thisOne = dynamic_cast< const CbcSimpleInteger * >(object); if (thisOne) { int iColumn = thisOne->columnNumber(); double targetValue = hotstartSolution[iColumn]; +#ifdef CLP_INVESTIGATE double value = saveSolution[iColumn]; if (fabs(value - floor(value + 0.5)) > 1.0e-6) { nUnsat++; -#ifdef CLP_INVESTIGATE printf("H %d is %g target %g\n", iColumn, value, targetValue); -#endif } else if (fabs(targetValue - value) > 1.0e-6) { nDiff++; } +#endif if (targetValue < saveLower[iColumn] || targetValue > saveUpper[iColumn]) { #ifdef CLP_INVESTIGATE printf("%d has target %g and current bounds %g and %g\n", @@ -622,7 +624,7 @@ int CbcNode::chooseBranch(CbcModel *model, CbcNode *lastNode, int numberPassesLe } } int numberStrongDone = 0; - int numberUnfinished = 0; + //int numberUnfinished = 0; int numberStrongInfeasible = 0; int numberStrongIterations = 0; int saveNumberStrong = numberStrong; @@ -647,7 +649,7 @@ int CbcNode::chooseBranch(CbcModel *model, CbcNode *lastNode, int numberPassesLe estimatedDegradation = 0.0; //int numberIntegerInfeasibilities=0; // without odd ones numberStrongDone = 0; - numberUnfinished = 0; + //numberUnfinished = 0; numberStrongInfeasible = 0; numberStrongIterations = 0; @@ -1186,7 +1188,7 @@ int CbcNode::chooseBranch(CbcModel *model, CbcNode *lastNode, int numberPassesLe } else { // Can't say much as we did not finish choice[i].finishedDown = false; - numberUnfinished++; + //numberUnfinished++; } choice[i].downMovement = objectiveChange; @@ -1293,7 +1295,7 @@ int CbcNode::chooseBranch(CbcModel *model, CbcNode *lastNode, int numberPassesLe } else { // Can't say much as we did not finish choice[i].finishedUp = false; - numberUnfinished++; + //numberUnfinished++; } choice[i].upMovement = objectiveChange; @@ -1730,23 +1732,25 @@ int CbcNode::chooseDynamicBranch(CbcModel *model, CbcNode *lastNode, if (hotstartSolution) { if ((model->moreSpecialOptions() & 1024) != 0 || true) { int nBad = 0; +#ifdef CLP_INVESTIGATE int nUnsat = 0; int nDiff = 0; +#endif for (int i = 0; i < numberObjects; i++) { OsiObject *object = model->modifiableObject(i); const CbcSimpleInteger *thisOne = dynamic_cast< const CbcSimpleInteger * >(object); if (thisOne) { int iColumn = thisOne->columnNumber(); double targetValue = hotstartSolution[iColumn]; +#ifdef CLP_INVESTIGATE double value = saveSolution[iColumn]; if (fabs(value - floor(value + 0.5)) > 1.0e-6) { nUnsat++; -#ifdef CLP_INVESTIGATE printf("H %d is %g target %g\n", iColumn, value, targetValue); -#endif } else if (fabs(targetValue - value) > 1.0e-6) { nDiff++; } +#endif if (targetValue < saveLower[iColumn] || targetValue > saveUpper[iColumn]) { #ifdef CLP_INVESTIGATE printf("%d has target %g and current bounds %g and %g\n", @@ -1775,7 +1779,7 @@ int CbcNode::chooseDynamicBranch(CbcModel *model, CbcNode *lastNode, CbcBranchDecision *decision = model->branchingMethod(); if (!decision) decision = new CbcBranchDynamicDecision(); - int xMark = 0; + //int xMark = 0; // Get arrays to sort double *sort = new double[numberObjects]; #ifndef COIN_HAS_NTY @@ -2351,9 +2355,11 @@ int CbcNode::chooseDynamicBranch(CbcModel *model, CbcNode *lastNode, const int *row = model->solver()->getMatrixByCol()->getIndices(); const CoinBigIndex *columnStart = model->solver()->getMatrixByCol()->getVectorStarts(); const int *columnLength = model->solver()->getMatrixByCol()->getVectorLengths(); +#ifdef CLP_INVESTIGATE int nFree = 0; - int nFreeNon = 0; int nFixedNon = 0; +#endif + int nFreeNon = 0; double mostAway = 0.0; int whichAway = -1; const double *columnLower = solver->getColLower(); @@ -2376,10 +2382,14 @@ int CbcNode::chooseDynamicBranch(CbcModel *model, CbcNode *lastNode, whichAway = i; } } else { +#ifdef CLP_INVESTIGATE nFree++; +#endif } } else if (solution[i] != saveSolution[i]) { +#ifdef CLP_INVESTIGATE nFixedNon++; +#endif } } const double *lower = solver->getRowLower(); @@ -2658,7 +2668,7 @@ int CbcNode::chooseDynamicBranch(CbcModel *model, CbcNode *lastNode, #endif } doneHotStart = true; - xMark++; + //xMark++; kPass++; osiclp->passInRanges(NULL); const double *downCost = osiclp->upRange(); @@ -3128,7 +3138,7 @@ int CbcNode::chooseDynamicBranch(CbcModel *model, CbcNode *lastNode, skipAll = -2; canSkip = 1; } - xMark++; + //xMark++; } } if (!canSkip) { @@ -3386,7 +3396,7 @@ int CbcNode::chooseDynamicBranch(CbcModel *model, CbcNode *lastNode, skipAll = -2; canSkip = 1; } - xMark++; + //xMark++; } #if 0 //def DO_ALL_AT_ROOT if (strongType) @@ -3625,7 +3635,7 @@ int CbcNode::chooseDynamicBranch(CbcModel *model, CbcNode *lastNode, skipAll = -2; canSkip = 1; } - xMark++; + //xMark++; } #if 0 //def DO_ALL_AT_ROOT @@ -3786,7 +3796,7 @@ int CbcNode::chooseDynamicBranch(CbcModel *model, CbcNode *lastNode, skipAll = -2; canSkip = 1; } - xMark++; + //xMark++; // may be infeasible (if other way stopped on iterations) if (goneInfeasible) { // neither side feasible @@ -3848,7 +3858,7 @@ int CbcNode::chooseDynamicBranch(CbcModel *model, CbcNode *lastNode, skipAll = -2; canSkip = 1; } - xMark++; + //xMark++; // may be infeasible (if other way stopped on iterations) if (goneInfeasible) { // neither side feasible diff --git a/Cbc/src/CbcSolver.cpp b/Cbc/src/CbcSolver.cpp index 4a5a9f231..1d53e63c8 100644 --- a/Cbc/src/CbcSolver.cpp +++ b/Cbc/src/CbcSolver.cpp @@ -8894,7 +8894,7 @@ int CbcMain1(int argc, const char *argv[], int nBadDir = 0; int nBadPri = 0; int nBadName = 0; - int nBadLine = 0; + //int nBadLine = 0; int nLine = 0; iColumn = -1; int lowestPriority = -COIN_INT_MAX; @@ -8938,7 +8938,7 @@ int CbcMain1(int argc, const char *argv[], if (comma) { *comma = '\0'; } else if (i < nAcross - 1) { - nBadLine++; + //nBadLine++; break; } switch (order[i]) { diff --git a/Cbc/src/CbcSolverAnalyze.cpp b/Cbc/src/CbcSolverAnalyze.cpp index c73d6a36f..82ffab5da 100644 --- a/Cbc/src/CbcSolverAnalyze.cpp +++ b/Cbc/src/CbcSolverAnalyze.cpp @@ -70,11 +70,11 @@ int *analyze(OsiClpSolverInterface *solverMod, int &numberChanged, memset(changeRhs, 0, numberRows * sizeof(double)); memset(ignore, 0, numberRows); numberChanged = 0; - int numberInteger = 0; - for (iColumn = 0; iColumn < numberColumns; iColumn++) { - if (upper[iColumn] > lower[iColumn] + 1.0e-8 && solver->isInteger(iColumn)) - numberInteger++; - } + //int numberInteger = 0; + //for (iColumn = 0; iColumn < numberColumns; iColumn++) { + // if (upper[iColumn] > lower[iColumn] + 1.0e-8 && solver->isInteger(iColumn)) + // numberInteger++; + //} bool finished = false; while (!finished) { int saveNumberChanged = numberChanged; diff --git a/Cbc/src/CbcSolverHeuristics.cpp b/Cbc/src/CbcSolverHeuristics.cpp index 913eb3bde..ed832d1a9 100644 --- a/Cbc/src/CbcSolverHeuristics.cpp +++ b/Cbc/src/CbcSolverHeuristics.cpp @@ -134,22 +134,32 @@ fixVubs(CbcModel &model, int skipZero2, saveUB = CoinCopyOfArray(columnUpper, numberColumns); const double *objective = originalLpSolver->getObjCoefficients(); int iColumn; +#ifdef COIN_DETAIL int nFix = 0; int nArt = 0; +#endif for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (objective[iColumn] > fixAbove) { if (solution[iColumn] < columnLower[iColumn] + 1.0e-8) { columnUpper[iColumn] = columnLower[iColumn]; +#ifdef COIN_DETAIL nFix++; +#endif } else { +#ifdef COIN_DETAIL nArt++; +#endif } } else if (objective[iColumn] < -fixAbove) { if (solution[iColumn] > columnUpper[iColumn] - 1.0e-8) { columnLower[iColumn] = columnUpper[iColumn]; +#ifdef COIN_DETAIL nFix++; +#endif } else { +#ifdef COIN_DETAIL nArt++; +#endif } } } @@ -543,11 +553,15 @@ fixVubs(CbcModel &model, int skipZero2, memset(countsI, 0, nCheck * sizeof(int)); memset(countsC, 0, nCheck * sizeof(int)); check[nCheck - 1] = numberColumns; +#ifdef COIN_DETAIL int numberLayered = 0; int numberInteger = 0; +#endif for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (fix[iColumn] == jLayer) { +#ifdef COIN_DETAIL numberLayered++; +#endif int nFix = static_cast< int >(fixColumn[iColumn + 1] - fixColumn[iColumn]); if (iPass) { // just integers @@ -565,7 +579,9 @@ fixVubs(CbcModel &model, int skipZero2, } assert(iFix < nCheck); if (clpSolver->isInteger(iColumn)) { +#ifdef COIN_DETAIL numberInteger++; +#endif countsI[iFix]++; } else { countsC[iFix]++; @@ -640,8 +656,10 @@ fixVubs(CbcModel &model, int skipZero2, double smallest = 1.1; int iLargest = -1; int iSmallest = -1; +#ifdef COIN_DETAIL int atZero = 0; int atOne = 0; +#endif int toZero = 0; int toOne = 0; int numberFree = 0; @@ -755,10 +773,12 @@ fixVubs(CbcModel &model, int skipZero2, double lower = columnLower[iColumn]; double upper = columnUpper[iColumn]; if (lower == upper) { +#ifdef COIN_DETAIL if (lower) atOne++; else atZero++; +#endif continue; } if (value < 1.0e-7) { @@ -933,12 +953,12 @@ fixVubs(CbcModel &model, int skipZero2, assert(fullSolution[iColumn] < 0.1); assert(!columnUpper[iColumn]); double otherValue = 0.0; - int nn = 0; + //int nn = 0; for (CoinBigIndex i = fixColumn[iColumn]; i < fixColumn[iColumn + 1]; i++) { int jColumn = otherColumn[i]; if (columnUpper[jColumn] == 0.0) { if (dj[jColumn] < -1.0e-5) { - nn++; + //nn++; otherValue += dj[jColumn]; // really need to look at rest } } @@ -973,14 +993,18 @@ fixVubs(CbcModel &model, int skipZero2, memcpy(columnLower, originalColumnLower, numberColumns * sizeof(double)); memcpy(columnUpper, originalColumnUpper, numberColumns * sizeof(double)); int nFixed = 0; +#ifdef COIN_DETAIL int nFixed0 = 0; int nFixed1 = 0; +#endif for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (state[iColumn] == 0 || state[iColumn] == 10) { columnUpper[iColumn] = 0.0; assert(lo[iColumn] == 0.0); nFixed++; +#ifdef COIN_DETAIL nFixed0++; +#endif for (CoinBigIndex i = fixColumn[iColumn]; i < fixColumn[iColumn + 1]; i++) { int jColumn = otherColumn[i]; if (columnUpper[jColumn]) { @@ -1001,7 +1025,9 @@ fixVubs(CbcModel &model, int skipZero2, } } else if (state[iColumn] == 1) { columnLower[iColumn] = 1.0; +#ifdef COIN_DETAIL nFixed1++; +#endif } } COIN_DETAIL_PRINT(printf("%d fixed %d orig 0 %d 1\n", nFixed, nFixed0, nFixed1)); @@ -1050,13 +1076,17 @@ fixVubs(CbcModel &model, int skipZero2, } COIN_DETAIL_PRINT(printf("This fixes %d variables in lower priorities - total %d (%d integer) - all target %d, int target %d\n", nTotalFixed, nFixed, nFixedI, static_cast< int >(fractionFixed * numberColumns), static_cast< int >(fractionIntFixed * numberInteger))); +#ifndef NDEBUG int nBad = 0; +#endif int nRelax = 0; for (iColumn = 0; iColumn < numberColumns; iColumn++) { if (lo[iColumn] < columnLower[iColumn] || up[iColumn] > columnUpper[iColumn]) { COIN_DETAIL_PRINT(printf("bad %d old %g %g, new %g %g\n", iColumn, lo[iColumn], up[iColumn], columnLower[iColumn], columnUpper[iColumn])); +#ifndef NDEBUG nBad++; +#endif } if (lo[iColumn] > columnLower[iColumn] || up[iColumn] < columnUpper[iColumn]) { nRelax++; diff --git a/Cbc/src/CbcStrategy.cpp b/Cbc/src/CbcStrategy.cpp index 87a2af472..eb761fdc1 100644 --- a/Cbc/src/CbcStrategy.cpp +++ b/Cbc/src/CbcStrategy.cpp @@ -382,7 +382,9 @@ void CbcStrategyDefault::setupOther(CbcModel &model) //const int * row = matrix->getIndices(); const CoinBigIndex *columnStart = matrix->getVectorStarts(); const int *columnLength = matrix->getVectorLengths(); +#ifdef COIN_DETAIL int numberInt = 0; +#endif int numberNon = 0; int numberClose = 0; int numberColumns = clpSolver->getNumCols(); @@ -396,13 +398,17 @@ void CbcStrategyDefault::setupOther(CbcModel &model) if (value > 1.0e7) { if (value != floor(value)) numberNon++; +#ifdef COIN_DETAIL else numberInt++; +#endif } else { int iValue = static_cast< int >(100 * (value + 0.005)); double value2 = iValue; if (value2 == 100.0 * value) { +#ifdef COIN_DETAIL numberInt++; +#endif } else if (fabs(value2 - 100.0 * value) < 1.0e-5) { numberClose++; } else { diff --git a/Cbc/src/CbcSymmetry.cpp b/Cbc/src/CbcSymmetry.cpp index 4f68d9bb8..3454a7c8a 100644 --- a/Cbc/src/CbcSymmetry.cpp +++ b/Cbc/src/CbcSymmetry.cpp @@ -94,7 +94,9 @@ static void userautomproc(int numGenerators, int firstL=-1; for (int i = 0; i < n; ++i) { if (workperm[i] == 0 && perm[i] != i) { +#ifndef NDEBUG int nRow=0; +#endif int nCol=0; int l = i; if (l