Algorithm to find optimal point coordinates
Kind time of day! Would like to learn, what algorithm it is possible to solve the following problem. 

Let's allow that there is a matrix of approachibilities of the N*M size (N, M&gt; = 500), a matrix of costs of N*M and K of points with coordinates (x1, y1), (x2, y2)..., (xk, yk)

In a matrix of costs movement cost from a point of I (by xi, yi) in J point (xj, yj) is described. Thus cost is a tupple of two elements: tij - time for moving from i point to j and dij - distance between i and j points. If time is has more priority, it is necessary to take a point to which the distance is the smallest.

There are K of points (P1, P2, P3, P4). It is necessary to find such a point X which cost would be minimum.

The K is much smaller than N, M

![enter image description here][1]


  [1]: http://i.stack.imgur.com/pMJKc.png
Algorithm to find optimal point coordinates
===

Kind time of day! Would like to learn, what algorithm it is possible to solve the following problem. 

Let's allow that there is a matrix of approachibilities of the N*M size (N, M&gt; = 500), a matrix of costs of N*M and K of points with coordinates (x1, y1), (x2, y2)..., (xk, yk)

In a matrix of costs movement cost from a point of I (by xi, yi) in J point (xj, yj) is described. Thus cost is a tupple of two elements: tij - time for moving from i point to j and dij - distance between i and j points. If time is has more priority, it is necessary to take a point to which the distance is the smallest.

There are K of points (P1, P2, P3, P4). It is necessary to find such a point X which cost would be minimum.

The K is much smaller than N, M

![enter image description here][1]


  [1]: http://i.stack.imgur.com/pMJKc.png