Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 27, 2025
1 parent bad57f8 commit cf4bed8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scripts/cluster_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@
from functools import reduce

import geopandas as gpd
import linopy
import numpy as np
import pandas as pd
import linopy
import pypsa
from _helpers import (
REGION_COLS,
Expand Down Expand Up @@ -338,15 +338,16 @@ def distribute_clusters(

m = linopy.Model()
clusters = m.add_variables(
lower=1, upper=N, coords=[L.index], name="n", integer=True)

lower=1, upper=N, coords=[L.index], name="n", integer=True
)

m.add_constraints(clusters.sum() == n_clusters, name="tot")
m.objective = (
clusters * clusters - 2 * clusters * L * n_clusters
) # + (L * n_clusters) ** 2 (constant)
if solver_name == "gurobi":
logger.getLogger("gurobipy").propagate = False

m.solve(solver_name=solver_name)
return m.solution["n"].to_series().astype(int)

Expand Down

0 comments on commit cf4bed8

Please sign in to comment.