Skip to content

Commit

Permalink
ENH: Use minimal exceptions
Browse files Browse the repository at this point in the history
No change in C-API, maps to existing errors
  • Loading branch information
HaoZeke committed Oct 21, 2023
1 parent 7264b18 commit 998ded0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/presolve/HPresolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3685,10 +3685,18 @@ HPresolve::Result HPresolve::rowPresolve(HighsPostsolveStack& postsolve_stack,
// assert(non_fractional);
if (!non_fractional) return Result::kPrimalInfeasible;
}
postsolve_stack.fixedColAtLower(nonzero.index(),
model->col_lower_[nonzero.index()],
model->col_cost_[nonzero.index()],
getColumnVector(nonzero.index()));
try {
postsolve_stack.fixedColAtLower(
nonzero.index(), model->col_lower_[nonzero.index()],
model->col_cost_[nonzero.index()],
getColumnVector(nonzero.index()));
} catch (const DataStackOverflow& e) {
highsLogUser(options->log_options, HighsLogType::kError,
"Problem too large for Presolve, try without\n");
highsLogUser(options->log_options, HighsLogType::kInfo,
"Specific error raised:\n%s\n", e.what());
return Result::kPrimalInfeasible;
}
if (model->col_upper_[nonzero.index()] >
model->col_lower_[nonzero.index()])
changeColUpper(nonzero.index(),
Expand Down
1 change: 1 addition & 0 deletions src/util/HighsDataStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class HighsDataStack {
}
std::memcpy(data.data() + dataSize, &r, sizeof(T));
}

template <typename T,
typename std::enable_if<IS_TRIVIALLY_COPYABLE(T), int>::type = 0>
void pop(T& r) {
Expand Down

0 comments on commit 998ded0

Please sign in to comment.