designing fitness function in genetic algorithm

2020-04-10 04:44发布

问题:

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?

回答1:

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.



回答2:

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.