# Simple example: minimize max cost
cost <- matrix(c(1, 5, 3,
2, 4, 6,
7, 1, 2), nrow = 3, byrow = TRUE)
result <- bottleneck_assignment(cost)
result$bottleneck # Maximum edge cost in optimal assignment
# Maximize minimum (fair allocation)
profits <- matrix(c(10, 5, 8,
6, 12, 4,
3, 7, 11), nrow = 3, byrow = TRUE)
result <- bottleneck_assignment(profits, maximize = TRUE)
result$bottleneck # Minimum profit among all assignments
# With forbidden assignments
cost <- matrix(c(1, NA, 3,
2, 4, Inf,
5, 1, 2), nrow = 3, byrow = TRUE)
result <- bottleneck_assignment(cost)
Run the code above in your browser using DataLab