Skip to content

Commit a84beb7

Browse files
committed
Switching to markov
1 parent cf3d5e9 commit a84beb7

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

check/TestIis.cpp

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ TEST_CASE("lp-incompatible-bounds", "[iis]") {
5050
REQUIRE(highs.getIisLp(iis_lp) == HighsStatus::kOk);
5151
HighsIis iis;
5252
REQUIRE(highs.getIis(iis) == HighsStatus::kOk);
53-
checkIisLp(lp, iis, iis_lp);
53+
checkIisLp(lp, iis, iis_lp);
54+
REQUIRE(highs.passModel(iis_lp) == HighsStatus::kOk);
55+
highs.writeModel("");
56+
REQUIRE(highs.run() == HighsStatus::kOk);
57+
REQUIRE(highs.getModelStatus() == HighsModelStatus::kInfeasible);
58+
5459
/*
5560
// Perform full IIS
5661
REQUIRE(highs.run() == HighsStatus::kOk);
@@ -501,13 +506,15 @@ void checkIisLp(HighsLp& lp, const HighsIis& iis, const HighsLp& iis_lp) {
501506
REQUIRE(iis_lp.row_upper_[iisRow] == lp.row_upper_[iRow]);
502507
}
503508

509+
// Work through the LP columns and matrix, checking the costs,
510+
// bounds and matrix index/value
504511
for (HighsInt iisCol = 0; iisCol < iis_num_col; iisCol++) {
505512
HighsInt iCol = iis.col_index_[iisCol];
506513
REQUIRE(iis_lp.col_cost_[iisCol] == lp.col_cost_[iCol]);
507514
REQUIRE(iis_lp.col_lower_[iisCol] == lp.col_lower_[iCol]);
508515
REQUIRE(iis_lp.col_upper_[iisCol] == lp.col_upper_[iCol]);
509516
for (HighsInt iEl = lp.a_matrix_.start_[iCol];
510-
iEl < lp.a_matrix_.start_[iCol+1]; iisCol++) {
517+
iEl < lp.a_matrix_.start_[iCol+1]; iEl++) {
511518
HighsInt iRow = lp.a_matrix_.index_[iEl];
512519
HighsInt iisRow = iis_row[iRow];
513520
if (iisRow >= 0) {
@@ -516,6 +523,27 @@ void checkIisLp(HighsLp& lp, const HighsIis& iis, const HighsLp& iis_lp) {
516523
}
517524
}
518525
}
519-
526+
// Work through the IIS LP matrix, making sure that the index/value
527+
// are correct
528+
std::vector<HighsInt> index;
529+
std::vector<double> value;
530+
for (HighsInt iisCol = 0; iisCol < iis_num_col; iisCol++) {
531+
HighsInt iCol = iis.col_index_[iisCol];
532+
index.assign(lp.num_row_, -1);
533+
value.assign(lp.num_row_, 0);
534+
for (HighsInt iEl = lp.a_matrix_.start_[iCol];
535+
iEl < lp.a_matrix_.start_[iCol+1]; iEl++) {
536+
HighsInt iRow = lp.a_matrix_.index_[iEl];
537+
index[iRow] = iis_row[iRow];
538+
value[iRow] = lp.a_matrix_.value_[iEl];
539+
}
540+
for (HighsInt iEl = iis_lp.a_matrix_.start_[iCol];
541+
iEl < iis_lp.a_matrix_.start_[iCol+1]; iisCol++) {
542+
HighsInt iisRow = iis_lp.a_matrix_.index_[iEl];
543+
HighsInt iRow = iis.row_index_[iisRow];
544+
REQUIRE(index[iRow] == iisRow);
545+
REQUIRE(value[iRow] == iis_lp.a_matrix_.value_[iEl]);
546+
}
547+
}
520548
}
521549

0 commit comments

Comments
 (0)