News for hackers. Stuff that matters.
Re:Pac-Man Proved NP-Hard by lkozma on Thursday January 26, 2012 @07:06PM (#3516588)
Say you want to prove your problem A is NP-hard and you know already that problem B is NP-hard. The fact that you can transform every instance of A to an instance of B does not prove anything, because it could be that you only create instances in a subset of B that are easy.

To prove that A is NP-hard, you have to do the opposite. Show how you transform every instance of B into an instance of A, so that a solution of A implies a solution of B. Then if you had a solver for A, you could use it to solve B, which is impossible unless P=NP (since B is known to be NP-hard). In this case, you have to transform TSP to Pac-Man, not the other way around. Some technicalities aside (which are important, nevertheless), this is how hardness proofs go, sorry if it was a bit obscure.

Re:Pac-Man Proved NP-Hard by joshAg on Thursday January 26, 2012 @08:13PM (#3516782)
Perfect thanks! not obscure at all; i did the inverse of the transform i was supposed to do.

Now it's clearer why he used a form of Pacman where pacman could only visit each node once, and why it's not as trivial as i made it seem.

Re:Pac-Man Proved NP-Hard by adgar on Thursday January 26, 2012 @07:29PM (#3516669)
To explain it even easier: every integer addition problem can be transformed into a TSP problem, but not vice-versa.
Re:Pac-Man Proved NP-Hard by joshAg on Thursday January 26, 2012 @08:14PM (#3516784)
that would be an awesome entry into a rube goldberg contest...
Re:Pac-Man Proved NP-Hard by adgar on Friday January 27, 2012 @12:16AM (#3517227)
Basic start to a rigorous solution:

Input: A, B : integers

Output: directed graph G(V, E, w) (V = vertices, E = edges, w = weight fn)

V = {c1, c2, c3}

E = {(c1, c2), (c2, c3), (c3, c1)}

w(c1, c2) = A

w(c2, c3) = B

w(c3, c1) = 0

shortest tour is the only valid tour whose length is clearly A + B.