Skip to content

Commit b840f88

Browse files
committed
Fix tests. Check if already scaled. Add epsilon to knapsack"
1 parent 99a0d65 commit b840f88

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

check/TestCallbacks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ TEST_CASE("highs-callback-mip-interrupt", "[highs_callback]") {
417417
HighsStatus status = highs.run();
418418
REQUIRE(status == HighsStatus::kWarning);
419419
REQUIRE(highs.getModelStatus() == HighsModelStatus::kInterrupt);
420-
REQUIRE(highs.getInfo().objective_function_value > egout_optimal_objective);
420+
REQUIRE(highs.getInfo().objective_function_value >= egout_optimal_objective);
421421

422422
highs.resetGlobalScheduler(true);
423423
}

check/TestMipSolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ TEST_CASE("MIP-get-saved-solutions", "[highs_test_mip_solver]") {
587587

588588
TEST_CASE("MIP-objective-target", "[highs_test_mip_solver]") {
589589
const double egout_optimal_objective = 568.1007;
590-
const double egout_objective_target = 610;
590+
const double egout_objective_target = 680;
591591
std::string filename = std::string(HIGHS_DIR) + "/check/instances/egout.mps";
592592
Highs highs;
593593
highs.setOptionValue("output_flag", dev_run);

highs/mip/HighsCutGeneration.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,8 @@ bool HighsCutGeneration::generateCut(HighsTransformedLp& transLp,
13661366
std::vector<HighsInt> flowCoverInds;
13671367
double flowCoverRhs = rhs_;
13681368
double flowCoverEfficacy = 0;
1369-
if (genFlowCover && !lpRelaxation.getMipSolver().submip) {
1369+
if (genFlowCover && !lpRelaxation.getMipSolver().submip &&
1370+
!lpRelaxation.getMipSolver().mipdata_->continuous_cols.empty()) {
13701371
flowCoverVals = vals_;
13711372
flowCoverInds = inds_;
13721373
flowCoverSuccess = tryGenerateFlowCoverCut(
@@ -1642,7 +1643,7 @@ bool HighsCutGeneration::preprocessSNFRelaxation() {
16421643
}
16431644

16441645
if (numContCols == 0) return false;
1645-
scale(maxAbsVal);
1646+
if (maxAbsVal > 1 + feastol || maxAbsVal < 0.5 - feastol) scale(maxAbsVal);
16461647

16471648
for (HighsInt i = 0; i != rowlen; ++i) {
16481649
HighsInt col = inds[i];
@@ -1737,8 +1738,8 @@ bool HighsCutGeneration::computeFlowCover() {
17371738
}
17381739
assert(nNonFlowCover + nFlowCover + nitems == snfr.numNnzs);
17391740

1740-
double capacity =
1741-
static_cast<double>(-snfr.rhs + flowCoverWeight + n1itemsWeight);
1741+
double capacity = static_cast<double>(-snfr.rhs + flowCoverWeight +
1742+
n1itemsWeight - feastol);
17421743

17431744
// There is no flow cover if capacity is less than zero after fixing
17441745
if (capacity < feastol) return false;

0 commit comments

Comments
 (0)