from itertools import permutations
import numpy as np

#              slot 0  slot 1  slot 2
cost = np.array([[0.8,  0.1,    0.5],   # cat
                 [0.2,  0.9,    0.4]])  # chair

assignments = permutations(range(cost.shape[1]), cost.shape[0])
best = min(
    assignments,
    key=lambda slots: sum(cost[i, j] for i, j in enumerate(slots)),
)

assert best == (1, 0)
print(best)  # cat -> slot 1, chair -> slot 0
# Slot 2 is supervised as no-object.
