- How does the solver choose the number of points to plot? Or
- How does the solver decide to make a 2-D plot?
Number of plots by gaplotpareto
10 次查看(过去 30 天)
显示 更早的评论
How is the number of plots in the graph from this document defined?
x = -10:0.5:10;
f1 = (x+2).^2 - 10;
f2 = (x-2).^2 + 20;
plot(x,f1);
hold on;
plot(x,f2,'r');
grid on;
title('Plot of objectives ''(x+2)^2 - 10'' and ''(x-2)^2 + 20''');
FitnessFunction = @simple_multiobjective;
numberOfVariables = 1;
[x,fval] = gamultiobj(FitnessFunction,numberOfVariables);
size(x)
size(fval)
A = []; b = [];
Aeq = []; beq = [];
lb = -1.5;
ub = 0;
x = gamultiobj(FitnessFunction,numberOfVariables,A,b,Aeq,beq,lb,ub);
options = optimoptions(@gamultiobj,'PlotFcn',{@gaplotpareto,@gaplotscorediversity});
gamultiobj(FitnessFunction,numberOfVariables,[],[],[],[],lb,ub,options);
FitnessFunction = @(x) vectorized_multiobjective(x);
options = optimoptions(@gamultiobj,'UseVectorized',true);
gamultiobj(FitnessFunction,numberOfVariables,[],[],[],[],lb,ub,options);
0 个评论
采纳的回答
Alan Weiss
2023-11-27
If I understand your question, you are asking either
The first question is asking how does the solver work. You can find out be reading the algorithm description: https://www.mathworks.com/help/gads/gamultiobj-algorithm.html
For the second question, the plot function plots one axis for each objective function as long as there are only 2 or 3 objective functions. This problem has two objective functions, so produces a 2-D plot.
If I misunderstood what you were asking, please ask again in more detail.
Alan Weiss
MATLAB mathematical toolbox documentation
2 个评论
Alan Weiss
2023-11-28
I'm not sure that I understand what you are asking. If you are asking about the number of points plotted, the last line of the algorithm description of iterations says "Trim the extended population to have PopulationSize individuals by retaining the appropriate number of individuals of each rank." In other words, the number of points plotted grows as the process continues until PopulationSize points are plotted, and then the software keeps the number at PopulationSize. I don't know offhand how to programmatically query how many points are plotted; I supose that you could use an output function to do that, but I don't know for sure.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
更多回答(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!