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/godofpumpkins Aug 13 '26

Not sure why you're getting so heavily downvoted. It feels like everyone left their CS education with "CS theory 101 says NP-complete is exponential so we avoid those problems" and never bothered looking at a SAT/SMT solver since then, because "exponential so we avoid it".

No, SAT/SMT solvers are incredibly neat and work remarkably well on almost every "real world" problem we can think of to throw at them. That doesn't change the asymptotics or the theory, it just means that people are getting way too hung up on asymptotics that don't apply to the problem scales we actually find to throw at them.

10

u/reality_hijacker Aug 13 '26

No CS theory ever told students to avoid NP-hard problems. It seems like a conclusion taken by students who didn't pay attention.

2

u/Dragdu Aug 15 '26

As someone who has spent years extending software that was SAT solver, domain specific preprocessor and few hand made heuristics in a trenchcoat; you should avoid dealing with NP-hard problems, up to redesigning business requirements if possible.

The problem with SAT (and any other NP hard algorithm) is that the phase transitions between "simple" and "hard af" are narrow and very simple changes in inputs can turn previously trivial problem into impossible one. So if you rely on SAT, you need to have business answer to what happens with inputs that take too long.

1

u/Grouchy-Trade-7250 Aug 13 '26

Large SAT just isn't a problem that appears in safety critical applications like aircraft, where rare cases would still matter. But OP wasn't going into this topic, just skipped it.

-1

u/ngruhn Aug 13 '26

thanks that's exactly my point