Skip to content

Commit

Permalink
fix wrong assert
Browse files Browse the repository at this point in the history
  • Loading branch information
jjhforrest committed Mar 14, 2024
1 parent f72c1cf commit 39eae0c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/ClpSimplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11454,7 +11454,7 @@ int ClpSimplex::fathom(void *stuff)
int *whichColumn = new int[2 * numberColumns_];
int nBound;
bool tightenBounds = ((specialOptions_ & 64) == 0) ? false : true;
//numberRows_=-numberRows_;//!! flag to say do more work (if test in crunch)
numberRows_=-numberRows_;//!! flag to say do more work (if test in crunch)
ClpSimplex *small = static_cast< ClpSimplexOther * >(this)->crunch(rhs, whichRow, whichColumn,
nBound, false, tightenBounds);
if (small) {
Expand Down Expand Up @@ -12177,7 +12177,7 @@ int ClpSimplex::fathomMany(void *stuff)
int *whichRow = new int[3 * numberRows_];
int *whichColumn = new int[2 * numberColumns_];
int nBound;
//numberRows_=-numberRows_;//!! flag to say do more work (if test in crunch)
numberRows_=-numberRows_;//!! flag to say do more work (if test in crunch)
bool tightenBounds = ((specialOptions_ & 64) == 0) ? false : true;
ClpSimplex *small = static_cast< ClpSimplexOther * >(this)->crunch(rhs, whichRow, whichColumn,
nBound, false, tightenBounds);
Expand Down
4 changes: 2 additions & 2 deletions src/ClpSimplexOther.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,7 @@ ClpSimplex *
ClpSimplexOther::crunch(double *rhs, int *whichRow, int *whichColumn,
int &nBound, bool moreBounds, bool tightenBounds)
{
#if 0
#if 1
/* If you only want to find redundant rows before fathom then
use this and set numberRows_ negative before this call (in ClpSimplex.cpp)
*/
Expand All @@ -1786,7 +1786,7 @@ ClpSimplexOther::crunch(double *rhs, int *whichRow, int *whichColumn,
}
#else
assert (numberRows_>=0);
bool takeOutSome=false;//true;
bool takeOutSome=true;
#endif
//#define CHECK_STATUS
#ifdef CHECK_STATUS
Expand Down
10 changes: 8 additions & 2 deletions src/OsiClp/OsiClpSolverInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7940,8 +7940,11 @@ void OsiClpSolverInterface::crunch()
nBound, moreBounds, tightenBounds);
#ifndef NDEBUG
int nCopy = 3 * numberRows + 2 * numberColumns;
for (int i = 0; i < nCopy; i++)
for (int i = 0; i < nCopy; i++) {
if (i>=small->getNumRows()&&i<numberRows)
continue; // row was removed so doesn't matter
assert(whichRow[i] >= -CoinMax(numberRows, numberColumns) && whichRow[i] < CoinMax(numberRows, numberColumns));
}
#endif
smallModel_ = small;
spareArrays_ = spareArrays;
Expand All @@ -7953,8 +7956,11 @@ void OsiClpSolverInterface::crunch()
int nCopy = 3 * numberRows + 2 * numberColumns;
nBound = whichRow[nCopy];
#ifndef NDEBUG
for (int i = 0; i < nCopy; i++)
for (int i = 0; i < nCopy; i++) {
if (i>=smallModel_->getNumRows()&&i<numberRows)
continue; // row was removed so doesn't matter
assert(whichRow[i] >= -CoinMax(numberRows, numberColumns) && whichRow[i] < CoinMax(numberRows, numberColumns));
}
#endif
small = smallModel_;
}
Expand Down

0 comments on commit 39eae0c

Please sign in to comment.