遗传算法中设计适应度函数
我需要求解联立线性方程(具有 7 个未知数的 5 个方程,即欠定问题),其中变量在很大范围内变化 [0 - 1,00,000]。有人可以建议我应该使用什么健身功能吗?
I need to solve simultaneous linear equations (5 equations with 7 unknowns i.e an under-determined problem) where the variables vary over a wide range of
[0 - 1,00,000]. Can someone suggest what fitness function I should use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我猜你指的是一个由 5 个线性方程组和 7 个变量组成的系统。
本文 似乎显示了您正在寻找的内容。您基本上需要定义一个成本函数并使用 GA 来最小化它。在 pdf 中搜索“健身功能”以了解具体操作方法。这个想法是找到一些衡量方法来衡量您的变量集如何接近系统的解决方案(或在您的情况下为解决方案)。
I guess you are referring to a system of 5 linear equations with 7 variables.
This paper seems to show what you're looking for. You basically need to define a cost function and use the GA to minimize it. Search the pdf for "fitness function" to see exactly how to do this. The idea is to find some measure of how well your set of variable approximates the solution (or a solution in your case) for the system.
假设你的系统是这样写的:
e_1(x1, x2, ..., x7) = 0
e_2(x1, x2, ..., x7) = 0
...
e_5(x1, x2, ..., x7) = 0
则适应度函数 F(x1, x2, ..., x7) = abs(e_1(x1, ..., x7)) + abs(e_2(x1) , ..., x7) + ... + abs(e_5(x1, ..., x7) 可能会成功。您可能可以用其他东西更改 + (例如乘法或最大运算符,如中建议的那样) @JohnIdol 提到的文章)
这可能也适用于非线性系统。
Assuming that your system is written in a form like this:
e_1(x1, x2, ..., x7) = 0
e_2(x1, x2, ..., x7) = 0
...
e_5(x1, x2, ..., x7) = 0
then a fitness function F(x1, x2, ..., x7) = abs(e_1(x1, ..., x7)) + abs(e_2(x1, ..., x7) + ... + abs(e_5(x1, ..., x7) may do the trick. You can probably change the + with something else (such as multiplication or the maximum operator, as proposed in the article mentioned by @JohnIdol )
This will probably work in non-linear systems also.