Ensure that scipy/numpy output is JSON-serializable
This commit is contained in:
parent
524275ae14
commit
a531041f3e
@ -143,6 +143,9 @@ def min_cost_perfect_bipartite_matching_scipy(G):
|
||||
n = len(G)
|
||||
rows, cols = linear_sum_assignment(G)
|
||||
assert (rows == list(range(n))).all()
|
||||
# Convert numpy array and integer to Python types,
|
||||
# to ensure that this is JSON-serializable.
|
||||
cols = list(int(e) for e in cols)
|
||||
return list(cols), matching_cost(G, cols)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user