Number of plots by gaplotpareto

3 ビュー (過去 30 日間)
asaii
asaii 2023 年 11 月 22 日
コメント済み: Alan Weiss 2023 年 11 月 28 日
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);

採用された回答

Alan Weiss
Alan Weiss 2023 年 11 月 27 日
If I understand your question, you are asking either
  • How does the solver choose the number of points to plot? Or
  • How does the solver decide to make a 2-D plot?
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 件のコメント
asaii
asaii 2023 年 11 月 28 日
Thank you for teaching me so kindly.
The content I wanted to ask about was "How does the solver choose the number of points to plot?"
I found more details at the URL you provided.
As an additional question, is it possible to monitor the process of calculating the number of plots programmatically?
Alan Weiss
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 ExchangeGenetic Algorithm についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by