Trying to solve large problems - Building Matrix

Hiyas, I always seem to be trying to solve large problems with many stops. Creating a symmetric distance matrix is always a pain point and I’m trying to think up ways to minimize it.
I’m talking problems with more than 1000 points.

Because there are lots of points, it means that more than likely, the points are relatively clumped together. I was thinking, doing an initial pass to remove calculating distances greater than say 300m
So if I assess point 1 through to 1000 in an initial pass, if (in the unlikely event) p1 to p600 and p1 to p700 is greater than 300m, then don’t work out p600 to p1, and p700 to p1.
This results in an initial pass able to remove two distance checks from GH (you would just set the distances to 9999 meaning JSprit won’t route them due to high cost)

I have assessed this in the past and the results are as such;
For 1021 delivery points;
Total connections 1021x1021 = 1,042,441
Execution time in seconds : 443.59357
Used < 150m : 37,686
Used >= 150m, < 200m : 19,014
Used >= 200m, < 250m : 24,022
Used >= 250m, < 300m : 28,406
Rejected >= 300m : 933,313

It would reject quite a few point to point calculations.
The initial pass would only need to work out distances in one direction because it is unlikely that 300m one way would have a significantly reduced distance the other way, but would need assessment.

Just more thinking out loud, but wondered if it makes sense? Or is there a better way?

Is the costMatrixBuilder.addTransportDistance(i, n, distance); thread safe?

I find that it slowly gets slower and slower when doing this via multiple threads at once.
If it is, is the workaround just to populate a separate Collections.synchronizedList(new ArrayList()); and building the matrix at the end?

Powered by Discourse