遗传算法(GA)和遗传规划(GP)是一个有趣的研究领域。
我想知道你使用GA/GP解决的具体问题,以及如果你没有自己的库/框架,你使用了什么库/框架。
问题:
你用GA/GP解决过什么问题? 你使用了哪些库/框架?
我在寻找第一手的经验,所以请不要回答,除非你有。
遗传算法(GA)和遗传规划(GP)是一个有趣的研究领域。
我想知道你使用GA/GP解决的具体问题,以及如果你没有自己的库/框架,你使用了什么库/框架。
问题:
你用GA/GP解决过什么问题? 你使用了哪些库/框架?
我在寻找第一手的经验,所以请不要回答,除非你有。
当前回答
在读完《盲人钟表匠》之后,我对道金斯所说的帕斯卡程序产生了兴趣,他开发了一个可以随着时间进化的生物模型。我对使用Swarm编写自己的程序很感兴趣。我没有画出他画的那些奇特的生物图形,但我的“染色体”控制着影响生物体生存能力的特征。他们生活在一个简单的世界里,可以与彼此和环境决一死战。
生物的生存或死亡部分取决于偶然性,但也取决于它们如何有效地适应当地环境,如何有效地消耗营养物质以及如何成功地繁殖。这很有趣,但也向我妻子证明了我是一个极客。
其他回答
Several years ago I used ga's to optimize asr (automatic speech recognition) grammars for better recognition rates. I started with fairly simple lists of choices (where the ga was testing combinations of possible terms for each slot) and worked my way up to more open and complex grammars. Fitness was determined by measuring separation between terms/sequences under a kind of phonetic distance function. I also experimented with making weakly equivalent variations on a grammar to find one that compiled to a more compact representation (in the end I went with a direct algorithm, and it drastically increased the size of the "language" that we could use in applications).
最近,我将它们用作默认假设,以此来测试由各种算法生成的解决方案的质量。这主要涉及分类和不同类型的拟合问题(即创建一个“规则”,解释审查员对数据集所做的一组选择)。
我做了一些生活在这个小世界里的小动物。他们有一个神经网络大脑,从世界上接收一些输入,输出是其他行动的运动矢量。他们的大脑就是基因。
该项目从随机的动物群体开始,它们的大脑是随机的。输入和输出神经元是静止的,但中间的神经元不是。
环境中有食物和危险。食物可以增加能量,当你有足够的能量时,你就可以交配了。危险会降低能量,如果能量为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演示/吃 吃。/
当你打算粉刷你的房子时,通常很难得到一个确切的颜色组合。通常,你脑海中有一些颜色,但它不是其中一种颜色,供应商向你展示。
昨天,我的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,请说明这样做的原因!
In 2007-9 I developed some software for reading datamatrix patterns. Often these patterns were difficult to read, being indented into scratched surfaces with all kinds of reflectance properties, fuzzy chemically etched markings and so on. I used a GA to fine tune various parameters of the vision algorithms to give the best results on a database of 300 images having known properties. Parameters were things like downsampling resolution, RANSAC parameters, amount of erosion and dilation, low pass filtering radius, and a few others. Running the optimisation over several days this produced results which were about 20% better than naive values on a test set of images unseen during the optimisation phase.
这个系统完全是从零开始编写的,我没有使用任何其他库。我并不反对使用这些东西,只要它们能提供可靠的结果,但是您必须注意许可兼容性和代码可移植性问题。
没有家庭作业。
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.