Live data from Hacker News

The N-Queens completion problem is NP-hard

atlasobscura.com

51–57 of 57 posts

Re: The N-Queens completion problem is NP-hard

#51

Is there a proof somewhere which states that all NP hard problem can have a similar / generic solution? I find it more likely that the N-Queens problem will have a very specific solution

Problems in NP hard that are also in NP are known as NP-complete. NP complete problems share the characteristic that all problems in P can be reduced to any NP problem in polynomial time (which is to say: you can encode P problems as particular instances of NP problems). Therefore, if P = NP, all problems in NP are reducible to one another.

Re: The N-Queens completion problem is NP-hard

#52
post #33

Earlier quoted context omitted.

I don't know why you're being downvoted. When Computer Scientists talk about "fast" they generally mean that an algorithm is solvable in `n^k` steps, with `n` being based on the size of the input (1000 or 1000000 in your example) and `k` being a constant. Algorithms that follow that rule are called Polynomial, or P for short. A lot of problems require more steps (e.g. `2^n` steps) as far as we know, but if you have a…

Isn't 2^n an exponential algorithm. I thought NP algos are still n^k but non-deterministic.

Both. As I understand it, polynomial time in a non-deterministic machine can be simulated as exponential time in a deterministic machine

Re: The N-Queens completion problem is NP-hard

#53
post #40
post #38

Earlier quoted context omitted.

> Do you mean that it's #P and not a priori NP? Counting problems can sometimes be in NP by deciding whether the count is the correct one (with the right encoding, function problems can be thought of as a subset of decision problems). It is unlikely that a #P-complete problem Essentially, #P is the class of problems where you compute the number of accepting runs for some problem in NP, so yes, #P and NP are closely r…

Yes, changing the encoding can change the complexity, but I was taking issue with "because it is #P it cannot be NP,' which is what I got out of > Counting solutions is not a decision problem, so it can't be in NP. Is this just a statement that it is a category error to compare the set of function problems with the set of decision problems? Sure, that's true, but you can still ask questions like "does this #P problem…

> Sure, that's true, but you can still ask questions like "does this #P problem have a polynomial reduction to an NP problem."

That's an ill-posed question though. NP is not closed under polynomial Turing reductions (otherwise we had NP = coNP), so some problem Q being polynomially Turing-reducible to some other problem S in NP does not tell you anything about the complexity of Q. Other notions of polynomial reductions, in particular polynomial many-one reductions, don't apply, because the require both problems to be decision problems. So while you can indeed ask such a question, it doesn't make much sense to do so.

Coming back to the problem at hand, consider what a polynomial certificate would look like that assures that no further solutions existed (if “does the n-queens problems have exactly m solutions” were in NP, such a certificate must exist), and how it could be verified in polynomial time (i.e., without checking each other solution candidate).

> Do you have a citation for counting n-queens solutions (not completions like in the featured paper) being #P-hard? (or NP-hard?)

Jieh Hsiang, D.Frank Hsu, Yuh-Pyng Shieh, On the hardness of counting problems of complete mappings, Discrete Mathematics, Volume 277, Issue 1, 2004, Pages 87-100, ISSN 0012-365X, http://dx.doi.org/10.1016/S0012-365X(03)00176-6. (http://www.sciencedirect.com/science/article/pii/S0012365X03...)

Note that they assume a binary encoding of n, and hence get “beyond #P.”

Re: The N-Queens completion problem is NP-hard

#54

Earlier quoted context omitted.

If I'm reading it right, they haven't shown that the N Queens problem is NP-hard, but rather that the N Queens completion problem is NP-hard.

Yes (one of the authors here), the press release came out very badly. The reference to the Clay prize was to try to demonstrate that lots of people care about solving NP-complete problems in general... N-Queens has long been known to polynomial time (although there is no known efficient way of counting the total number of solutions). We showed N-Queens completion is NP-hard. This is (in my opinion) interesting to peo…

[deleted]

Re: The N-Queens completion problem is NP-hard

#55
post #9

What you is fast in this case? If you can solve 1,000 x 1,000 in say 1 minute is that fast? Or do you need to solve 1,000,000 x 1,000,000 in a second?

If you can solve it at all for even 50x50 would mean a revolution in certain algorithmic fields.

That is surprising.

Can you point me to a concrete reference about the 50x50 number?

Modern SAT solvers should be able to handle that, maybe with a few problem specific tweaks.

Re: The N-Queens completion problem is NP-hard

#56
post #42

Earlier quoted context omitted.

> Counting solutions is #P-complete, though. Are you sure? Where was this proven? It could easily be that http://oeis.org/A000170 had a polynomial time combinatorial formula. Maybe some completion-counting problem could be shown to be #P-complete though.

If you read the cites on that link, you'll see that the value for 26 was only added in 2016. They do not have a closed form formula, or they would have shown it. I mean, they could just be slow revealing. I doubt it, though.

Computational hardness doesn't depend on whether anybody knows an efficient algorithm. Just whether one exists.

Re: The N-Queens completion problem is NP-hard

#57
post #42

Earlier quoted context omitted.

If you read the cites on that link, you'll see that the value for 26 was only added in 2016. They do not have a closed form formula, or they would have shown it. I mean, they could just be slow revealing. I doubt it, though.

Computational hardness doesn't depend on whether anybody knows an efficient algorithm. Just whether one exists.

Fair enough. I was obviously reading the above as having a polynomial time as having an efficient time one. Where efficient was shorthand for "quick." Both leaps, I concede were misguided.
Post reply on HN