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

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

问题:

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

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


当前回答

我构建了一个简单的GA,用于在音乐播放时从频谱中提取有用的模式。输出用于驱动winamp插件中的图形效果。

输入:一些FFT帧(想象一个二维浮点数组) 输出:单个浮点值(输入的加权和),阈值为0.0或1.0 基因:输入权重 适应度函数:占空比、脉宽、BPM在合理范围内的组合。

我将一些ga调整到频谱的不同部分以及不同的BPM限制,所以它们不会趋向于收敛到相同的模式。来自每个种群的前4个的输出被发送到渲染引擎。

一个有趣的副作用是,整个人群的平均健康状况是音乐变化的一个很好的指标,尽管通常需要4-5秒才能发现。

其他回答

我年轻时就尝试过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代之后才重新组合。但没有什么能促使他们采取更好的策略。也许这是不可能的。

另一个有趣的事情是绘制适应度随时间变化的图表。有明确的模式,比如最大适合度在上升之前会下降。我从未见过一本进化论的书谈到这种可能性。

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。

我做了一个完整的GA框架,命名为“GALAB”,解决了很多问题:

定位GSM ANTs (BTS)以减少重叠和空白位置。 资源约束项目调度。 进化图景的创造。(Evopic) 旅行推销员问题。 n -皇后和n -颜色问题。 骑士之旅和背包问题。 魔方和数独谜题。 字符串压缩,基于超字符串问题。 二维包装问题。 微型人工生命APP。 鲁比克难题。

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.

在学校的一次研讨会上,我们开发了一个基于音乐模式生成音乐的应用程序。该程序是在Java中构建的,输出是一个midi文件与歌曲。我们使用不同的GA方法来生成音乐。我认为这个程序可以用来探索新的组合。