在遗传算法的线性适应度变换产生负的适应值 [英] Linear fitness scaling in Genetic Algorithm produces negative fitness values

查看:547
本文介绍了在遗传算法的线性适应度变换产生负的适应值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个遗传与健身功能,可以计算结果为负值或正值。为了这个问题,我们假设该函数

I have a GA with a fitness function that can evaluate to negative or positive values. For the sake of this question let's assume the function

u = 5 - (x^2 + y^2)

其中

x in [-5.12 .. 5.12]
y in [-5.12 .. 5.12]

现在在选择阶段 GA到我在用的简单的轮盘赌。既然要能够使用简单的轮盘赌我的健身功能必须是积极的具体案例的人口,我开始寻找扩展的解决方案。最自然的似乎是线性适应度变换。它应该是pretty的直白,例如看的这个实现。不过,我的即使经过线性比例越来越负值

Now in the selection phase of GA I am using simple roulette wheel. Since to be able to use simple roulette wheel my fitness function must be positive for concrete cases in a population, I started looking for scaling solutions. The most natural seems to be linear fitness scaling. It should be pretty straightforward, for example look at this implementation. However, I am getting negative values even after linear scaling.

例如对于上面提到的功能,而这些适应值:

For example for the above mentioned function and these fitness values:

-9.734897  -7.479017 -22.834280  -9.868979 -13.180669   4.898595

线性缩放后,我得到这些值

after linear scaling I am getting these values

-9.6766040 -11.1755111  -0.9727897  -9.5875139  -7.3870793 -19.3997490

相反,我想将它们扩展到正面的价值观,所以我可以做轮盘赌选择在下一阶段。

Instead, I would like to scale them to positive values, so I can do roulette wheel selection in the next phase.

我必须做一些根本性的错误在这里。我应该如何解决这个问题?

I must be doing something fundamentally wrong here. How should I approach this problem?

推荐答案

您在V最小可能值= 5 - (2 * 5.12 ^ 2)。为什么不直接将它添加到你的U?

Your smallest possible value for u = 5 - (2*5.12^2). Why not just add this to your u?

这篇关于在遗传算法的线性适应度变换产生负的适应值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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