Heuristic (computer science)
admin
2024-03-01 19:02:29
0

In mathematical optimization and computer science, heuristic (from Greek εὑρίσκω “I find, discover”) is a technique designed for solving a problem more quickly when classic methods are too slow or for finding an approximate solution when classic methods fail to find any exact solution. This is achieved by trading optimality, completeness, accuracy, or precision for speed. In a way, it can be considered a shortcut.

A heuristic function, also simply called a heuristic, is a function that ranks different in search algorithms at each branching step based on available information to decide which branch to follow. For example, it may approximate the exact solution.

Contents

  • 1 Definition and motivation
  • 2 Trade-off
  • 3 Examples
    • 3.1 Simpler problem
    • 3.2 Travelling salesman problem
    • 3.3 Search
    • 3.4 Newell and Simon: heuristic search hypothesis
    • 3.5 Antivirus software
  • 4 Pitfalls
  • 5 Etymology
  • 6 See also

1 Definition and motivation

The objective of a heuristic is to produce a solution in a reasonable time frame that is good enough for solving the problem at hand. This solution may not be the best of all the solutions to this problem, or it may simply approximate the exact solution. But it is still valuable because finding it does not require a prohibitively long time.

Heuristics may produce results by themselves, or they may be used in conjunction with optimization algorithms to improve their efficiency (e.g., they may be used to generate good seed values).

Results about NP-hardness in theoretical computer science make heuristics the only viable option for a variety of complex optimization problems that need to be routinely solved in real-world applications.

Heuristics underlie the whole field of Artificial Intelligence and the computer simulation of thinking, as they may be used in situations where there are no known algorithms.

2 Trade-off

The trade-off criteria for deciding whether to use a heuristic for solving a given problem include the following:

  • Optimality: When several solutions exist for a given problem, does the heuristic guarantee that the best solution will be found? Is it actually necessary to find the best solution?
  • Completeness: When several solutions exist for a given problem, can the heuristic find them all? Do we actually need all solutions? Many heuristics are only meant to find one solution.
  • Accuracy and precision: Can the heuristic provide a confidence interval for the purported solution? Is the error bar on the solution unreasonably large?
  • Execution time: Is this the best known heuristic for solving this type of problem? Some heuristics converge faster than others. Some heuristics are only marginally quicker than classic methods, in which case the ‘overhead’ on calculating the heuristic might have negative impact.

In some cases, it may be difficult to decide whether the solution found by the heuristic is good enough, because the theory underlying heuristics is not very elaborate.

3 Examples

3.1 Simpler problem

One way of achieving the computational performance gain expected of a heuristic consists of solving a simpler problem whose solution is also a solution to the initial problem.

3.2 Travelling salesman problem

An example of approximation is described by Jon Bentley for solving the travelling salesman problem (TSP):

  • “Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city?”

so as to select the order to draw using a pen plotter. TSP is known to be NP-hard so an optimal solution for even a moderate size problem is difficult to solve. Instead, the greedy algorithm can be used to give a good but not optimal solution (it is an approximation to the optimal answer) in a reasonably short amount of time. The greedy algorithm heuristic says to pick whatever is currently the best next step regardless of whether that prevents (or even makes impossible) good steps later. It is a heuristic in the sense that practice indicates it is a good enough solution, while theory indicates that there are better solutions (and even indicates how much better, in some cases).

3.3 Search

Another example of heuristic making an algorithm faster occurs in certain search problems. Initially, the heuristic tries every possibility at each step, like the full-space search algorithm. But it can stop the search at any time if the current possibility is already worse than the best solution already found. In such search problems, a heuristic can be used to try good choices first so that bad paths can be eliminated early (see alpha-beta pruning). In the case of best-first search algorithms, such as A* search, the heuristic improves the algorithm’s convergence while maintaining its correctness as long as the heuristic is admissible.

3.4 Newell and Simon: heuristic search hypothesis

In their Turing Award acceptance speech, Allen Newell and Herbert A. Simon discuss the heuristic search hypothesis: a physical symbol system will repeatedly generate and modify known symbol structures until the created structure matches the solution structure. Each following step depends upon the step before it, thus the heuristic search learns what avenues to pursue and which ones to disregard by measuring how close the current step is to the solution. Therefore, some possibilities will never be generated as they are measured to be less likely to complete the solution.

A heuristic method can accomplish its task by using search trees. However, instead of generating all possible solution branches, a heuristic selects branches more likely to produce outcomes than other branches. It is selective at each decision point, picking branches that are more likely to produce solutions.

3.5 Antivirus software

Antivirus software often uses heuristic rules for detecting viruses and other forms of malware. Heuristic scanning looks for code and/or behavioral patterns common to a class or family of viruses, with different sets of rules for different viruses. If a file or executing process is found to contain matching code patterns and/or to be performing that set of activities, then the scanner infers that the file is infected. The most advanced part of behavior-based heuristic scanning is that it can work against highly randomized self-modifying/mutating (polymorphic) viruses that cannot be easily detected by simpler string scanning methods. Heuristic scanning has the potential to detect future viruses without requiring the virus to be first detected somewhere else, submitted to the virus scanner developer, analyzed, and a detection update for the scanner provided to the scanner’s users.

4 Pitfalls

Some heuristics have a strong underlying theory; they are either derived in a top-down manner from the theory or are arrived at based on either experimental or real world data. Others are just rules of thumb based on real-world observation or experience without even a glimpse of theory. The latter are exposed to a larger number of pitfalls.

When a heuristic is reused in various contexts because it has been seen to “work” in one context, without having been mathematically proven to meet a given set of requirements, it is possible that the current data set does not necessarily represent future data sets (see: overfitting) and that purported “solutions” turn out to be akin to noise.

Statistical analysis can be conducted when employing heuristics to estimate the probability of incorrect outcomes. To use a heuristic for solving a search problem or a knapsack problem, it is necessary to check that the heuristic is admissible. Given a heuristic function h(vi,vg){\displaystyle h(v_{i},v_{g})}h(vi​,vg​) meant to approximate the true optimal distance d⋆(vi,vg){\displaystyle d^{\star }(v_{i},v_{g})}d⋆(vi​,vg​) to the goal node vg{\displaystyle v_{g}}vg​ in a directed graph G{\displaystyle G}G containing n{\displaystyle n}n total nodes or vertices labeled v0,v1,⋯,vn{\displaystyle v_{0},v_{1},\cdots ,v_{n}}v0​,v1​,⋯,vn​, “admissible” means roughly that the heuristic underestimates the cost to the goal or formally that h(vi,vg)≤d⋆(vi,vg)h(vi,vg){\displaystyle h(v_{i},v_{g})\leq d^{\star }(v_{i},v_{g})}h(v_{i},v_{g})h(vi​,vg​)≤d⋆(vi​,vg​)h(vi​,vg​) for all (vi,vg){\displaystyle (v_{i},v_{g})}(vi​,vg​) where i,g∈[0,1,...,n]{\displaystyle {i,g}\in [0,1,...,n]}i,g∈[0,1,...,n].

If a heuristic is not admissible, it may never find the goal, either by ending up in a dead end of graph G{\displaystyle G}G or by skipping back and forth between two nodes vi{\displaystyle v_{i}}vi​ and vj{\displaystyle v_{j}}vj​ where i,j≠g{\displaystyle {i,j}\neq g}i,j​=g.

5 Etymology

Look up heuristic in Wiktionary, the free dictionary.
The word “heuristic” came into usage in the early 19th century. It is formed irregularly from the Greek word heuriskein, meaning “to find”.

6 See also

  • Algorithm
  • Constructive heuristic
  • Genetic algorithm
  • Heuristic
  • Heuristic routing
  • Heuristic evaluation: Method for identifying usability problems in user interfaces.
  • Metaheuristic: Methods for controlling and tuning basic heuristic algorithms, usually with usage of memory and learning.
  • Matheuristics: Optimization algorithms made by the interoperation of metaheuristics and mathematical programming (MP) techniques.
  • Reactive search optimization: Methods using online machine learning principles for self-tuning of heuristics.
  • Recursion (computer science)
  • Macro (computer science)

相关内容

热门资讯

A股异动 | 光伏股午后集体拉... 光伏股午后集体拉升,晶科能源20cm直线涨停,欧普泰涨超25%,协鑫集成、天合光能涨超8%。消息面上...
如何合理运动助力牛皮癣皮损恢复 运动能帮助银屑病皮损恢复 生命在于运动。热爱运动的人往往精力旺盛,对生活充满热情。当然,银屑病患者进...
越跌越买!“抄底”资金加仓 来源:中国证券报 01 2月3日,A股市场探底回升。资源类ETF中,黄金、有色、矿业等多个主题ETF...
煤炭股集体上涨 兖矿能源H股盘... 上证报中国证券网讯(林铭溱 记者 刘逸鹏)2月4日,兖矿能源H股盘中涨超10%,最高报12.42港元...
多次称赞中国光伏技术领先后,马... 在多次称赞中国光伏技术领先后,马斯克团队密访中国多家头部光伏企业,A股“太空光伏”概念爆发! 2月4...
调查!“密码按烂了都买不进”,... 本报(chinatimes.net.cn)记者付乐 北京报道 “眼看着金价跌了40分钟,至少指纹识别...
注意力:决定孩子学习差距的“隐... 在日常学习中,我们常常会发现一个普遍现象:同样的课堂、同样的作业、同样的老师,孩子们的学习效果却天差...
蚂蚁阿福升级“长辈模式”:超大... 勇砺商业评论 阿桶观察 白丽 2月4日消息,蚂蚁阿福App近日完成重要升级,上线专为老年用户设计的“...
佑威新材重启北交所上市:深主板... 瑞财经 王敏 2月4日,浙江佑威新材料股份有限公司(以下简称“佑威新材”)在浙江监管局启动IPO辅导...
中信消费金融被罚105万元,因... 近日,中国人民银行北京市分行发布行政处罚决定信息公示表(银京罚决字〔2026〕1-2号)显示,中信消...
韩文秀:今年要规范承包地经营权... 中央财办分管日常工作的副主任、中央农办主任韩文秀4日在国务院新闻办新闻发布会上表示,今年要规范承包地...
揭秘哈登为何加盟骑士 为养老还... 哈登离开快船加盟骑士了。 并且,从登哥主动提出交易申请,到运作彻底完成,期间仅仅花费了不到24个小时...
金价强劲反弹,黄金ETF博时涨... 截止2月4日10点12分,上证指数涨0.25%,深证成指跌0.75%,创业板指跌1.82%。ETF方...
硬科技板块震荡回调,关注科创2... 截至午间收盘,科创100指数下跌1.9%,科创200指数、科创综指均下跌2.1%,科创50指数下跌2...
信用卡不良贷款高企,广州银行关... 本报(chinatimes.net.cn)记者李明会 北京报道 信用卡退潮持续蔓延。 近日,广州银行...
东鹏饮料登陆港交所,深圳南山再... 深圳商报·读创客户端记者 张国锋 2月3日,东鹏饮料(集团)股份有限公司正式在香港主板上市(股票代码...
全球共振修复,快跌快涨后的整固 来源:市场资讯 (来源:东北证券金融世界) 行情回顾 周二市场震荡回升,上证指数收于4067点、上涨...
工商银行取得数据查询方法专利 国家知识产权局信息显示,中国工商银行股份有限公司取得一项名为“数据查询方法、装置、设备及存储介质”的...
跨境贸易新框架推动玩具产业落地... 日前,信领供应链金融(广东)有限公司(简称“信领金融”)与贵州领圈跨境供应链管理服务有限公司(简称“...