This project using Genetic Algorithm to search maximum of a function in a specific interval. If in a specific interval a function can not be differentiated then we have to use numerical method to find its maximum. Compare to what we did I last project: Fibonacci Search method, we don’t need the function to have specific properties like unimodal. Theoretically it can be used in any function. That’s the one of the advantages of evolutionary computing. We don’t need to analyze the complex details of a problem, we just need to simply choose the better solutions as reproduction seeds in an evolutionary computing. In another words we only need to care about the results not the process. That made the algorithm simple. Below we analyze the result of the project in three ways, population size—string length, population size—mutation rate, string length—mutation rate.
Testing function is f(x)=x*sin(10*pi*x)+1.0, when x=1.85 f(x)max=2.85
|
popsize\Length |
|
8 |
16 |
32 |
64 |
128 |
|
|
x= |
1.247 |
1.843 |
1.249 |
1.842 |
1.848 |
|
16 |
max= |
2.242 |
2.802 |
2.846 |
2.787 |
2.849 |
|
|
x= |
1.835 |
1.453 |
1.853 |
1.848 |
1.650 |
|
32 |
max= |
2.242 |
2.447 |
2.846 |
2.842 |
2.650 |
|
|
x= |
1.847 |
1.846 |
1.249 |
1.859 |
1.850 |
|
64 |
max= |
2.839 |
2.829 |
2.247 |
2.778 |
2.850 |
|
|
x= |
1.847 |
1.850 |
1.850 |
1.850 |
1.850 |
|
128 |
max= |
2.839 |
2.850 |
2.850 |
2.850 |
2.850 |
|
|
x= |
1.847 |
1.850 |
1.850 |
1.850 |
1.850 |
|
256 |
max= |
2.839 |
2.850 |
2.850 |
2.850 |
2.850 |
|
|
x= |
1.850 |
1.850 |
1.850 |
1.850 |
1.850 |
|
512 |
max= |
2.850 |
2.850 |
2.850 |
2.850 |
2.850 |
We can see the accuracy of the results increase significantly as the population size increase especially from 16 to 32. In our case the accuracy—string length relationship is not significant.
|
popsize\mutation |
0.01 |
0.02 |
0.03 |
0.04 |
0.05 |
|
|
|
x= |
1.855 |
1.821 |
1.833 |
1.648 |
1.848 |
|
16 |
max= |
2.840 |
2.100 |
2.568 |
2.645 |
2.849 |
|
|
x= |
1.650 |
1.648 |
1.645 |
1.850 |
1.650 |
|
32 |
max= |
2.650 |
2.646 |
2.678 |
2.850 |
2.650 |
|
|
x= |
1.845 |
1.850 |
1.850 |
1.850 |
1.850 |
|
64 |
max= |
2.820 |
2.850 |
2.850 |
2.850 |
2.850 |
|
|
x= |
1.449 |
1.850 |
1.850 |
1.850 |
1.850 |
|
128 |
max= |
2.449 |
2.850 |
2.850 |
2.850 |
2.850 |
|
|
x= |
1.850 |
1.850 |
1.850 |
1.850 |
1.850 |
|
256 |
max= |
2.839 |
2.850 |
2.850 |
2.850 |
2.850 |
|
|
x= |
1.848 |
1.850 |
1.850 |
1.850 |
1.850 |
|
512 |
max= |
2.843 |
2.850 |
2.850 |
2.850 |
2.850 |
Again,
we can see the accuracy of the results increase significantly as the mutation
rate increase when the when the population size is big enough(in our case
greater or equal to 32). The accuracy also increase as the population size
increase.
|
Length\mutation |
0.01 |
0.02 |
0.03 |
0.04 |
0.05 |
|
|
|
x= |
1.447 |
1.447 |
1.447 |
1.835 |
1.835 |
|
8 |
max= |
2.441 |
2.441 |
2.441 |
2.643 |
2.643 |
|
|
x= |
1.455 |
1.449 |
1.451 |
1.450 |
1.453 |
|
16 |
max= |
2.435 |
2.448 |
2.450 |
2.450 |
2.447 |
|
|
x= |
1.248 |
1.250 |
1.238 |
1.250 |
1.853 |
|
32 |
max= |
2.247 |
2.250 |
2.155 |
2.250 |
2.846 |
|
|
x= |
1.650 |
1.648 |
1.645 |
1.860 |
1.847 |
|
64 |
max= |
2.650 |
2.646 |
2.618 |
2.773 |
2.842 |
Again,
we can see the accuracy of the results increase significantly as the mutation
rate increase when the when the string length is long enough(in our case greater
or equal to 32). In our case the accuracy—string length relationship is not
significant.