Recommendations for Splitting Large Matrices
Assume that the large matrix MxN is a matrix that exceeds the Routing API v7 limits. When M is the number of starts and N is the number of destinations, the matrix should be split for computation as suggested in the table below to get results within an optimal response time.
Matrix dimension type | Split method | Example |
---|---|---|
Large vector 1xN | Maximize the number of destinations per request. | Split vector 1x5043 into 50 1x100 requests and one (1) 1x43 request. This results in a total of 51 requests. |
Large vector Mx1 | Maximize the number of starts per request. | Split vector 5043x1 into 50 100x1 requests and one (1) 43x1 request. This results in a total of 51 requests. |
Large matrix MxN, where N > 1 and M > 100*N | Maximize the number of starts per request with one destination. | Split the matrix 5043x20 into 20 separate instances of 50 100x1 requests and one (1) 43x1 request. The total is calculated as follows: 20*(50+1) = 1020 requests. |
Large matrix MxN, where M > 1 and N > 1 | Maximize number of starts and destinations per request. | Split the matrix 3000x4043 into 200 separate instances of 40 15x100 requests and one (1) 15x43 request. The total is calculated as follows: 200*(40+1) = 8200 requests. |
If you need to further improve your response times, group the destinations that are close to each other in requests. The closer destinations are to each other in a request, the shorter the response time tends to be. This is an approach that you can use in cases where you maximize the number of destinations.
You can use a similar approach in cases where you maximize the number of starts by grouping starts that are close to each other in requests.