Skip to content

Commit

Permalink
MAINT: Localize the error more, update text
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoZeke committed Oct 21, 2023
1 parent 8ee4bde commit a51dd8f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
31 changes: 16 additions & 15 deletions src/presolve/HighsPostsolveStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include "lp_data/HighsOptions.h"
#include "util/HighsCDouble.h"
#include "util/HighsDataStack.h"
#include "util/HighsMatrixSlice.h"
#include "util/HighsExceptions.h"
#include "util/HighsMatrixSlice.h"

// class HighsOptions;
namespace presolve {
Expand Down Expand Up @@ -373,22 +373,23 @@ class HighsPostsolveStack {
template <typename ColStorageFormat>
void fixedColAtLower(HighsInt col, double fixValue, double colCost,
const HighsMatrixSlice<ColStorageFormat>& colVec) {
try {
assert(std::isfinite(fixValue));
colValues.clear();
for (const HighsSliceNonzero& colVal : colVec)
assert(std::isfinite(fixValue));
colValues.clear();
for (const HighsSliceNonzero& colVal : colVec) {
try {
colValues.emplace_back(origRowIndex[colVal.index()], colVal.value());

reductionValues.push(FixedCol{fixValue, colCost, origColIndex[col],
HighsBasisStatus::kLower});
reductionValues.push(colValues);
reductionAdded(ReductionType::kFixedCol);
} catch (const DataStackOverflow& e) {
std::cerr << "Memory allocation failed while processing fixedColAtLower: "
<< std::endl;
// Rethrow.
throw;
} catch (const DataStackOverflow& e) {
std::cerr
<< "Memory allocation failed while processing fixedColAtLower: "
<< std::endl;
// Rethrow.
throw;
}
}
reductionValues.push(FixedCol{fixValue, colCost, origColIndex[col],
HighsBasisStatus::kLower});
reductionValues.push(colValues);
reductionAdded(ReductionType::kFixedCol);
}
template <typename ColStorageFormat>
void fixedColAtUpper(HighsInt col, double fixValue, double colCost,
Expand Down
2 changes: 1 addition & 1 deletion src/util/HighsDataStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class HighsDataStack {
throw DataStackOverflow(
"Failed to resize the vector. Requested new size: " +
std::to_string(newSize) + ". Size to add is " +
std::to_string(sizeof(T)) + "for "+
std::to_string(sizeof(T)) +
". Current size: " + std::to_string(data.size()) + ".");
}
std::memcpy(data.data() + dataSize, &r, sizeof(T));
Expand Down

0 comments on commit a51dd8f

Please sign in to comment.