Skip to content

Commit f939089

Browse files
committed
Review fixes
1 parent c579b8f commit f939089

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

cpp/src/dual_simplex/branch_and_bound.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void set_uninitialized_steepest_edge_norms(const lp_problem_t<i_t, f_t>& lp,
131131
if (edge_norms.size() != lp.num_cols) { edge_norms.resize(lp.num_cols, -1.0); }
132132
for (i_t k = 0; k < lp.num_rows; k++) {
133133
const i_t j = basic_list[k];
134-
if (edge_norms[j] < 0.0) { edge_norms[j] = 1e-4; }
134+
if (edge_norms[j] <= 0.0) { edge_norms[j] = 1e-4; }
135135
}
136136
}
137137

@@ -2035,9 +2035,7 @@ mip_status_t branch_and_bound_t<i_t, f_t>::solve(mip_solution_t<i_t, f_t>& solut
20352035
f_t rel_gap = user_relative_gap(original_lp_, upper_bound_.load(), root_objective_);
20362036
f_t abs_gap = upper_bound_.load() - root_objective_;
20372037
if (rel_gap < settings_.relative_mip_gap_tol || abs_gap < settings_.absolute_mip_gap_tol) {
2038-
if (settings_.solution_callback != nullptr) {
2039-
settings_.solution_callback(root_relax_soln_.x, root_objective_);
2040-
}
2038+
set_solution_at_root(solution, cut_info);
20412039
set_final_solution(solution, root_objective_);
20422040
return mip_status_t::OPTIMAL;
20432041
}

cpp/tests/mip/cuts_test.cu

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include <cstdint>
2222
#include <filesystem>
23+
#include <limits>
2324
#include <sstream>
2425
#include <string>
2526
#include <vector>
@@ -89,7 +90,7 @@ TEST(cuts, test_cuts_1)
8990
EXPECT_EQ(solution.get_termination_status(), mip_termination_status_t::Optimal);
9091

9192
double obj_val = solution.get_objective_value();
92-
// Expected objective value from documentation example is approximately 303.5
93+
// Expected objective value from documentation example is approximately -28
9394
EXPECT_NEAR(-28, obj_val, 1e-3);
9495

9596
EXPECT_EQ(solution.get_num_nodes(), 0);
@@ -158,7 +159,7 @@ TEST(cuts, test_cuts_2)
158159
EXPECT_EQ(solution.get_termination_status(), mip_termination_status_t::Optimal);
159160

160161
double obj_val = solution.get_objective_value();
161-
// Expected objective value from documentation example is approximately 303.5
162+
// Expected objective value from documentation example is approximately -126
162163
EXPECT_NEAR(-126, obj_val, 1e-3);
163164

164165
EXPECT_EQ(solution.get_num_nodes(), 0);

0 commit comments

Comments
 (0)