选择父母在遗传算法中交叉? [英] Choosing parents to crossover in genetic algorithms?

查看:239
本文介绍了选择父母在遗传算法中交叉?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,这是家庭作业的一部分.

First of all, this is a part of a homework.

我正在尝试实施遗传算法.我对选择要跨界的父母感到困惑.

I am trying to implement a genetic algorithm. I am confused about selecting parents to crossover.

在我的笔记中(显然是错误的),这是作为示例完成的;

In my notes (obviously something is wrong) this is what is done as example;

  1. Pc(交叉的可能性)*种群大小=估计要交叉的染色体数(如果不均匀,则舍入为最接近的偶数之一)
  2. 为每个染色体选择[0,1]范围内的随机数,如果该数目小于Pc,则选择该染色体作为交叉对.

但是当应用第二步时,选择的染色体数等于第一步中发现的结果.由于随机性,并非总是可以保证的.

But when second step applied, chosen chromosome count is equals to result found in first step. Which is not always guaranteed because of randomness.

所以这没有任何意义.我搜索了选择父级进行交叉的方法,但发现的只是交叉技术(单点,剪切和切片等)以及如何在所选父级之间进行交叉(我对这些方法没有问题).我只是不知道应该选择哪个染色体进行杂交.有什么建议或简单的例子吗?

So this does not make any sense. I searched for selecting parents for crossover but all i found is crossover techniques (one-point, cut and slice etc.) and how to crossover between chosen parents (i do not have a problem with these). I just don't know which chromosomesi should choose for crossover. Any suggestions or simple example?

推荐答案

您可以这样实现:

对于每个新孩子,您将以随机概率决定是否由交叉产生.如果是,则选择两个父母,例如.通过轮盘赌选择或锦标赛选择.两个父母生了一个孩子,然后您以突变概率对其进行了突变,并将其添加到了下一代中.如果否,则仅选择一个父"克隆它,以概率对其进行突变,然后将其添加到下一个种群中.

For every new child you decide if it will result from crossover by random probability. If yes, then you select two parents, eg. through roulette wheel selection or tournament selection. The two parents make a child, then you mutate it with mutation probability and add it to the next generation. If no, then you select only one "parent" clone it, mutate it with probability and add it to the next population.

我注意到了一些其他意见,我想发表评论.我经常阅读染色体"一词,但该词应该是单独的.您几乎不会选择染色体,而是完整的个体.染色体只是解决方案的一部分.这也许很挑剔,但解决方案不是染色体.一个解决方案是一个由几个染色体组成的个体,这些染色体由以等位基因形式显示其表达的基因组成.通常,一个人只有一条染色体,但是混合使用术语还是不合适的.

Some other observations I noted and that I like to comment. I often read the word "chromosomes" when it should be individual. You hardly ever select chromosomes, but full individuals. A chromosome is just one part of a solution. That may be nitpicking, but a solution is not a chromosome. A solution is an individual that consists of several chromosomes which consist of genes which show their expression in the form of alleles. Often an individual has only one chromosome, but it's still not okay to mix terms.

我还注意到,您标记了遗传编程,这基本上只是遗传算法的一种特殊类型.在GP中,您将树木视为可以代表数学公式或计算机程序的染色体.您的问题似乎与GP无关.

Also I noted that you tagged genetic programming which is basically only a special type of a genetic algorithm. In GP you consider trees as a chromosome which can represent mathematical formulas or computer programs. Your question does not seem to be about GP though.

这篇关于选择父母在遗传算法中交叉?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆