Skip to content

Commit 4c086ac

Browse files
committed
Fix bug in computing cut score after first pass, due to stale orthogonality. Remove minimum_violation
1 parent 9ea0271 commit 4c086ac

File tree

2 files changed

+1
-20
lines changed

2 files changed

+1
-20
lines changed

cpp/src/dual_simplex/cuts.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ void cut_pool_t<i_t, f_t>::score_cuts(std::vector<f_t>& x_relax)
106106
cut_distances_.resize(cut_storage_.m, 0.0);
107107
cut_norms_.resize(cut_storage_.m, 0.0);
108108
cut_orthogonality_.resize(cut_storage_.m, 1);
109+
std::fill(cut_orthogonality_.begin(), cut_orthogonality_.end(), 1.0);
109110
cut_scores_.resize(cut_storage_.m, 0.0);
110111
const bool verbose = false;
111112
for (i_t i = 0; i < cut_storage_.m; i++) {

cpp/src/dual_simplex/cuts.hpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -111,26 +111,6 @@ void verify_cuts_against_saved_solution(const csr_matrix_t<i_t, f_t>& cuts,
111111
const std::vector<f_t>& cut_rhs,
112112
const std::vector<f_t>& saved_solution);
113113

114-
template <typename i_t, typename f_t>
115-
f_t minimum_violation(const csr_matrix_t<i_t, f_t>& C,
116-
const std::vector<f_t>& cut_rhs,
117-
const std::vector<f_t>& x)
118-
{
119-
// Check to see that this is a cut i.e C*x > d
120-
std::vector<f_t> Cx(C.m);
121-
csc_matrix_t<i_t, f_t> C_col(C.m, C.n, 0);
122-
C.to_compressed_col(C_col);
123-
matrix_vector_multiply(C_col, 1.0, x, 0.0, Cx);
124-
f_t min_cut_violation = inf;
125-
for (i_t k = 0; k < Cx.size(); k++) {
126-
if (Cx[k] <= cut_rhs[k]) {
127-
printf("C*x <= d for cut %d. C*x %e rhs %e\n", k, Cx[k], cut_rhs[k]);
128-
exit(1);
129-
}
130-
min_cut_violation = std::min(min_cut_violation, Cx[k] - cut_rhs[k]);
131-
}
132-
return min_cut_violation;
133-
}
134114

135115
template <typename i_t, typename f_t>
136116
class cut_pool_t {

0 commit comments

Comments
 (0)