Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use tolerances when rounding #1832

Merged
merged 4 commits into from
Jul 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions src/presolve/HighsPostsolveStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -905,10 +905,12 @@ bool HighsPostsolveStack::DuplicateColumn::okMerge(
const double scale = colScale;
const bool x_int = colIntegral;
const bool y_int = duplicateColIntegral;
const double x_lo = x_int ? std::ceil(colLower) : colLower;
const double x_up = x_int ? std::floor(colUpper) : colUpper;
const double y_lo = y_int ? std::ceil(duplicateColLower) : duplicateColLower;
const double y_up = y_int ? std::floor(duplicateColUpper) : duplicateColUpper;
const double x_lo = x_int ? std::ceil(colLower - tolerance) : colLower;
const double x_up = x_int ? std::floor(colUpper + tolerance) : colUpper;
const double y_lo =
y_int ? std::ceil(duplicateColLower - tolerance) : duplicateColLower;
const double y_up =
y_int ? std::floor(duplicateColUpper + tolerance) : duplicateColUpper;
const double x_len = x_up - x_lo;
const double y_len = y_up - y_lo;
std::string newline = "\n";
Expand Down Expand Up @@ -1015,9 +1017,8 @@ void HighsPostsolveStack::DuplicateColumn::undoFix(
};

auto isFeasible = [&](const double l, const double v, const double u) {
if (v < l - primal_feasibility_tolerance) return false;
if (v > u + primal_feasibility_tolerance) return false;
return true;
return v >= l - primal_feasibility_tolerance &&
v <= u + primal_feasibility_tolerance;
};
const double merge_value = col_value[col];
const double value_max = 1000;
Expand All @@ -1027,10 +1028,16 @@ void HighsPostsolveStack::DuplicateColumn::undoFix(
const bool y_int = duplicateColIntegral;
const int x_ix = col;
const int y_ix = duplicateCol;
const double x_lo = x_int ? std::ceil(colLower) : colLower;
const double x_up = x_int ? std::floor(colUpper) : colUpper;
const double y_lo = y_int ? std::ceil(duplicateColLower) : duplicateColLower;
const double y_up = y_int ? std::floor(duplicateColUpper) : duplicateColUpper;
const double x_lo =
x_int ? std::ceil(colLower - mip_feasibility_tolerance) : colLower;
const double x_up =
x_int ? std::floor(colUpper + mip_feasibility_tolerance) : colUpper;
const double y_lo =
y_int ? std::ceil(duplicateColLower - mip_feasibility_tolerance)
: duplicateColLower;
const double y_up =
y_int ? std::floor(duplicateColUpper + mip_feasibility_tolerance)
: duplicateColUpper;
if (kAllowDeveloperAssert) assert(scale);
double x_v = merge_value;
double y_v;
Expand Down
Loading