0
$\begingroup$

I am learning about genetic algorithms (GA), but I encountered a question about the definition of the fitness function used in GA.

I understand that the fitness function should return a scalar value (e.g. to make sure to return the maximum value for a given individual).

For example, if one wanted to optimize a small molecule $logP$ (to ensure that the returned $logP$ has the maximum values), one can define the fitness value thusly: $J(m) = logP$, and then use GA to optimize the $logP$.

But my question is that I want to make sure that the $logP$ has a value close to 9 (rather than the larger the better), the more closer to 9 the better.

In this case how can I define the fitness function used in GA?

Thanks.

$\endgroup$

1 Answer 1

0
$\begingroup$

I tried to use this one: 1 / abs(logP - 9) as the fitness function. Also considering denominator is zero the corner case. If abs(logP - 9) = 0, then one can set it as very small number like 0.0000000001.

$\endgroup$
1
  • $\begingroup$ Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. $\endgroup$
    – Community Bot
    Sep 20, 2022 at 15:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .