A bit of a maths question
Any maths geeks here?
Suppose I have a grid 100 by 100.
on the grid are 100 randomly placed points, your starting point is another random place on this grid.
what is the most efficient way to plot a path the that passes through all the 100 points. So not simply finding the shortest path, as this generally requires computing every possible path and comparing them. Does any one know any good ways to calculate a short path efficiently?
Suppose I have a grid 100 by 100.
on the grid are 100 randomly placed points, your starting point is another random place on this grid.
what is the most efficient way to plot a path the that passes through all the 100 points. So not simply finding the shortest path, as this generally requires computing every possible path and comparing them. Does any one know any good ways to calculate a short path efficiently?
- If you can't explain it simply, you don't understand it well enough. Albert Einstein
- An arrow can only be shot by pulling it backward. So when life is dragging you back with difficulties. It means that its going to launch you into something great. So just focus and keep aiming.
Linkin Profile - Blog: http://Devilwah.com
Comments
-
N2IT Inactive Imported Users Posts: 7,483 ■■■■■■■■■■Does these points have values?
I was thinking you could create your columns and rows with specific data relating to your array. Then create a chart in Excel (X Y Scatter). That will plot your data points. You can then go into the chart and select select data and then select hidden and empty cells. In there you could try the options in there. Maybe try Zero and make sure the show data in hidden rows and columns is checked. -
DevilWAH Member Posts: 2,997 ■■■■■■■■□□OK to make it a bit clearer see attachment.
Starting from the read square plot the shortest route through the orange points.
Now do the same for a grid 1000 X 1000 with 5000 points on it?
I know how to do it long hand, but I want to know if there is an algrathem that can do it efficiently, with out testing every possibility.
The long hand way to do it is to draw the shortest path between every single point and every other point.
Then create a list of possibly sequences that use these routes and take you through every point once. Starting at the Red Square
Compare this list and calculate the shortest one.
but for this to work there is an expodentioal increase in the number of possible paths each time you add a point. If n is the number of points minus 1, then number of links between all points is
(n²+n)/2
so for 500 points its about 12million paths.
then total possible routes!! I forget the equation but its going to be a fair few sever powers of 12.5 million. And all this is going to take some time to computer.- If you can't explain it simply, you don't understand it well enough. Albert Einstein
- An arrow can only be shot by pulling it backward. So when life is dragging you back with difficulties. It means that its going to launch you into something great. So just focus and keep aiming.
Linkin Profile - Blog: http://Devilwah.com -
N2IT Inactive Imported Users Posts: 7,483 ■■■■■■■■■■Wouldn't the total number of paths from 500 points be 124750? I don't understand how you are getting 12.5 million.
-
DevilWAH Member Posts: 2,997 ■■■■■■■■□□Cause I missed out a 0. I original put 5000 points in a 1000 square grid. But thenade a typo.
But the number are just examples. I just looking for ways to speed up working it out.
Suppose this is the classic traveling salesman issue. You c
an't be sure unless you test them all.- If you can't explain it simply, you don't understand it well enough. Albert Einstein
- An arrow can only be shot by pulling it backward. So when life is dragging you back with difficulties. It means that its going to launch you into something great. So just focus and keep aiming.
Linkin Profile - Blog: http://Devilwah.com -
RobertKaucher Member Posts: 4,299 ■■■■■■■■■■I would say that if the points cannot report in with their locations and neighbors then the only way to do it is test every possible path.
Having an algorithm figure things out is just not possible if the dots are in fact randomly placed. I'm not sure how one could mathematically derive order from random events. -
nhpr Member Posts: 165Anyone who has a good answer to this problem can make some money: https://en.wikipedia.org/wiki/Travelling_salesman_problem#Computing_a_solution
-
DevilWAH Member Posts: 2,997 ■■■■■■■■□□Anyone who has a good answer to this problem can make some money: https://en.wikipedia.org/wiki/Travelling_salesman_problem#Computing_a_solution
that's what i wast thinking and could not think of the name of these types of issues. NP problems, you cant confirm you have the correct answer with out testing all possibility's.
I noted on that page "85,900 points was solved using Concorde TSP Solver, taking over 136 CPU-years"
However things like Sat NAvs' use algorithmins to find routes with out calculating ever possibility, I have been looking around and there do seem to be quick ways to get with in 1or 2% of the shortest path. going to look in to these a bit.- If you can't explain it simply, you don't understand it well enough. Albert Einstein
- An arrow can only be shot by pulling it backward. So when life is dragging you back with difficulties. It means that its going to launch you into something great. So just focus and keep aiming.
Linkin Profile - Blog: http://Devilwah.com -
ChooseLife Member Posts: 941 ■■■■■■■□□□Any maths geeks here?
Suppose I have a grid 100 by 100.
on the grid are 100 randomly placed points, your starting point is another random place on this grid.
what is the most efficient way to plot a path the that passes through all the 100 points. So not simply finding the shortest path, as this generally requires computing every possible path and comparing them. Does any one know any good ways to calculate a short path efficiently?
The grid can be transformed into a complete graph with points as vertexes and shortest distances between pairs of points as edge weights. Then all possible Hamiltonian cycles can be calculated and their weights compared with each other.
This looks like the most intuitive approach, meaning that very likely less intuitive but more computationally efficient algorithms exist.“You don’t become great by trying to be great. You become great by wanting to do something, and then doing it so hard that you become great in the process.” (c) xkcd #896
GetCertified4Less - discounted vouchers for certs