Comment by almostgotcaught

2 years ago

> I'm not sure there is a clear separation between applying heuristics

There is and it's quite simple: if your heuristic reduces the size of your search space faster than it takes to perform the search (ie try solutions) then you have a real algo on your hands. Otherwise you're just searching. This is basically the border between P and NP and it's just that in compilers most of the problems are NP hard so none of the heuristics are really that good.

I disagree with this part of your comment:

> then you have a real algo on your hands

To me an algorithm is closed, while a heuristic (aka rule of thumb) is just a fast way to probably get a better solution / subset of the solution space at the cost of possibly missing the optimal result or even ending up in a pessimal corner case.

With an NP complete problem you'd rather have some solution rather than use up your lifetime searching for the best.

  • > To me an algorithm is closed

    i dunno what "closed" means here? converges? lots of things with heuristics converge...

    most things people think of as algorithms are just heuristics codified. take for example unit propagation in DPLL (fairly modern SAT approach); quoting wiki[1]

    > In practice, this often leads to deterministic cascades of units, thus avoiding a large part of the naive search space.

    that *in practice* there means there's no guarantee because ofc not - otherwise they would've proven something about NP. but they didn't, they just came up with a way to search that's sometimes/often not bad. a lot of people call this an algorithm ("... is a refinement of the earlier Davis–Putnam algorithm") because it fits the dictionary definiton (a repeatable process) but i do not because it's a repeatable process that isn't proven to produce anything (ie faster than brute force). and the intuition i'm proposing for why it doesn't is because it doesn't actually shrink the search space fast enough.

    note, my definitions/intuitions don't translate/have the same force elsewhere (especially in continuous/differentiable spaces) but they're a pretty standard/obvious perspective in combinatorial optimization (np-hard/np-complete problems).

    [1] https://en.wikipedia.org/wiki/DPLL_algorithm#The_algorithm