Minimize Total Assignment Distance
Problem Description
You are given the coordinates of n analysts and m field devices on a 2D grid. The constraints are 1 <= n <= 10 and n <= m <= 15.
Each analyst must be assigned exactly one distinct device, and each device can be assigned to at most one analyst.
The cost of assigning analyst i at (ax[i], ay[i]) to device j at (dx[j], dy[j]) is the Manhattan distance:
|ax[i] - dx[j]| + |ay[i] - dy[j]|
Objective
Return the minimum possible total assignment cost after assigning a unique device to every analyst.
Task
Design an algorithm efficient enough for the given constraints.
AI interview prep
Core dilemma
Finding the globally optimal assignment in a combinatorial search space, balancing computational complexity with correctness for a constrained matching problem.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Minimize Total Assignment Distance
Problem Description
You are given the coordinates of n analysts and m field devices on a 2D grid. The constraints are 1 <= n <= 10 and n <= m <= 15.
Each analyst must be assigned exactly one distinct device, and each device can be assigned to at most one analyst.
The cost of assigning analyst i at (ax[i], ay[i]) to device j at (dx[j], dy[j]) is the Manhattan distance:
|ax[i] - dx[j]| + |ay[i] - dy[j]|
Objective
Return the minimum possible total assignment cost after assigning a unique device to every analyst.
Task
Design an algorithm efficient enough for the given constraints.