Skip to content

Commit

Permalink
remove or disable more set-but-unused variables
Browse files Browse the repository at this point in the history
- from clang 14.0.3 warnings
  • Loading branch information
svigerske committed Jul 4, 2023
1 parent 0e9a47e commit 0e35723
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 16 deletions.
6 changes: 3 additions & 3 deletions CoinUtils/src/CoinLpIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1090,15 +1090,15 @@ int CoinLpIO::writeLp(FILE *fp, const bool useRowNames)

fprintf(fp, "Subject To\n");

int cnt_out_rows = 0;
//int cnt_out_rows = 0;

for (i = 0; i < nrow; i++) {
cnt_print = 0;

if (useRowNames) {
fprintf(fp, "%s: ", rowNames[i]);
}
cnt_out_rows++;
//cnt_out_rows++;

for (j = matrixByRow_->getVectorFirst(i);
j < matrixByRow_->getVectorLast(i); j++) {
Expand Down Expand Up @@ -1132,7 +1132,7 @@ int CoinLpIO::writeLp(FILE *fp, const bool useRowNames)
if (useRowNames) {
fprintf(fp, "%s_low:", rowNames[i]);
}
cnt_out_rows++;
//cnt_out_rows++;

for (j = matrixByRow_->getVectorFirst(i);
j < matrixByRow_->getVectorLast(i); j++) {
Expand Down
4 changes: 3 additions & 1 deletion CoinUtils/src/CoinOslFactorization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ void CoinOslFactorization::makeNonSingular(int *sequence, int numberColumns)
//printf("nr %d nc %d\n",nr,nc);
#ifndef NDEBUG
bool goodPass = true;
#endif
int numberDone = 0;
#endif
for (int i = 0; i < numberRows_; i++) {
int cRow = (-clink[i].pre) - 1;
if (cRow == numberRows_ || cRow < 0) {
Expand All @@ -303,7 +303,9 @@ void CoinOslFactorization::makeNonSingular(int *sequence, int numberColumns)
if (nextRow < numberRows_) {
sequence[i] = nextRow + numberColumns;
nextRow++;
#ifndef NDEBUG
numberDone++;
#endif
} else {
#ifndef NDEBUG
goodPass = false;
Expand Down
4 changes: 4 additions & 0 deletions CoinUtils/src/CoinPackedMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2208,7 +2208,9 @@ CoinPackedMatrix::CoinPackedMatrix(const CoinPackedMatrix &rhs,
const CoinBigIndex *oldStart = rhs.start_;
const int *oldIndex = rhs.index_;
const int *oldLength = rhs.length_;
#ifndef NDEBUG
CoinBigIndex tooSmallCount = 0;
#endif
for (int i = 0; i < majorDim_; i++) {
start_[i] = size;
for (CoinBigIndex j = oldStart[i];
Expand All @@ -2218,7 +2220,9 @@ CoinPackedMatrix::CoinPackedMatrix(const CoinPackedMatrix &rhs,
element_[size] = value;
index_[size++] = oldIndex[j];
} else {
#ifndef NDEBUG
tooSmallCount++;
#endif
}
}
length_[i] = static_cast< int >(size - start_[i]);
Expand Down
24 changes: 15 additions & 9 deletions CoinUtils/src/CoinPresolveDual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ const CoinPresolveAction
*/
char *active = reinterpret_cast< char * >(prob->usefulColumnInt_);
memset(active, 0, ncols);
int nOneBound = 0;
//int nOneBound = 0;
int numberLook = prob->numberColsToDo_;
int *look = prob->colsToDo_;
for (int iLook = 0; iLook < numberLook; iLook++) {
Expand All @@ -221,11 +221,11 @@ const CoinPresolveAction
else
type = 4;
}
if (type == 1 || type == 2)
nOneBound++;
//if (type == 1 || type == 2)
// nOneBound++;
active[j] = type;
}
int nFreed = 0;
//int nFreed = 0;
#define USE_ACTIVE 1
//#define PRESOLVE_DEBUG 2
for (int i = 0; i < nrows; i++) {
Expand Down Expand Up @@ -333,7 +333,7 @@ const CoinPresolveAction
#endif
doneSomething = true;
active[icol] = 2 + 8;
nFreed++;
//nFreed++;
#define TRY_UPPER 3
#if TRY_UPPER > 1
} else if (impliedUpper < ub + 1.0e-7) {
Expand All @@ -352,7 +352,7 @@ const CoinPresolveAction
#if TRY_UPPER > 2
doneSomething = true;
active[icol] = 1 + 8;
nFreed++;
//nFreed++;
#endif
#endif
} else {
Expand Down Expand Up @@ -445,7 +445,7 @@ const CoinPresolveAction
printf("second type can take off lb of %g on column %d as implied lower %g - effective upper %g, coeff %g on row %d\n", lb, icol, impliedLower, maxUp, coeff, i);
#endif
active[icol] = 2 + 8;
nFreed++;
//nFreed++;
#if 0 //TRY_UPPER
} else if (impliedLower>lb-1.0e-7 ) {
printf("second type can't take off lb of %g on column %d as implied lower %g - effective upper %g, coeff %g on row %d\n",lb,icol,impliedLower,maxUp,coeff,i);
Expand All @@ -467,7 +467,7 @@ const CoinPresolveAction
#if TRY_UPPER > 2
doneSomething = true;
active[icol] = 1 + 8;
nFreed++;
//nFreed++;
#endif
#endif
}
Expand Down Expand Up @@ -585,7 +585,9 @@ const CoinPresolveAction
int nflagu = 0;
int nflagl = 0;
// Number of ordinary rows
#if PROCESS_INFINITE_LB
int nordu = 0;
#endif
int nordl = 0;
double cbarjmin = cost[j];
double cbarjmax = cbarjmin;
Expand All @@ -598,7 +600,9 @@ const CoinPresolveAction
if (aij > 0.0) {
if (ymin[i] >= -ekkinf2) {
cbarjmax -= mindelta;
#if PROCESS_INFINITE_LB
nordu++;
#endif
} else {
nflagu++;
}
Expand All @@ -611,7 +615,9 @@ const CoinPresolveAction
} else {
if (ymax[i] <= ekkinf2) {
cbarjmax -= maxdelta;
#if PROCESS_INFINITE_LB
nordu++;
#endif
} else {
nflagu++;
}
Expand Down Expand Up @@ -1429,7 +1435,7 @@ const CoinPresolveAction
#endif
}
}
#if 1 // PRESOLVE_DEBUG > 0
#if PRESOLVE_DEBUG > 0
int makeEqCandCnt = 0;
for (int i = 0; i < nrows; i++) {
if (abs(canFix[i]) == 1)
Expand Down
6 changes: 5 additions & 1 deletion CoinUtils/src/CoinPresolveFixed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,9 @@ void transferCosts(CoinPresolveMatrix *prob)
For unfixed column singletons in equalities, calculate and install transform
(A) described in the comments at the head of the method.
*/
#if PRESOLVE_DEBUG > 0
int nchanged = 0;
#endif
for (int js = 0; js < ncols; js++) {
if (cost[js] && hincol[js] == 1 && cup[js] > clo[js]) {
const CoinBigIndex &jsstrt = mcstrt[js];
Expand All @@ -804,7 +806,9 @@ void transferCosts(CoinPresolveMatrix *prob)
cost[j] -= ratio * aij;
}
cost[js] = 0.0;
#if PRESOLVE_DEBUG > 0
nchanged++;
#endif
}
}
}
Expand Down Expand Up @@ -862,8 +866,8 @@ void transferCosts(CoinPresolveMatrix *prob)
}
}
if (changed) {
nchanged += changed;
#if PRESOLVE_DEBUG > 0
nchanged += changed;
std::cout
<< " pass " << nPasses++ << " transferred costs to "
<< changed << " integer variables." << std::endl;
Expand Down
4 changes: 4 additions & 0 deletions CoinUtils/src/CoinPresolveImpliedFree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,9 @@ const CoinPresolveAction *implied_free_action::presolve(
// if not integer - don't allow much fill
if (!prob->anyInteger()) {
int numberFree = unprocessed;
#if CLP_USEFUL_PRINTOUT
int nBad = 0;
#endif
unprocessed = 0;
// Take out ones that make much denser or might lead to instability
/*
Expand Down Expand Up @@ -989,8 +991,10 @@ const CoinPresolveAction *implied_free_action::presolve(
if (numberBadElements || 3 * numberFill > 2 * (colLengths[tgtcol] + rowLengths[tgtrow])) {
//printf("Bad subst col %d row %d - %d small elements, fill %d\n",
// tgtcol,tgtrow,numberBadElements,numberFill);
#if CLP_USEFUL_PRINTOUT
if (numberBadElements)
nBad++;
#endif
} else {
whichFree[unprocessed] = tgtcol;
implied_free[unprocessed++] = tgtrow;
Expand Down
4 changes: 2 additions & 2 deletions CoinUtils/src/CoinPresolveSingleton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,8 @@ slack_singleton_action::presolve(CoinPresolveMatrix *prob,
int nactions = 0;
int *fixed_cols = new int[numberLook];
int nfixed_cols = 0;
int nWithCosts = 0;
#ifdef COIN_DEVELOP
int nWithCosts = 0;
double costOffset = 0.0;
#endif
for (iLook = 0; iLook < numberLook; iLook++) {
Expand Down Expand Up @@ -743,9 +743,9 @@ slack_singleton_action::presolve(CoinPresolveMatrix *prob,
cup[iCol] = 0.0;
if (rowObjective && dcost[iCol]) {
rowObjective[iRow] = -dcost[iCol] / coeff;
#ifdef COIN_DEVELOP
nWithCosts++;
// adjust offset
#ifdef COIN_DEVELOP
costOffset += currentLower * rowObjective[iRow];
#endif
prob->dobias_ -= currentLower * rowObjective[iRow];
Expand Down
6 changes: 6 additions & 0 deletions CoinUtils/src/CoinPresolveUseless.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,9 @@ const CoinPresolveAction *testRedundant(CoinPresolveMatrix *prob,
double *cup = prob->cup_;
int *fixed = prob->usefulColumnInt_;
int nFixed = 0;
#ifdef CLP_INVESTIGATE
int nChanged = 0;
#endif
for (int j = 0; j < n; j++) {
if (clo[j] == cup[j])
continue;
Expand All @@ -576,12 +578,16 @@ const CoinPresolveAction *testRedundant(CoinPresolveMatrix *prob,
if (integerType[j]) {
if (upper < cup[j]) {
cup[j] = upper;
#ifdef CLP_INVESTIGATE
nChanged++;
#endif
prob->addCol(j);
}
if (lower > clo[j]) {
clo[j] = lower;
#ifdef CLP_INVESTIGATE
nChanged++;
#endif
prob->addCol(j);
}
}
Expand Down

0 comments on commit 0e35723

Please sign in to comment.