遗传算法(GA)和遗传规划(GP)是一个有趣的研究领域。
我想知道你使用GA/GP解决的具体问题,以及如果你没有自己的库/框架,你使用了什么库/框架。
问题:
你用GA/GP解决过什么问题? 你使用了哪些库/框架?
我在寻找第一手的经验,所以请不要回答,除非你有。
遗传算法(GA)和遗传规划(GP)是一个有趣的研究领域。
我想知道你使用GA/GP解决的具体问题,以及如果你没有自己的库/框架,你使用了什么库/框架。
问题:
你用GA/GP解决过什么问题? 你使用了哪些库/框架?
我在寻找第一手的经验,所以请不要回答,除非你有。
当前回答
我不知道家庭作业算不算…
在我学习期间,我们推出了自己的程序来解决旅行推销员问题。
我们的想法是对几个标准进行比较(映射问题的难度,性能等),我们还使用了其他技术,如模拟退火。
它运行得很好,但我们花了一段时间来理解如何正确地进行“复制”阶段:将手头的问题建模成适合遗传编程的东西,这对我来说是最难的部分……
这是一门有趣的课程,因为我们也涉猎了神经网络之类的知识。
我想知道是否有人在“生产”代码中使用这种编程。
其他回答
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。
I used a simple genetic algorithm to optimize the signal to noise ratio of a wave that was represented as a binary string. By flipping the the bits certain ways over several million generations I was able to produce a transform that resulted in a higher signal to noise ratio of that wave. The algorithm could have also been "Simulated Annealing" but was not used in this case. At their core, genetic algorithms are simple, and this was about as simple of a use case that I have seen, so I didn't use a framework for generation creation and selection - only a random seed and the Signal-to-Noise Ratio function at hand.
我年轻时就尝试过GA。我用Python写了一个模拟器,工作原理如下。
这些基因编码了神经网络的权重。
神经网络的输入是检测触摸的“天线”。较高的数值表示非常接近,0表示不接触。
输出是两个“轮子”。如果两个轮子都向前,这个人也向前。如果轮子方向相反,他就会转向。输出的强度决定了车轮转动的速度。
生成了一个简单的迷宫。这真的很简单,甚至很愚蠢。屏幕下方是起点,上方是球门,中间有四面墙。每面墙都有一个随机的空间,所以总是有一条路。
一开始我只是随机挑选一些人(我认为他们是bug)。只要有一个人达到了目标,或者达到了时间限制,就会计算适合度。它与当时到目标的距离成反比。
然后我把它们配对,“培育”它们来创造下一代。被选择繁殖的概率与它的适应性成正比。有时,这意味着如果一个人具有非常高的相对适应性,就会与自己反复繁殖。
I thought they would develop a "left wall hugging" behavior, but they always seemed to follow something less optimal. In every experiment, the bugs converged to a spiral pattern. They would spiral outward until they touched a wall to the right. They'd follow that, then when they got to the gap, they'd spiral down (away from the gap) and around. They would make a 270 degree turn to the left, then usually enter the gap. This would get them through a majority of the walls, and often to the goal.
我添加的一个功能是在基因中放入一个颜色矢量来跟踪个体之间的相关性。几代之后,它们的颜色都是一样的,这说明我应该有更好的繁殖策略。
我试着让他们制定更好的策略。我把神经网络复杂化了——增加了记忆和其他东西。这没有用。我总是看到同样的策略。
我尝试了各种方法,比如建立单独的基因库,在100代之后才重新组合。但没有什么能促使他们采取更好的策略。也许这是不可能的。
另一个有趣的事情是绘制适应度随时间变化的图表。有明确的模式,比如最大适合度在上升之前会下降。我从未见过一本进化论的书谈到这种可能性。
我曾经尝试制作一个围棋电脑播放器,完全基于基因编程。每个程序都将被视为一系列动作的评估函数。即使是在一个相当小的3x4板上,制作的程序也不是很好。
我使用Perl,并自己编写了所有代码。我今天会做不同的事情。
在我的本科论文中,我使用遗传编程来开发用于空中搜索和救援的合作搜索策略。我使用一个名为NetLogo(基于StarLogo)的开源代理建模平台作为世界模型。NetLogo是用java写的,因此提供了java api -所以GP框架需要基于java -我使用的一个叫做JGAP,还有另一个开源GP框架在java中,我知道叫做ECJ。
模拟运行起来非常慢(我认为这是由于NetLogo模型),所以我的功能/终端集非常有限,限制了搜索空间。尽管如此,我还是想出了一些很好的解决办法。如果你有这种冲动,你可以在我的论文http://www.cse.unsw.edu.au/~ekjo014/z3157867_Thesis.pdf的第三章读到