遗传算法(GA)和遗传规划(GP)是一个有趣的研究领域。

我想知道你使用GA/GP解决的具体问题,以及如果你没有自己的库/框架,你使用了什么库/框架。

问题:

你用GA/GP解决过什么问题? 你使用了哪些库/框架?

我在寻找第一手的经验,所以请不要回答,除非你有。


当前回答

我做了一些生活在这个小世界里的小动物。他们有一个神经网络大脑,从世界上接收一些输入,输出是其他行动的运动矢量。他们的大脑就是基因。

该项目从随机的动物群体开始,它们的大脑是随机的。输入和输出神经元是静止的,但中间的神经元不是。

环境中有食物和危险。食物可以增加能量,当你有足够的能量时,你就可以交配了。危险会降低能量,如果能量为0,他们就会死亡。

最终,这些生物进化到可以在世界各地移动,寻找食物和躲避危险。

于是我决定做一个小实验。我给这个生物的大脑一个输出神经元叫做“嘴”,一个输入神经元叫做“耳朵”。重新开始,惊讶地发现它们进化到最大化空间,每个生物都呆在各自的部分(食物是随机放置的)。他们学会了相互合作,不妨碍彼此。凡事总有例外。

然后我尝试了一些有趣的事情。死去的生物将成为食物。猜猜发生了什么事!进化出了两种生物,一种是成群攻击,另一种是高度回避。

那么这里的教训是什么呢?沟通意味着合作。一旦你引入了一个元素,即伤害他人意味着你获得了一些东西,那么合作就会被破坏。

我想知道这对自由市场和资本主义体系有何影响。我的意思是,如果企业可以伤害他们的竞争并侥幸逃脱,那么很明显,他们会尽其所能来伤害竞争。

编辑:

我用c++写的,没有使用框架。我自己写了神经网络和GA代码。埃里克,谢谢你这么说。人们通常不相信GA的力量(尽管其局限性很明显),直到他们玩过它。GA很简单,但不过分简单化。

对于怀疑者来说,神经网络已经被证明能够模拟任何功能,只要它们有不止一层。遗传算法是一种非常简单的方法,可以在解空间中找到局部和全局最小值。将遗传算法与神经网络结合起来,你就有了一个很好的方法来寻找函数,为一般问题找到近似解。因为我们使用的是神经网络,所以我们是针对某些输入优化函数,而不是像其他人使用遗传算法那样对某个函数的某些输入进行优化

下面是生存示例的演示代码:http://www.mempko.com/darcs/neural/demos/eaters/ 建立产品说明:

安装darcs, libboost, liballegro, gcc, cmake, make Darcs克隆——懒惰http://www.mempko.com/darcs/neural/ cd神经 cmake。 使 cd演示/吃 吃。/

其他回答

我是一个研究使用进化计算(EC)来自动修复现有程序中的错误的团队的成员。我们已经在现实世界的软件项目中成功地修复了一些真实的错误(参见本项目的主页)。

这种EC修复技术有两种应用。

The first (code and reproduction information available through the project page) evolves the abstract syntax trees parsed from existing C programs and is implemented in Ocaml using our own custom EC engine. The second (code and reproduction information available through the project page), my personal contribution to the project, evolves the x86 assembly or Java byte code compiled from programs written in a number of programming languages. This application is implemented in Clojure and also uses its own custom built EC engine.

进化计算的一个优点是技术的简单性,使得编写自己的自定义实现不太困难。有关遗传规划的一个很好的免费的介绍性文本,请参阅遗传规划的现场指南。

我开发了一个基于多线程摆动的模拟机器人导航通过一组随机网格地形的食物源和矿山,并开发了一个基于遗传算法的策略,探索机器人行为的优化和机器人染色体的适者生存基因。这是使用每个迭代周期的图表和映射来完成的。

从那以后,我发展了更多的游戏行为。我最近为自己构建的一个示例应用程序是一个遗传算法,用于解决在英国寻找路线时的旅行销售人员问题,考虑到起始和目标状态,以及一个/多个连接点,延误,取消,建筑工程,高峰时间,公共罢工,考虑最快和最便宜的路线。然后为某一天的路线提供一个平衡的建议。

一般来说,我的策略是使用基于POJO的基因表示,然后为选择、突变、交叉策略和标准点应用特定的接口实现。我的适应度函数就会变得非常复杂,这是基于我需要作为启发式测量应用的策略和标准。

我还研究了将遗传算法应用于代码中的自动化测试,使用系统突变周期,其中算法理解逻辑,并尝试确定带有代码修复建议的错误报告。基本上,这是一种优化我的代码并提供改进建议的方法,以及一种自动发现新编程代码的方法。我还尝试将遗传算法应用于音乐制作和其他应用。

一般来说,我发现进化策略就像大多数元启发式/全局优化策略一样,一开始学习很慢,但随着解决方案越来越接近目标状态,只要你的适应度函数和启发式很好地对齐,在你的搜索空间内产生收敛,它们就会开始学习。

As part of my undergraduate CompSci degree, we were assigned the problem of finding optimal jvm flags for the Jikes research virtual machine. This was evaluated using the Dicappo benchmark suite which returns a time to the console. I wrote a distributed gentic alogirthm that switched these flags to improve the runtime of the benchmark suite, although it took days to run to compensate for hardware jitter affecting the results. The only problem was I didn't properly learn about the compiler theory (which was the intent of the assignment).

我本可以用现有的默认标志来播种初始种群,但有趣的是,算法发现了一个与O3优化级别非常相似的配置(但实际上在许多测试中更快)。

编辑:我还用Python写了我自己的遗传算法框架,只是使用popen命令来运行各种基准测试,尽管如果不是评估作业,我会看看pyEvolve。

没有家庭作业。

1995年,我作为专业程序员的第一份工作是为标准普尔500指数期货编写一个基于遗传算法的自动交易系统。该应用程序是用Visual Basic 3 [!我不知道我当时是怎么做的,因为VB3甚至没有课程。

The application started with a population of randomly-generated fixed-length strings (the "gene" part), each of which corresponded to a specific shape in the minute-by-minute price data of the S&P500 futures, as well as a specific order (buy or sell) and stop-loss and stop-profit amounts. Each string (or "gene") had its profit performance evaluated by a run through 3 years of historical data; whenever the specified "shape" matched the historical data, I assumed the corresponding buy or sell order and evaluated the trade's result. I added the caveat that each gene started with a fixed amount of money and could thus potentially go broke and be removed from the gene pool entirely.

在对种群的每一次评估之后,幸存者被随机杂交(通过混合来自两个亲本的片段),一个基因被选择为亲本的可能性与它产生的利润成正比。我还添加了点突变的可能性,让事情变得有趣一点。经过几百代这样的基因,我最终得到了一个基因群,它可以把5000美元变成平均约10000美元,而且没有死亡/破碎的可能性(当然是在历史数据上)。

Unfortunately, I never got the chance to use this system live, since my boss lost close to $100,000 in less than 3 months trading the traditional way, and he lost his willingness to continue with the project. In retrospect, I think the system would have made huge profits - not because I was necessarily doing anything right, but because the population of genes that I produced happened to be biased towards buy orders (as opposed to sell orders) by about a 5:1 ratio. And as we know with our 20/20 hindsight, the market went up a bit after 1995.

当你打算粉刷你的房子时,通常很难得到一个确切的颜色组合。通常,你脑海中有一些颜色,但它不是其中一种颜色,供应商向你展示。

昨天,我的GA研究员教授提到了一个发生在德国的真实故事(对不起,我没有更多的参考资料,是的,如果有人要求我可以找到它)。这个家伙(让我们称他为配色员)曾经挨家挨户地帮助人们找到确切的颜色代码(RGB),这将是客户心目中的衣柜。下面是他的做法:

The color guy used to carry with him a software program which used GA. He used to start with 4 different colors- each coded as a coded Chromosome (whose decoded value would be a RGB value). The consumer picks 1 of the 4 colors (Which is the closest to which he/she has in mind). The program would then assign the maximum fitness to that individual and move onto the next generation using mutation/crossover. The above steps would be repeated till the consumer had found the exact color and then color guy used to tell him the RGB combination!

通过将最大适应度分配给接近消费者想法的颜色,配色员的程序增加了收敛到消费者想法的颜色的机会。我发现它很有趣!

现在我已经得到了一个-1,如果你计划更多的-1,请说明这样做的原因!