Artificial Neural Network 简明教程
Artificial Neural Network - Genetic Algorithm
自然一直都是全人类的伟大灵感来源。遗传算法(GA)是基于自然选择和遗传学概念的搜索算法。GA 是一个更大计算分支的子集,该分支称为 Evolutionary Computation 。
Nature has always been a great source of inspiration to all mankind. Genetic Algorithms (GAs) are search-based algorithms based on the concepts of natural selection and genetics. GAs are a subset of a much larger branch of computation known as Evolutionary Computation.
GA 是约翰·霍兰及其学生和密歇根大学的同事们(最著名的是戴维·E·戈德堡)开发的,并且此后已经在各种优化问题上取得了高度成功。
GAs was developed by John Holland and his students and colleagues at the University of Michigan, most notably David E. Goldberg and has since been tried on various optimization problems with a high degree of success.
在 GA 中,我们有一个给定问题的候选解池或人群。这些解然后经过重组和变异(如同自然遗传学),生成新的孩子,并在这个过程中重复各种世代。每个个体(或候选解)都分配一个适应值(基于其目标函数值),并且适应性强的个体有较高的交配机会,并产生更多“适应性更强”的个体。这与达尔文的“适者生存”理论是一致的。
In GAs, we have a pool or a population of possible solutions to the given problem. These solutions then undergo recombination and mutation (like in natural genetics), producing new children, and the process is repeated over various generations. Each individual (or candidate solution) is assigned a fitness value (based on its objective function value) and the fitter individuals are given a higher chance to mate and yield more “fitter” individuals. This is in line with the Darwinian Theory of “Survival of the Fittest”.
通过这种方式,我们不断“进化”出更好的个体或解决方案,直至达到停止准则。
In this way, we keep “evolving” better individuals or solutions over generations, till we reach a stopping criterion.
遗传算法在本质上是充分随机化的,但它们比随机局部搜索(我们仅尝试各种随机解决方案,同时跟踪迄今为止最好的解决方案)表现得更好,因为它们也利用历史信息。
Genetic Algorithms are sufficiently randomized in nature, however they perform much better than random local search (in which we just try various random solutions, keeping track of the best so far), as they exploit historical information as well.
Advantages of GAs
GA 具有各种优势,使它们非常受欢迎。这些包括−
GAs have various advantages which have made them immensely popular. These include −
-
Does not require any derivative information (which may not be available for many real-world problems).
-
Is faster and more efficient as compared to the traditional methods.
-
Has very good parallel capabilities.
-
Optimizes both continuous and discrete functions as well as multi-objective problems.
-
Provides a list of “good” solutions and not just a single solution.
-
Always gets an answer to the problem, which gets better over the time.
-
Useful when the search space is very large and there are large number of parameters involved.
Limitations of GAs
与任何技术一样,遗传算法也有几个局限性。这些包括 −
Like any technique, GAs also suffers from a few limitations. These include −
-
GAs are not suited for all problems, especially problems which are simple and for which derivative information is available.
-
Fitness value is calculated repeatedly, which might be computationally expensive for some problems.
-
Being stochastic, there are no guarantees on the optimality or the quality of the solution.
-
If not implemented properly, GA may not converge to the optimal solution.
GA – Motivation
遗传算法有能力“足够快”地提供“足够好”的解决方案。这使得遗传算法在解决优化问题中很有吸引力。需要遗传算法的原因如下 −
Genetic Algorithms have the ability to deliver a “good-enough” solution “fast-enough”. This makes Gas attractive for use in solving optimization problems. The reasons why GAs are needed are as follows −
Solving Difficult Problems
在计算机科学中,有很多问题是 NP-Hard 。这基本上意味着,即使是最强大的计算系统也要花很长时间(甚至数年!)才能解决该问题。在这种情况下,遗传算法被证明是一种有效工具,可以在短时间内提供 usable near-optimal solutions 。
In computer science, there is a large set of problems, which are NP-Hard. What this essentially means is that, even the most powerful computing systems take a very long time (even years!) to solve that problem. In such a scenario, GAs prove to be an efficient tool to provide usable near-optimal solutions in a short amount of time.
Failure of Gradient Based Methods
基于传统微积分的方法通过从一个随机点开始并朝梯度方向移动来工作,直到我们到达山顶。这种技术有效,并且非常适合单峰目标函数,例如线性回归中的成本函数。然而,在大多数实际情况下,我们有一个非常复杂的问题,称为景观,由许多山峰和许多山谷组成,这导致此类方法失败,因为它们倾向于停滞在局部最优值,如下图所示。
Traditional calculus based methods work by starting at a random point and by moving in the direction of the gradient, till we reach the top of the hill. This technique is efficient and works very well for single-peaked objective functions like the cost function in linear regression. However, in most real-world situations, we have a very complex problem called as landscapes, made of many peaks and many valleys, which causes such methods to fail, as they suffer from an inherent tendency of getting stuck at the local optima as shown in the following figure.
Getting a Good Solution Fast
旅行商问题 (TSP) 等一些困难问题具有实际应用,例如寻路和超大规模集成 (VLSI) 设计。现在想象一下您正在使用 GPS 导航系统,它需要几分钟(甚至几小时)来计算从源到目的地的“最佳”路径。在这样的实际应用中,延迟是不可接受的,因此需要一个“足够好”的解决方案,即“快速”交付的解决方案。
Some difficult problems like the Travelling Salesman Problem (TSP), have real-world applications like path finding and VLSI Design. Now imagine that you are using your GPS Navigation system, and it takes a few minutes (or even a few hours) to compute the “optimal” path from the source to destination. Delay in such real-world applications is not acceptable and therefore a “good-enough” solution, which is delivered “fast” is what is required.
How to Use GA for Optimization Problems?
我们已经知道,优化是为了使设计、情况、资源和系统等尽可能有效。优化过程在以下图表中显示。
We already know that optimization is an action of making something such as design, situation, resource, and system as effective as possible. Optimization process is shown in the following diagram.
Stages of GA Mechanism for Optimization Process
以下是用于优化问题时 GA 机制的阶段。
Followings are the stages of GA mechanism when used for optimization of problems.
-
Generate the initial population randomly.
-
Select the initial solution with the best fitness values.
-
Recombine the selected solutions using mutation and crossover operators.
-
Insert offspring into the population.
-
Now if the stop condition is met, then return the solution with their best fitness value. Else, go to step 2.