Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

designing fitness function in genetic algorithm

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?

like image 446
Becky Avatar asked Feb 02 '26 14:02

Becky


2 Answers

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.

like image 168
JohnIdol Avatar answered Feb 05 '26 09:02

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.

like image 27
Milo Avatar answered Feb 05 '26 07:02

Milo