Skip to content

Commit

Permalink
Added option mip_allow_feasibility_jump and used it to prevent FJ in …
Browse files Browse the repository at this point in the history
…MIP-unbounded unit test
  • Loading branch information
jajhall committed Dec 2, 2024
1 parent e1b9cf6 commit 037e383
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
3 changes: 3 additions & 0 deletions check/TestMipSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ TEST_CASE("MIP-unbounded", "[highs_test_mip_solver]") {
return_status = highs.passModel(lp);
REQUIRE(return_status == HighsStatus::kOk);

// Feasibility jump doesn't handle the unbounded MIP at present
highs.setOptionValue("mip_allow_feasibility_jump", dev_run);

return_status = highs.run();
REQUIRE(return_status == HighsStatus::kOk);

Expand Down
7 changes: 7 additions & 0 deletions src/lp_data/HighsOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ struct HighsOptionsStruct {
// Options for MIP solver
bool mip_detect_symmetry;
bool mip_allow_restart;
bool mip_allow_feasibility_jump;
HighsInt mip_max_nodes;
HighsInt mip_max_stall_nodes;
HighsInt mip_max_start_nodes;
Expand Down Expand Up @@ -545,6 +546,7 @@ struct HighsOptionsStruct {
icrash_breakpoints(false),
mip_detect_symmetry(false),
mip_allow_restart(false),
mip_allow_feasibility_jump(false),
mip_max_nodes(0),
mip_max_stall_nodes(0),
mip_max_start_nodes(0),
Expand Down Expand Up @@ -939,6 +941,11 @@ class HighsOptions : public HighsOptionsStruct {
advanced, &mip_allow_restart, true);
records.push_back(record_bool);

record_bool = new OptionRecordBool("mip_allow_feasibility_jump",
"Whether MIP feasibility jump is permitted",
advanced, &mip_allow_feasibility_jump, true);
records.push_back(record_bool);

record_int = new OptionRecordInt("mip_max_nodes",
"MIP solver max number of nodes", advanced,
&mip_max_nodes, 0, kHighsIInf, kHighsIInf);
Expand Down
7 changes: 4 additions & 3 deletions src/mip/HighsFeasibilityJump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <climits>

#include "lp_data/HighsModelUtils.h" // for typeToString Remove 1423

#include "mip/HighsMipSolverData.h"
#include "mip/feasibilityjump.hh"

Expand Down Expand Up @@ -45,9 +47,8 @@ void HighsMipSolverData::feasibilityJump() {
fjVarType = external_feasibilityjump::VarType::Integer;
} else {
printf(
"Feasibility Jump only supports continuous and integer variables. "
"Skipping Feasibility Jump...\n"
);
"Feasibility Jump only supports continuous and integer variables, but integrality_[%d] is %s. "
"Skipping Feasibility Jump...\n", int(i), typeToString(model->integrality_[i]).c_str());
return;
}
solver.addVar(
Expand Down
10 changes: 6 additions & 4 deletions src/mip/HighsMipSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,12 @@ void HighsMipSolver::run() {
cleanupSolve();
return;
}
// Apply the feasibility jump before evaluating the root node
analysis_.mipTimerStart(kMipClockFeasibilityJump);
mipdata_->feasibilityJump();
analysis_.mipTimerStop(kMipClockFeasibilityJump);
if (options_mip_->mip_allow_feasibility_jump) {
// Apply the feasibility jump before evaluating the root node
analysis_.mipTimerStart(kMipClockFeasibilityJump);
mipdata_->feasibilityJump();
analysis_.mipTimerStop(kMipClockFeasibilityJump);
}
// Apply the trivial heuristics
analysis_.mipTimerStart(kMipClockTrivialHeuristics);
HighsModelStatus model_status = mipdata_->trivialHeuristics();
Expand Down

0 comments on commit 037e383

Please sign in to comment.