What is the difference between 'ad hoc' and 'heuristic'? [closed]

Solution 1:

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.

Solution 2:

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.