Re: Optimize Order
Posted: Wed Jun 21, 2023 11:24 pm
I will make a video!
Dedicated forums for Garmin Zumo motorcycle satellite navigation. All questions answered from problems, route planning, touring to tips and tricks
https://mail.zumouserforums.co.uk/
Ok, so that is the complexity of it. But it gets worseYou have to start at A - because that is where you are. The other 3 can be chosen in 6 ways:
ABCD, ABDC, ACBD, ACDB, ADBC, ADCB
(You can work out the number of different ways for 3 towns - it is 3 x 2 x 1 = 6)
Then you need the shortest distance between each pair of towns. Lets make some up - making sure that the figures aren't impossible.
AB = 12m; AC = 15m; AD = 20m; BC = 18m; BD = 25m; CD = 30m
Then workout the distance for each of the possible calculations.
ABCD = AB BC CD = 12 + 18 + 30 = 60
ABDC = AB BD DC = 12 + 25 + 30 = 67
ACBD = AC CB BD = 15 + 18 + 25 = 58
ACDB = AC CB DB = 15 + 30 + 25 = 70
ADBC = AD DB BC = 20 + 25 + 18 = 63
ADCB = AD DC BC = 20 + 30 + 18 = 68
Find the smallest total mileage ....... 58 So ACBD is the shortest route
So - do we wait for the XT to calculate all of the possibilities to come up with the absolute best route. Or do we accept some compromise. If so, which compromises do we accept ?If you had a computer working at 1 GHz - 1 thousand million clock cycles every second. The 20! different 'clock ticks' in a computer running at 1000 million clock ticks per second ? It would take 77 years to complete that many clock cycles. And that is only clock cycles. Each separate route calculation would take hundreds / thousands of clock cycles.
Which is probably a tiny bit longer than most satnav users would want to wait for the optimal route to be calculated. So although this method gives the definitive answer no one who asked the question is going to be alive to see the result. So they don't do it this way. Instead , they have to come up with some clever algorithms that make the calculation shorter. Much shorter.
Example - you could put the location in order of latitude and visit them in order. But that may result in a zig-zag pattern - the points would be arranged north to south, but the locations could be one on the east coast, next on the west coast.
You could find the nearest main road that passes through the middle of all of the points. (Like a least squares regression analysis for the statistically minded). Find the best fit. And then just take detours off the fastest road.
You could cluster the points together and find the fastest way to the centre of each cluster. Then find the fastest way to do each cluster.
All these and many more. None of them will produce the definitive absolutley best route. The result will be faster than many other solutions, but it is unliekly to be the fastest. But it won't take 77 years to come up witht he answer.
That's interesting - I've just checked on of my saved test routes with 100 Via Points, and it loaded it in but split it into 4 different routes, the first 3 of which had 31 points. So I tried adding more to one with 31 points, and it accepted it - which is weird.