Skip to content

Commit 9e23d73

Browse files
committed
Add more descriptive error message for when model is infeasible
This should help users track down the source of the problem a bit more easily.
1 parent 0acd746 commit 9e23d73

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/simulation/optimisation.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ pub fn solve_optimal(model: highs::Model) -> Result<highs::SolvedModel> {
161161
.map_err(|err| anyhow!("Incoherent model: {err:?}"))?;
162162

163163
let status = solved.status();
164+
ensure!(
165+
status != HighsModelStatus::Infeasible,
166+
"The solver has indicated that the problem is infeasible. It may be because the assets in \
167+
this year cannot meet the required demand."
168+
);
164169
ensure!(
165170
status == HighsModelStatus::Optimal,
166171
"Could not find optimal result for model: {status:?}"

0 commit comments

Comments
 (0)