0

The aim is to guide a bot from Source S to Goal G while passing through all the checkpoints @ (in any order). The cells marked as # cannot be accessed. The bot can move on locations marked .

########
#@....G#
##.##@##
#..@..S#
#@.....#
########

One way to solve it would be to select one checkpoint as goal from current state and then guide the bot to it. Then select the next checkpoint as goal and current checkpoint as source and guide the bot to its new goal. Eventually guide it to the state G from the last checkpoint.

But this technique relies heavily on the order of checkpoints traversed.

I would like to know if a good heuristic can be found to decide which checkpoint to go to next?

Sinstein
  • 887
  • 11
  • 42
  • 1
    Isn't this kinda like the traveling salesman problem? – user541686 Aug 24 '14 at 06:11
  • @Mehrdad The bot does not really know the path lengths from each checkpoint to the next.There is the added constraint of inaccessible cell locations. Its similar, but I do not think its exactly the same. – Sinstein Aug 24 '14 at 06:16
  • if you are talking about machine learning then I believe you can make the goal is to collect all the checkpoint and the goal itself for each awarding a point, but collecting the G last would worst a lot of points. That way it should try collecting them all and G the last – MoonBun Aug 24 '14 at 06:19
  • @Vlapd Thats a good technique. I can award negative points to each non checkpoint cell to ensure the shortest path is found. – Sinstein Aug 24 '14 at 06:38

1 Answers1

1

I think this problem can be reduced to travelling salesman. Let S, G and @ be the nodes of the graph. Then compute the minimum distance between each pair of nodes, taking any walls into account. Then you have a graph with weighted distances between the points. Now this is TSP, with the small difference that you know the first and last node.

PMF
  • 14,535
  • 3
  • 23
  • 49
  • Yea, but one needs to know how. And I think the OP wasn't sure whether this problem is in NP. – PMF Aug 24 '14 at 07:42
  • 1
    The point of my comment was that if reducing a problem to TSP is pointless, because it's a notoriously tough problem to solve with heuristics or approximations. Either you should reduce *it* to something easier to show that it's an easier problem, or you should reduce TSP *to* it to show that it's at least as difficult as TSP. Reducing it to TSP is just about as useful as reducing binary search to TSP. – user541686 Aug 24 '14 at 07:50
  • Ok, maybe reducing was the wrong word here. Actually, I showed that the two problems are equivalent. And showing that this problem is equally complex than TSP is about the same as showing the opposite. Theoretical computer science was never my strongest topic, I'm more into practical applications :-s – PMF Aug 24 '14 at 15:51