Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion include/core/Numerics.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#define ZERO_TOL_DUAL_POSTSOLVE 1e-6
#define HUGE_VAL_PS 1e7
#define ACT_RECOMPUTE_RATIO 100.0
#define ACTIVE_BOUND_TOL_REL 1e-3

// used for model clean up according to Gurobi paper
#define CLEAN1 1e-3
Expand Down
16 changes: 4 additions & 12 deletions src/core/Postsolver.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ void retrieve_added_rows(Solution *sol, int i, const int *rows, const double *va

static void retrieve_bound_change(Solution *sol, int i, int j, const int *cols,
const double *vals, int len,
bool implied_bound_is_upper, double implied_bound)
bool implied_bound_is_upper)
{
int k, ii;
double aij = 1.0;
Expand All @@ -339,14 +339,6 @@ static void retrieve_bound_change(Solution *sol, int i, int j, const int *cols,
return;
}

// only transfer z_j to the row if the implied bound is (nearly) active
double dist = implied_bound_is_upper ? implied_bound - sol->x[j]
: sol->x[j] - implied_bound;
if (dist > ACTIVE_BOUND_TOL_REL * (1.0 + ABS(implied_bound)))
{
return;
}

// find aij
for (ii = 0; ii < len; ++ii)
{
Expand Down Expand Up @@ -560,9 +552,9 @@ void postsolver_run(const PostsolveInfo *info, Solution *sol, const double *x,
bound_changes_processed += 1;
// the implied bound is the upper one iff the other bound
// is the lower one
retrieve_bound_change(
sol, row.i, r.j, row.cols, row.vals, row.len,
r.is_original_other_bound_lower_bound, r.implied_bound);
retrieve_bound_change(sol, row.i, r.j, row.cols, row.vals,
row.len,
r.is_original_other_bound_lower_bound);
}

j -= 1;
Expand Down
18 changes: 9 additions & 9 deletions tests/test_postsolve.h
Original file line number Diff line number Diff line change
Expand Up @@ -1550,11 +1550,12 @@ static char *test_ston_row_bound_dual_approximate_solution()
[1 1] x >= 6e4
x0 free, 0 <= x1 <= 1e5
The singleton row becomes the bound x0 <= 5e4 and is deleted. The reduced
point has x0 = 1e4, far from that bound, and z0 = -1e-3: noise of a
first-order solver, not a multiplier of the bound. Postsolve must not hand
z0 to the deleted row: y0 = -5e-4 on a row with slack 8e4 would add 40 to
the duality gap. z0 stays as a dual residual of the size it had on the
reduced problem. */
point has x0 = 1e4, far from that bound, and z0 = -1e-3, as an inexact
solver may return. x0 is free in the original problem, so z0 cannot stay
on the column: postsolve hands it to the deleted row whatever the distance
to the bound, y0 = z0 / 2 = -5e-4 and z0 = 0. The postsolved point is then
dual feasible, and the complementarity error |z0| * 4e4 of the reduced
point is carried over as it is. */
static char *test_ston_row_bound_dual_inactive_bound()
{
double Ax[] = {2, 1, 1};
Expand Down Expand Up @@ -1585,10 +1586,9 @@ static char *test_ston_row_bound_dual_inactive_bound()
double z[] = {-1e-3, 0};
postsolve(presolver, x, y, z);

mu_assert("inactive bound dual handed to the singleton row",
presolver->sol->y[0] == 0.0);
mu_assert("bound dual of an inactive bound not kept",
presolver->sol->z[0] == -1e-3);
mu_assert("inactive bound dual not handed to the singleton row",
presolver->sol->y[0] == -5e-4);
mu_assert("bound dual kept on a free column", presolver->sol->z[0] == 0.0);

PS_FREE(stgs);
free_presolver(presolver);
Expand Down
Loading