Skip to content

Commit

Permalink
remove or disable more unused-but-set 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 9ff2c78 commit feb32e2
Show file tree
Hide file tree
Showing 13 changed files with 127 additions and 81 deletions.
8 changes: 4 additions & 4 deletions Cgl/src/CglDuplicateRow/CglDuplicateRow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2967,7 +2967,7 @@ void CglDuplicateRow::generateCuts8(const OsiSolverInterface & si, OsiCuts & cs,
for (iRow=0;iRow<numberRows;iRow++) {
duplicate_[iRow]=-1;
int numberP1=0;
int numberTotal=0;
//int numberTotal=0;
CoinBigIndex j;
double upperValue=rowUpper[iRow];
double lowerValue=rowLower[iRow];
Expand All @@ -2985,7 +2985,7 @@ void CglDuplicateRow::generateCuts8(const OsiSolverInterface & si, OsiCuts & cs,
break;
} else {
iColumn = backward[iColumn];
numberTotal++;
//numberTotal++;
}
if (value!=1.0) {
good=false;
Expand Down Expand Up @@ -3244,7 +3244,7 @@ CglDuplicateRow::refreshSolver(OsiSolverInterface * solver)
const CoinBigIndex * rowStart = matrixByRow_.getVectorStarts();
const int * rowLength = matrixByRow_.getVectorLengths();
int iRow;
int numberGood=0;
//int numberGood=0;
int markBad = -(solver->getNumCols()+1);
for (iRow=0;iRow<numberRows;iRow++) {
rhs_[iRow]=markBad;
Expand All @@ -3267,7 +3267,7 @@ CglDuplicateRow::refreshSolver(OsiSolverInterface * solver)
lower_[iRow] = static_cast<int> (CoinMax(0.0,ceil(rowLower[iRow])));
if (iRhs>=lower_[iRow]) {
rhs_[iRow]=iRhs;
numberGood++;
//numberGood++;
} else {
// infeasible ?
lower_[iRow]=markBad;
Expand Down
4 changes: 2 additions & 2 deletions Cgl/src/CglFlowCover/CglFlowCover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ CglFlowCover::generateOneFlowCut( const OsiSolverInterface & si,
//-------------------------------------------------------------------------
// Generate a violated SGFC

int numCMinus = 0;
//int numCMinus = 0;
int numPlusPlus = 0;
double* rho = new double [rowLen];
double* xCoef = new double [rowLen];
Expand All @@ -820,7 +820,7 @@ CglFlowCover::generateOneFlowCut( const OsiSolverInterface & si,
for (i = 0; i < rowLen; ++i) {
if ( label[i] == CGLFLOW_COL_INCUT && sign[i] < 0 ) {
cutRHS += up[i];
++numCMinus;
//++numCMinus;
}
}

Expand Down
3 changes: 0 additions & 3 deletions Cgl/src/CglGomory/CglGomory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,19 +633,16 @@ CglGomory::generateCuts(
int * rowIsBasic = new int[numberRows];
int * columnIsBasic = new int[numberColumns];
int i;
int numberBasic=0;
for (i=0;i<numberRows;i++) {
if (warm->getArtifStatus(i) == CoinWarmStartBasis::basic) {
rowIsBasic[i]=1;
numberBasic++;
} else {
rowIsBasic[i]=-1;
}
}
for (i=0;i<numberColumns;i++) {
if (warm->getStructStatus(i) == CoinWarmStartBasis::basic) {
columnIsBasic[i]=1;
numberBasic++;
} else {
columnIsBasic[i]=-1;
}
Expand Down
4 changes: 2 additions & 2 deletions Cgl/src/CglLandP/CglLandP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,14 +504,14 @@ struct cutsCos
void
CglLandP::scanExtraCuts(OsiCuts& cs, const double * colsol) const
{
int numAdded = 0;
//int numAdded = 0;
for (int i = extraCuts_.sizeRowCuts() - 1; i > -1 ; i--)
{
double violation = extraCuts_.rowCut(i).violated(colsol);
if (violation > 0.)
{
cs.insert(extraCuts_.rowCut(i));
numAdded++;
//numAdded++;
// std::cout<<"A cut computed in a previous iteration is violated by "<<violation<<"."<<std::endl;
//extraCuts_.eraseRowCut(i);
}
Expand Down
12 changes: 5 additions & 7 deletions Cgl/src/CglLandP/CglLandPSimplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,15 +495,13 @@ CglLandPSimplex::cacheUpdate(const CglLandP::CachedData &cached, bool reducedSpa
colsol_[nonBasics_[i]] = 0;
}
/** Mark the variables at zero in solution to cut so that we know that their contribution to reduced cost has to be computed*/
int n_removed =0;
if (reducedSpace)
{
for (int ii = 0; ii < ncols_orig_ ; ii++)
{
if (getColsolToCut(ii) - up_bounds_[ii] > 1e-08 || getColsolToCut(ii) - lo_bounds_[ii] < 1e-08)
{
col_in_subspace[ii]=false;
n_removed++;
}
}
}
Expand Down Expand Up @@ -2143,7 +2141,7 @@ int CglLandPSimplex::findBestPivot(int &leaving, int & direction,
reducedCost * rc = new reducedCost[nNegativeRcRows_];
int k = 0;
rc[k].direction = 0;//initialize first rc
int k2 = 0;
//int k2 = 0;
for (int i = 0 ; i < nrows_ ; i++)
{
if (ul_i[i] < -params.pivotTol)
Expand All @@ -2153,7 +2151,7 @@ int CglLandPSimplex::findBestPivot(int &leaving, int & direction,
rc[k].gammaSign = -1;
rc[k].value = ul_i[i];
rc[k].row = i;
k2++;
//k2++;
}

if (vl_i[i] < -params.pivotTol)
Expand All @@ -2163,7 +2161,7 @@ int CglLandPSimplex::findBestPivot(int &leaving, int & direction,
rc[k].gammaSign = 1;
rc[k].value = vl_i[i];
rc[k].row = i;
k2++;
//k2++;
}


Expand Down Expand Up @@ -2194,7 +2192,7 @@ int CglLandPSimplex::findBestPivot(int &leaving, int & direction,
rc[k].value2 = uu_i[i];
}
}
k2++;
//k2++;
}
if (vu_i[i] < -params.pivotTol)
//&& rowFlags_[i]) //row has not been flaged
Expand Down Expand Up @@ -2223,7 +2221,7 @@ int CglLandPSimplex::findBestPivot(int &leaving, int & direction,
rc[k].value2 = vu_i[i];
}
}
k2++;
//k2++;
}
if (rc[k].direction!=0) //We have added a row with < 0 rc during
//last iteration
Expand Down
28 changes: 21 additions & 7 deletions Cgl/src/CglMixedIntegerRounding/CglMixedIntegerRounding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,19 @@ mixIntRoundPreprocess(const OsiSolverInterface& si)
}
rowTypes_ = new RowType [numRows_]; // Destructor will free memory

// Summarize the row type infomation.
// Summarize the row type information.
#if CGL_DEBUG
int numUNDEFINED = 0;
int numVARUB = 0;
int numVARLB = 0;
int numVAREQ = 0;
#endif
int numMIX = 0;
int numCONT = 0;
int numINT = 0;
#if CGL_DEBUG
int numOTHER = 0;
#endif

int iRow;
const double* rowActivity = si.getRowActivity();
Expand Down Expand Up @@ -370,28 +374,38 @@ mixIntRoundPreprocess(const OsiSolverInterface& si)
// Summarize information about row types
switch(rowType) {
case ROW_UNDEFINED:
#if CGL_DEBUG
++numUNDEFINED;
#endif
break;
case ROW_VARUB:
++numVARUB;
#if CGL_DEBUG
++numVARUB;
#endif
break;
case ROW_VARLB:
++numVARLB;
#if CGL_DEBUG
++numVARLB;
#endif
break;
case ROW_VAREQ:
++numVAREQ;
#if CGL_DEBUG
++numVAREQ;
#endif
break;
case ROW_MIX:
++numMIX;
++numMIX;
break;
case ROW_CONT:
++numCONT;
++numCONT;
break;
case ROW_INT:
++numINT;
break;
case ROW_OTHER:
++numOTHER;
#if CGL_DEBUG
++numOTHER;
#endif
break;
default:
throw CoinError("Unknown row type", "MixIntRoundPreprocess",
Expand Down
26 changes: 20 additions & 6 deletions Cgl/src/CglMixedIntegerRounding2/CglMixedIntegerRounding2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,15 +358,19 @@ mixIntRoundPreprocess(const OsiSolverInterface& si)
}
rowTypes_ = new RowType [numRows_]; // Destructor will free memory

// Summarize the row type infomation.
// Summarize the row type information.
#if CGL_DEBUG
int numUNDEFINED = 0;
int numVARUB = 0;
int numVARLB = 0;
int numVAREQ = 0;
#endif
int numMIX = 0;
int numCONT = 0;
int numINT = 0;
#if CGL_DEBUG
int numOTHER = 0;
#endif

int iRow;
const double* rowActivity = si.getRowActivity();
Expand Down Expand Up @@ -396,16 +400,24 @@ mixIntRoundPreprocess(const OsiSolverInterface& si)
// Summarize information about row types
switch(rowType) {
case ROW_UNDEFINED:
++numUNDEFINED;
#if CGL_DEBUG
++numUNDEFINED;
#endif
break;
case ROW_VARUB:
++numVARUB;
#if CGL_DEBUG
++numVARUB;
#endif
break;
case ROW_VARLB:
++numVARLB;
#if CGL_DEBUG
++numVARLB;
#endif
break;
case ROW_VAREQ:
++numVAREQ;
#if CGL_DEBUG
++numVAREQ;
#endif
break;
case ROW_MIX:
++numMIX;
Expand All @@ -417,7 +429,9 @@ mixIntRoundPreprocess(const OsiSolverInterface& si)
++numINT;
break;
case ROW_OTHER:
++numOTHER;
#if CGL_DEBUG
++numOTHER;
#endif
break;
default:
throw CoinError("Unknown row type", "MixIntRoundPreprocess",
Expand Down

0 comments on commit feb32e2

Please sign in to comment.