I have several points on a relatively small 2-dimensional grid that wraps in both dimensions. Coordinates can be integer. I need to divide them into sets of not more than N points that are close to each other, where N will be a fairly small cut-off, I suspect not more than 10.
I am developing an AI for the game, and I'm 99% sure that minimax on all game items will give me a useful look at about 1 turn if that happens. However, the remote game parts should not influence each other until we look ahead of a large number of moves, so I want to split the game into several sub-games N pieces at a time. However, I need to ensure that I select reasonable N pieces at a time, i.e. Those that are close to each other.
I don't care if the emissions themselves remain or are concentrated in their less distant cluster. The destruction of natural clusters, large N, is inevitable and should be reasonable. Since this is used in game AI with a limited response time, I am looking for an algorithm as quickly as possible and wish to compromise accuracy for performance.
Does anyone have any suggestions on using algorithms for adaptation? K-funds and relatives do not seem appropriate, since I do not know how many clusters I want to find, but I have a limit on how large clusters I want. I saw some evidence that approximating a solution by linking points to a grid can help some clustering algorithms, so I hope that the whole coordinates make the task easier. Distance-based hierarchical clustering will easily adapt to rounding coordinates, as I simply connect another distance function, and also relatively close the cluster size. Are there any other ideas I should look at?
I'm more interested in algorithms than libraries, although libraries with good documentation on how they work will be welcome.
EDIT . I originally asked this question when I was working on a Fall 2011 AI Challenge record, which I, unfortunately, never finished. The page I'm connected to has a fairly short, fairly high-level description of the game.
Two key points:
- Each player has a potentially large number of ants.
- Each ant receives orders for each revolution, moving 1 square either north, south, east or west; this means that the branching coefficient of the game is O (4 ants ).
The competition also had strict time limits for each bot turn. I thought to approach the game using minimax (the turns are actually simultaneous, but as a heuristic, I thought that everything would be fine), but I was afraid that there would be no time to look ahead a lot of moves if I considered the whole game once. But since each ant moves only one square per turn, two ants cannot N spaces from each other along the shortest route, they may interfere with each other until we look ahead N / 2 moves.
So, the solution I was looking for was a good way to select smaller groups of ants at a time and minimize each group separately. I was hoping this would allow me to search deeper in the tree without losing accuracy. But obviously, it makes no sense to use a very expensive clustering algorithm as a time-saving heuristic!
I am still interested in the answer to this question, although more in what I can learn from the technician than for this particular competition, since it ended! Thanks for all the answers.