Merge pull request #841 from PyPSA/print-IIS

print IIS if solver returns status infeasible
This commit is contained in:
Fabian Neumann 2024-01-03 13:49:27 +01:00 committed by GitHub
commit 456da8d2d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -81,6 +81,9 @@ Upcoming Release
* Remove HELMETH option.
* Print Irreducible Infeasible Subset (IIS) if model is infeasible. Only for
solvers with IIS support.
**Bugs and Compatibility**
* A bug preventing custom powerplants specified in ``data/custom_powerplants.csv`` was fixed. (https://github.com/PyPSA/pypsa-eur/pull/732)

View File

@ -839,6 +839,9 @@ def solve_network(n, config, solving, opts="", **kwargs):
f"Solving status '{status}' with termination condition '{condition}'"
)
if "infeasible" in condition:
labels = n.model.compute_infeasibilities()
logger.info("Labels:\n" + labels)
n.model.print_infeasibilities()
raise RuntimeError("Solving status 'infeasible'")
return n