In engineering people tend to (at least in my mind) use these two terms pretty loosely. Now I don't care about the informal slang usage of the term, I just wish to know what is the difference in their precise definition and how these terms are used when used correctly.

For example, in the field of VLSI, or machine learning or some other field where the final design is not designed through from purely mathematically or theoretically accurate perspective (meaning theory cannot be used to verify or to predict the performance of your design), but through tuning or trial and error, or design through experience, in those cases you would hear people say...

"That method is totally heuristic...you just plug in data until the algorithm works"


"There are better ways to do it but the method is pretty much ad hoc"

What is the precise usage of the two terms?

  • 1
    Have you considered a dictionary?
    – Robusto
    Nov 4, 2015 at 0:26
  • @Robusto: A good suggestion as far as it goes. However, the word "heuristic" is a slippery little devil; at least I've found it to be so. Just when you think you "have it," it disappears--poof!--in a wisp of smoke. To grasp--really grasp--a word sometimes requires more than just reading its definition a few hundred times. A really good metaphor can open the floodgates of understanding for me, but it has to come from someone who grasps the concept I'm struggling to understand. In other words, to me a really good metaphor is highly heuristic, and it enlarges and enhances my understanding. Nov 4, 2015 at 1:05
  • 1
    @rhetorician: It doesn't take more than a dictionary to see a difference between these two. A heuristic is a rule of thumb - always. Ad hoc has nothing to do with heuristic. A heuristic could be ad hoc or involve things that are ad hoc, or not. Something ad hoc need not be, and in general is not, connected in any way with a rule of thumb.
    – Drew
    Nov 4, 2015 at 2:51
  • 1
    @Drew: If you would be so kind, please check out this question posted by moi. english.stackexchange.com/questions/190361/… Nov 5, 2015 at 5:06
  • @rhetorician: Yes, interesting; thanks. I was aware of that connotation. A good example of a bridge between the two is Polya's How to Solve It (and not just the part labeled "Heuristics"). I still stand by what I said about a dictionary being enough to tell the difference between ad hoc and heuristic (but probably saying it is always a rule of thumb is extreme). Unless, that is, you have an equally heuristic link to an interesting connotation of ad hoc. ;-)
    – Drew
    Nov 5, 2015 at 5:46

2 Answers 2


In computer science, a heuristic is a technique used to find a solution more quickly by making some sort of sacrifice with respect to accuracy, precision, completeness, etc. This usually has to do with solutions that cannot be calculated exactly, but must be tested for some kind of value. For example, one might have a graph of weighted routes, and be tasked with finding the optimal route from one point within the graph to the other. For small graphs, doing an exhaustive search of every possible route is trivial. However, as the size of the graph grows, the cost of exhaustively searching it does, too. If an approximate solution is acceptable, then you might begin implementing some heuristics to take some shortcuts and eliminate chunks of solutions that probably aren't worth checking. So, you might automatically throw out any route with a cost higher than some threshold, or pursue lower-cost routes first, etc. You effectively reduce the time taken to find a solution in exchange for no longer being able to guarantee that it is truly the best solution out of the entire set.

In the context of computer science, if a particular method is ad hoc, then it was created specifically for solving one particular problem at a particular point in time, rather than being a systematic approach to solving a more general set of problems. Essentially, it only does one thing, and cannot be used for anything else without modification.

The two terms really have little to do with each other, other than the fact that they're both used in the context of computer science. They're neither synonymous nor antonymous.

In the first example you give, I believe the term "heuristic" is being used improperly. I can't say for sure without further context, though.


In your context I would say:

Heuristic refers to a method. It can be and usually is a regularly used method. It is a procedure that has been put together to achieve a result for a particular kind of problem. It usually works but the rules may be ill-defined or approximate.

Ad hoc - refers to a one-off solution that was invented for the specific problem at hand.

Not the answer you're looking for? Browse other questions tagged or ask your own question.