Options for ga() with only integer variables
显示 更早的评论
Hello to everyone,
I want to run a ga() with just integer variables.
The boundary conditions that I set for myself are: number of variables is 5, lb is 1 and the ub is 4. So there are 1024 possible combinations. My number of generations will be 7 with a Population of 30.
I am using gacreationuniform, crossoverlaplace and mutationpower. Also, I will try several Crossover fractions.
When I run with this set of parameters and with an crossover fraction of 0.2, I will "only" get 132 unique individuals.
Does any one have an idea to set better parameters for the ga()?
Thank you very much and greetings,
Jonas
2 个评论
John D'Errico
2022-8-31
With that few possible options, why not just evaluate the objective at every valid combination, and take the best?
Jonas
2022-8-31
回答(1 个)
Walter Roberson
2022-9-1
1 个投票
Suppose you had a surface that had a large bowl, but also had a narrow deeper pit. Any given initial population might happen to all be in the catch-basin for the large bowl. Optimization on that bowl might only require examining 1/8th or so of the possibilities to find the minima of the bowl.
Is cross-over and mutation guaranteed to find the narrow deep pit? No -- at least not unless you run a large population for a lot of iterations. The catch-basin for the narrow deep pit might only cover (for example) 1/256 th of the possibilities.
2 个评论
I think this is scenario of a large bowl with a narrow pit. The deepest pit lies at
.
x = linspace(1, 7, 60001);
y = exp(-(exp(- abs((x - 4)/0.8))/0.04).^2) - exp(-(x.^4 - 16*x.^2 + 5*x).^2);
plot(x, y), grid on, xlabel('x'), ylabel('y')
fun = @(x) exp(-(exp(- abs((x - 4)/0.8))/0.04).^2) - exp(-(x.^4 - 16*x.^2 + 5*x).^2);
lb = 1;
ub = 7;
options = optimoptions('ga', 'PopulationSize', 30, 'MaxGenerations', 7);
x = ga(fun, 1, [], [], [], [], lb, ub, [], options)
Walter Roberson
2022-9-1
Imagine something like
A B C
* * *
** ** * *
******** ********** * *
* **
+
D E
if you start anywhere in the range A to B, you are going to end up either at D or in the shallow bowl.
If you start in B to C you may end up at the true minima at E (but in some cases you would end up near D anyhow even if you started in B to C range.)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
