cluster: add tolerance to country weight sum L

This commit is contained in:
Fabian Neumann 2019-11-09 12:58:04 +01:00
parent 0ea5a5c28f
commit 3fd5c5d0e1

View File

@ -176,7 +176,7 @@ def distribute_clusters(n, n_clusters, focus_weights=None, solver_name=None):
logger.warning('Using custom focus weights for determining number of clusters.')
assert L.sum() == 1.0, "Country weights L must sum up to 1.0 when distributing clusters."
assert np.isclose(L.sum(), 1.0, rtol=1e-3), "Country weights L must sum up to 1.0 when distributing clusters. Is {}.".format(L.sum())
m = po.ConcreteModel()
def n_bounds(model, *n_id):