Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

NP-hardness by definition is only yes-no decision problems. The NP-hard formulation of Traveling Salesman is "given the weighted graph G and an integer X, is there a Hamiltonian cycle in G with total weight less than X?"


You are using a non-standard definition of NP-hard. Here are standard definitions.

A problem is in P if there is a polynomial time algorithm to solve it.

A problem is in NP if there is a polynomial time algorithm to check a purported solution.

A problem is in NP-hard if, if there was a polynomial time algorithm to solve it, every problem in NP could be solved in polynomial time.

A problem is NP-complete if it is both in NP and in NP-hard.

For Traveling Salesman, the NP-complete problem is, "...find a solution with total weight less than X." (Linear verification, check it is Hamiltonian, check its weight.) An NP-hard version is, "...find whether there is a solution with total weight less than X." (To verify, you have to search. Oops.) But ANOTHER NP-hard version is, "...find the solution with least total weight". (To verify, you have to search. Oops.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: