Skip to content

Commit 858a96f

Browse files
committed
Fix for n5-3 infeasible. Also should result in less primal infeasibilities
1 parent f5f8a32 commit 858a96f

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

cpp/src/dual_simplex/branch_and_bound.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,9 +1948,13 @@ mip_status_t branch_and_bound_t<i_t, f_t>::solve(mip_solution_t<i_t, f_t>& solut
19481948

19491949
f_t node_presolve_start_time = tic();
19501950
bounds_strengthening_t<i_t, f_t> node_presolve(original_lp_, Arow_, row_sense, var_types_);
1951-
mutex_original_lp_.lock();
1951+
std::vector<f_t> new_lower = original_lp_.lower;
1952+
std::vector<f_t> new_upper = original_lp_.upper;
19521953
bool feasible = node_presolve.bounds_strengthening(
1953-
settings_, bounds_changed, original_lp_.lower, original_lp_.upper);
1954+
settings_, bounds_changed, new_lower, new_upper);
1955+
mutex_original_lp_.lock();
1956+
original_lp_.lower = new_lower;
1957+
original_lp_.upper = new_upper;
19541958
mutex_original_lp_.unlock();
19551959
f_t node_presolve_time = toc(node_presolve_start_time);
19561960
if (1 || node_presolve_time > 1.0) {

cpp/src/dual_simplex/phase2.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,6 +1979,7 @@ void set_primal_variables_on_bounds(const lp_problem_t<i_t, f_t>& lp,
19791979
std::vector<f_t>& x)
19801980
{
19811981
const i_t n = lp.num_cols;
1982+
f_t tol = 1e-10;
19821983
for (i_t j = 0; j < n; ++j) {
19831984
// We set z_j = 0 for basic variables
19841985
// But we explicitally skip setting basic variables here
@@ -1996,9 +1997,9 @@ void set_primal_variables_on_bounds(const lp_problem_t<i_t, f_t>& lp,
19961997
}
19971998
x[j] = lp.lower[j];
19981999
vstatus[j] = variable_status_t::NONBASIC_FIXED;
1999-
} else if (z[j] == 0 && lp.lower[j] > -inf && vstatus[j] == variable_status_t::NONBASIC_LOWER) {
2000+
} else if (z[j] >= -tol && lp.lower[j] > -inf && vstatus[j] == variable_status_t::NONBASIC_LOWER) {
20002001
x[j] = lp.lower[j];
2001-
} else if (z[j] == 0 && lp.upper[j] < inf && vstatus[j] == variable_status_t::NONBASIC_UPPER) {
2002+
} else if (z[j] <= tol && lp.upper[j] < inf && vstatus[j] == variable_status_t::NONBASIC_UPPER) {
20022003
x[j] = lp.upper[j];
20032004
} else if (z[j] >= 0 && lp.lower[j] > -inf) {
20042005
if (vstatus[j] != variable_status_t::NONBASIC_LOWER) {
@@ -2476,6 +2477,16 @@ dual::status_t dual_phase2_with_advanced_basis(i_t phase,
24762477
i_t dense_delta_z = 0;
24772478
phase2::phase2_timers_t<i_t, f_t> timers(false);
24782479

2480+
if (phase == 2) {
2481+
settings.log.printf("%5d %+.16e %7d %.8e %.2e %.2f\n",
2482+
0,
2483+
compute_user_objective(lp, obj),
2484+
infeasibility_indices.size(),
2485+
primal_infeasibility_squared,
2486+
0.0,
2487+
toc(start_time));
2488+
}
2489+
24792490
while (iter < iter_limit) {
24802491
// Pricing
24812492
i_t direction = 0;

0 commit comments

Comments
 (0)