Skip to content

Commit

Permalink
HiGHS (LP solver): detect infeasible and unbounded subproblems
Browse files Browse the repository at this point in the history
  • Loading branch information
cvanaret committed Nov 11, 2024
1 parent e32ed44 commit 3652bd4
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 3652bd4

Please sign in to comment.