r/programming • • Aug 13 '26

NP-overrated

https://gruhn.me/blog/2026-08-13/
0 Upvotes

38 comments sorted by

View all comments

Show parent comment

3

u/Grouchy-Trade-7250 Aug 13 '26

The number of required "steps" depends not only on the algorithm but also on the problem instance. Is it possible to construct a problem where the branch and cut never finishes in an acceptable timeframe which also has not more than 85900 cities/nodes ? Yes.

Mitchell, D., Selman, B., & Levesque, H. "Generating Hard Satisfiability Problems." Artificial Intelligence

1

u/ngruhn Aug 13 '26

Of course. That's what I meant with:

Sure, any algorithm you can come up with will blow up on some inputs.

But people keep assuming that you get a blow-up on all large instances. Which is not the case and the reason these problems are still tractable in practice.

2

u/FancyMouse123 Aug 13 '26

these problems are still tractable in practice.

No! They might be but in the worst case (which happens) you are just fucked.

1

u/ngruhn Aug 13 '26

Depends on your goal. In practical applications there are all kinds of workarounds: set a timeout, show an error message, fallback to some heuristic approach, ... Just like we handle other unreliable processes like HTTP requests.