遗传算法(GA)和遗传规划(GP)是一个有趣的研究领域。
我想知道你使用GA/GP解决的具体问题,以及如果你没有自己的库/框架,你使用了什么库/框架。
问题:
你用GA/GP解决过什么问题? 你使用了哪些库/框架?
我在寻找第一手的经验,所以请不要回答,除非你有。
遗传算法(GA)和遗传规划(GP)是一个有趣的研究领域。
我想知道你使用GA/GP解决的具体问题,以及如果你没有自己的库/框架,你使用了什么库/框架。
问题:
你用GA/GP解决过什么问题? 你使用了哪些库/框架?
我在寻找第一手的经验,所以请不要回答,除非你有。
当前回答
没有家庭作业。
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.
其他回答
在大学期间,我们使用NERO(神经网络和遗传算法的结合)来教游戏中的机器人做出智能决策。非常酷。
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.
这个系统完全是从零开始编写的,我没有使用任何其他库。我并不反对使用这些东西,只要它们能提供可靠的结果,但是您必须注意许可兼容性和代码可移植性问题。
我使用遗传算法(以及一些相关技术)来确定风险管理系统的最佳设置,该系统试图阻止淘金者使用偷来的信用卡来购买mmo游戏。该系统将接收数千笔具有“已知”值的交易(欺诈与否),并找出最佳设置组合,以正确识别欺诈交易,而不会产生太多误报。
We had data on several dozen (boolean) characteristics of a transaction, each of which was given a value and totalled up. If the total was higher than a threshold, the transaction was fraud. The GA would create a large number of random sets of values, evaluate them against a corpus of known data, select the ones that scored the best (on both fraud detection and limiting the number of false positives), then cross breed the best few from each generation to produce a new generation of candidates. After a certain number of generations the best scoring set of values was deemed the winner.
创建用于测试的已知数据语料库是该系统的阿喀琉斯之踵。如果你等待退款,你在试图回应欺诈者时就会落后几个月,所以有人必须手动审查大量交易,以建立数据库,而不必等待太长时间。
这最终确定了绝大多数的欺诈行为,但在最容易欺诈的项目上,这一比例无法低于1%(考虑到90%的交易可能是欺诈,这已经相当不错了)。
我用perl完成了所有这些。在一个相当旧的linux机器上运行一次软件需要1-2个小时(20分钟通过WAN链路加载数据,其余时间用于处理)。任何给定代的大小都受到可用RAM的限制。我会一遍又一遍地运行它,稍微改变参数,寻找一个特别好的结果集。
总而言之,它避免了手动调整数十个欺诈指标的相对值所带来的一些失误,并且始终能够提出比我手动创建的更好的解决方案。AFAIK,它仍然在使用(大约3年后我写了它)。
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来优化座位分配。80位客人超过10张桌子。评估功能是基于让人们和他们的约会对象在一起,把有共同点的人放在一起,把观点完全相反的人放在不同的桌子上。
我运行了几次。每次我都有九张好桌子,还有一张都是怪球。最后,我妻子安排了座位。
我的旅行推销员优化器使用了一种新的染色体到行程的映射,这使得繁殖和变异染色体变得很简单,没有产生无效行程的风险。
更新:因为一些人问了…
以任意但一致的顺序(如按字母顺序排列)的客人(或城市)数组开始。称之为参考溶液。把客人的座位号看作是他/她的座位号。
我们没有尝试直接在染色体中编码这种顺序,而是编码将参考溶液转化为新溶液的指令。具体来说,我们将染色体视为数组中要交换的索引列表。为了解码染色体,我们从参考溶液开始,并应用由染色体指示的所有交换。交换数组中的两个条目总是会得到一个有效的解决方案:每个来宾(或城市)仍然只出现一次。
因此,染色体可以随机生成,突变,并与其他染色体交叉,总是会产生有效的解决方案。