A heuristic is a set of rules for solving problems or making decisions. In computer science, heuristics are the foundation of algorithms. Metaheuristics are larger principles or guidelines that establish the heuristics used to create algorithms.
Both heuristics and metaheuristics apply to computer programming. A heuristic applies to a specific problem, while a metaheuristic is a general guideline that is problem-independent. Developers use metaheuristics to produce consistent programming practices, while they develop heuristics for specific solutions.
For example, a software development team may build a search engine using both metaheuristics and heuristics. Below are examples of each:
The following metaheuristics apply to all search engines:
- create an index of searchable data to improve search efficiency
- use a "fuzzy search" to search for terms similar to keywords entered by the user, instead of only exact matches
- order results by most relevant to least relevant
The following heuristics may apply to a specific type of search engine:
- produce search results that are most relevant to the user's location
- customize search results based on information stored in the user's account
- use search history to provide a list of autocomplete search phrases
The first list above provides general guidelines for an effective search engine. The second list provides specific features a search engine should have. In some cases, heuristics and metaheuristics may overlap in their scope. The best way to distinguish between the two is to determine if it is a general rule (metaheuristic) or if it applies to a specific problem/solution (heuristic).