Confusion about running times/cases when running genetic algorithm (GA)
1 次查看(过去 30 天)
显示 更早的评论
Dear ALL,
I have an optimization problem, including:
(1) An objective function;
(2) 14 variables to optimize, including 4 continuous variable and 10 discrete variables (including 4 integer variables);
But please note that sometimes I might optimize all the 14 variables, but sometimes I might ONLY optimize one variable, eg., 1 discrete variable.
Then how did I optimize ONLY one variable? I just gave both the upper and lower bounds of all other 13 variables to be 0.
Q1: Is it a correct way?
(3) Linear inequality constraints;
(4) Non-linear inequality constraints;
(5) I want to find the global optima.
Therefore, I have been using GA.
But I am confused about the total number of running cases of GA.
For example, I am optimizing ONLY 1 discrete variable and I am giving GA two options.
Then, I thought GA only needs run 2 cases since I only give it 2 options, and then compare the objective function values of these two cases and get the optimal solution.
However, it seems that GA runs a lot of cases...
I am confused...
Thanks in advance for your answers!
Best regards,
Min
0 个评论
采纳的回答
Walter Roberson
2019-1-28
To optimize only one variable, set the lower bounds of the other variables to be the same as the upper bounds, and each entry should be the value associated with the variable. This will seldom be 0.
Mathworks do not have any routines that are guaranteed to find the global optima in general. For some kinds of functions it can be shown that the global optimum can be found (at least with some settings), but not in general. Indeed, it can be shown that in general for some functions, the global optimum cannot possibly be found except by testing every possible combination of values.
2 个评论
Walter Roberson
2019-1-28
ga() has no protection at all against generating random combinations that have already been generated. If there are only 2 valid combinations of values, then it will happily randomly generate from the same 2, trying over and over again to find a better solution. ga() makes no attempt at all to be systematic about the random solutions it tries.
ga() has different ways of deciding where to "move to" next, including ways that depened upon centroids or best current member. Because of that, it is possible in theory that the exact same input vector in a different generation could lead to a different solution that might be better, so ga() should not prevent combinations that it has tried before.
What ga() does have is a "stall" limit, where it can figure out that nothing has improved for a number of generations, at which point it gives up. You can configure the stall limit in the options structure.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genetic Algorithm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!