weights = {"effectiveness": 0.4, "reach": 0.2, "cost": 0.2, "equity": 0.2}
programs = {
"Municipal depot": {"effectiveness": 4, "reach": 3, "cost": 4, "equity": 2},
"Refurbisher": {"effectiveness": 3, "reach": 2, "cost": 3, "equity": 5},
}
def score(ratings, weights):
return sum(weights[c] * ratings[c] for c in weights)
for name, ratings in programs.items():
print(f"{name}: {score(ratings, weights):.1f}")
weights["equity"], weights["effectiveness"] = 0.4, 0.2
print("With equity weighted 0.4:")
for name, ratings in programs.items():
print(f"{name}: {score(ratings, weights):.1f}")
A weighted decision matrix as dictionaries. Changing the weights changes the ranking.