Skip to content

Commit 683aa0f

Browse files
authored
Merge pull request #2530 from ERGO-Code/fix-2528
Fix 2528
2 parents 4dd628d + 135c9d6 commit 683aa0f

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

check/TestIpm.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,19 @@ TEST_CASE("test-2087", "[highs_ipm]") {
200200

201201
h.resetGlobalScheduler(true);
202202
}
203+
204+
TEST_CASE("test-2527", "[highs_ipm]") {
205+
std::string filename =
206+
std::string(HIGHS_DIR) + "/check/instances/primal1.mps";
207+
Highs h;
208+
// h.setOptionValue("output_flag", dev_run);
209+
REQUIRE(h.readModel(filename) == HighsStatus::kOk);
210+
HighsLp lp = h.getLp();
211+
lp.col_cost_.assign(lp.num_col_, 0);
212+
REQUIRE(h.passModel(lp) == HighsStatus::kOk);
213+
h.setOptionValue("solver", kIpmString);
214+
h.setOptionValue("presolve", kHighsOffString);
215+
REQUIRE(h.run() == HighsStatus::kOk);
216+
217+
h.resetGlobalScheduler(true);
218+
}

highs/ipm/ipx/basis.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,21 @@ Int Basis::Factorize() {
119119

120120
// Build column pointers for passing to LU factorization.
121121
std::vector<Int> begin(m), end(m);
122+
Int basis_num_nz = 0;
122123
for (Int i = 0; i < m; i++) {
123124
assert(basis_[i] >= 0);
124125
begin[i] = AI.begin(basis_[i]);
125126
end[i] = AI.end(basis_[i]);
127+
basis_num_nz += (end[i]-begin[i]);
126128
}
127129

130+
std::stringstream h_logging_stream;
131+
h_logging_stream.str(std::string());
132+
h_logging_stream <<
133+
" Start factorization " << num_factorizations_+1 <<
134+
": nonzeros in basis = " << basis_num_nz << "\n";
135+
control_.hIntervalLog(h_logging_stream);
136+
128137
Int err = 0; // return code
129138
while (true) {
130139
Int flag = lu_->Factorize(begin.data(), end.data(), AI.rowidx(),
@@ -151,6 +160,11 @@ Int Basis::Factorize() {
151160
}
152161
time_factorize_ += timer.Elapsed();
153162
factorization_is_fresh_ = true;
163+
h_logging_stream.str(std::string());
164+
h_logging_stream <<
165+
" Finish factorization " << num_factorizations_ <<
166+
": fill factor = " << lu_->fill_factor() << "\n";
167+
control_.hIntervalLog(h_logging_stream);
154168
return err;
155169
}
156170

highs/ipm/ipx/lp_solver.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ void LpSolver::BuildStartingBasis() {
522522
info_.status_ipm = IPX_STATUS_debug;
523523
return;
524524
}
525-
basis_.reset(new Basis(control_, model_));
526525
control_.hLog(" Constructing starting basis...\n");
526+
basis_.reset(new Basis(control_, model_));
527527
StartingBasis(iterate_.get(), basis_.get(), &info_);
528528
if (info_.errflag == IPX_ERROR_user_interrupt) {
529529
info_.errflag = 0;

0 commit comments

Comments
 (0)