遗传算法自定义交叉/突变参数问题

9次观看(最近30天)
Doug Rank
Doug Rank 2021年4月7日
你好,
我具有自定义的交叉和突变功能,以实现MATLAB的遗传算法(GA)。我能够让他们上班,但是我对正在传递的论点有一些疑问。请注意,我也在代码调用GA之前生产的初始人口中喂食。
有关如何执行此操作的文档在这里: //www.tianjin-qmedu.com/help/gads/genetic-algorithm-options.html#f20829。 This is the syntax for the custom functions:
xoverKids = myfun(parents, options, nvars, FitnessFcn,...
unused,thisPopulation)
MutationChildren = MyFun(父母,选择,NVARS,
Fitnessfcn,State,ThisScore,ThisPopulation)
First I should note that the documentation has an error for 'unused' for the crossover function. As of R2017b at least, it appears that this argument is a vector of the population scores.
我希望突变和交叉功能的行为取决于所涉及的父母的得分(尤其是跨界)。我也想记录 如何 产生了一种新的更好的解决方案(是一个父母吗?是通过突变产生的吗?等)。我有代码可以做到这一点,但是我从输入中遇到了一些特殊性,我的自定义交叉/突变功能正在接收。
My understanding is that each index of thisScore should correspond to the score of each index of thisPopulation. The population is produced by concatenating [eliteKids; xoverkids; mutationkids] in stepGA.m. Thus for populationSize = 100, eliteCount = 10, crossoverFraction = 0.5, I would expect:
这个人群(1:10)是精英,本人群(11:55)是跨界,本人群(56:100)是突变。同样适用于这一分数。
当我查询成绩的运行the ga, this is what I see for the first 16 elements (with an elite count of 9 in this case):
1614386%我希望这是第一个精英分数
1615044
1615044
1615044
1615044
1615044
1615044
1616655
1616655% I expect this to be the last elite score
1685827%我希望这是第一个跨界得分
1621767
1632825
1663424
1614386% Here is an example where a lower/better score than some of the elites is in the wrong place?
1618049
1616655
最后的评论显示,跨界区的分数比精英地区的分数要好。这与我对输入应如何工作的期望不符。
有人可以澄清应该如何工作或这是错误吗?
如果重要的话,我对GA的电话看起来像这样:
[X,FVAL,EXITFLAG,输出,人口​​,分数] = GA(FitnessFunctionga,...
nvars,[],[],[],[],[],[],,...
[],[],[],opts);
我已经设置了并行运行的选项,使用我的自定义初始总体,使用我的自定义交叉/突变功能。除此之外,没有什么想。

答案(1)

Herbert Triceratops
Herbert Triceratops 2021年8月13日
I think the point is that elites can also be regular parents (hmm...), I don't think there is such a thing as "elite area" or "crossover area". I didn't find anything in MATLAB documentation that says this outright (although I didn't spend that much time looking), but the following quote from MATLAB documentation suggests it: “由于已经评估了精英个人, GA does not reevaluate the fitness function of elite individuals during reproduction." This statement would have no purpose if elites were disjoint from parents. What do you think?

社区寻宝

在Matlab Central中找到宝藏,发现社区如何为您提供帮助!

Start Hunting!