Merge pull request #795 from PyPSA/highs-ipopt-cluster-fallback

for clustering fall back to ipopt when highs is solver
This commit is contained in:
Fabian Neumann 2023-12-11 14:01:16 +01:00 committed by GitHub
commit c560e216a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -271,7 +271,7 @@ def distribute_clusters(n, n_clusters, focus_weights=None, solver_name="cbc"):
)
opt = po.SolverFactory(solver_name)
if not opt.has_capability("quadratic_objective"):
if solver_name == "appsi_highs" or not opt.has_capability("quadratic_objective"):
logger.warning(
f"The configured solver `{solver_name}` does not support quadratic objectives. Falling back to `ipopt`."
)
@ -466,6 +466,7 @@ if __name__ == "__main__":
params = snakemake.params
solver_name = snakemake.config["solving"]["solver"]["name"]
solver_name = "appsi_highs" if solver_name == "highs" else solver_name
n = pypsa.Network(snakemake.input.network)