for clustering fall back to ipopt when highs is solver

This commit is contained in:
Fabian Neumann 2023-12-06 11:07:04 +01:00
parent 1b88dc7660
commit a59eb821ff

View File

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