Skip to content

Commit

Permalink
Merge pull request #82 from cvanaret/highs_fix
Browse files Browse the repository at this point in the history
HiGHS (LP solver): detect infeasible and unbounded subproblems
  • Loading branch information
cvanaret authored Nov 11, 2024
2 parents e32ed44 + 3652bd4 commit 7831b52
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions uno/solvers/HiGHS/HiGHSSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,11 @@ namespace uno {
}
}



void HiGHSSolver::solve_subproblem(Direction& direction, size_t number_variables, size_t number_constraints) {
// solve the LP
HighsStatus return_status = this->highs_solver.passModel(this->model);
assert(return_status == HighsStatus::kOk);

return_status = this->highs_solver.run(); // solve
DEBUG << "HiGHS status: " << static_cast<int>(return_status) << '\n';

Expand All @@ -102,8 +101,18 @@ namespace uno {
direction.status = SubproblemStatus::ERROR;
return;
}
HighsModelStatus model_status = highs_solver.getModelStatus();
DEBUG << "HiGHS model status: " << static_cast<int>(model_status) << '\n';

// TODO check unbounded problems
if (model_status == HighsModelStatus::kInfeasible) {
direction.status = SubproblemStatus::INFEASIBLE;
return;
}
else if (model_status == HighsModelStatus::kUnbounded) {
direction.status = SubproblemStatus::UNBOUNDED_PROBLEM;
return;
}

direction.status = SubproblemStatus::OPTIMAL;
const HighsSolution& solution = this->highs_solver.getSolution();
// read the primal solution and bound dual solution
Expand Down

0 comments on commit 7831b52

Please sign in to comment.