See more information about Genetic Algorithm,you can clickhttps://blog.csdn.net/WFRainn/article/details/80458246
This is the picture of function:
Now we need to find the max value of this function between 0 and 9,accurate it to four decimal places. to be effective, we can use GA to solve it.
GA.py
:Run GA in python
utils.py
:Save some basic function
selection.py
:selection operator
crossover.py
:crossover operator
mutation.py
:mutation operator
Run GA.py
You can change the aim function to see if the result are still effective and exact. Also, you can improve my code to achieve higher effect for GA.