Best combination of values pulled from a matrix
It looks like the assignment problem, and it could be solved in $\mathcal O(n^3)$ using the Hungarian algorithm. In your case the $A$ is the cost matrix and the sum you are looking for is cost in the terms of algorithm.